How to import from package not installed on hassio

If you developing in python and need import from any package and package not installed in hassio, do following:
Example:
I do need install and work with gtfs-realtime-bindings for real time data from MTA.
In folder /config/python_scripts/ create folder “package”.
Copy all packages you need to /config/python_scripts/package/.
In python script change
from google.transit import gtfs_realtime_pb2
from package.google.transit import gtfs_realtime_pb2
I did it and it working like a charm. Same applies to /config/custom_components/sensor/ folder.

1 Like