Install ABElectronics_Python_Libraries in Virtual Environment - not working - IOPi Blink LED
2423 Views - Created 30/03/2018
I'm trying to Install ABElectronics_Python_Libraries in Virtual Environment - its not working for me.
i do this:
1. download the Lib into /home/pi/Downloads/ABElectronics_Python_Libraries
2. cd into the downloaded folder and install : sudo python3 setup.py install
in this stage i'm doing small test, following the blinking led and test -- it works fine - led is blinking...
3. now that python3 has the lib installed, im creating virtual environment :
$ sudo python3 –m venv MyEnv1
from my understanding, once the ABElectronics_Python_Libraries already installed in the MAIN python
the virtual environemnt MyEnv1 should have the ABElectronics included.
so, i;m activating the virtual environemnt, and runing the blinking led program, and i get erro rthat the IOPi package not exists .
(MyEnv1) pi@raspberrypi:~/src/python/Projects/BlinkLED $ python app.py
Traceback (most recent call last):
File "app.py", line 1, in <module>
from IOPi import IOPi
ImportError: No module named 'IOPi'
What is wrong here ?
You may need to run the setup.py within the virtual environment in order to run the demo script. Alternatively you can copy the IOPi.py file from the IOPi folder into the same folder as the script you are trying to run and it should then work without having to install the library in the virtual environment.
I already try this "You may need to run the setup.py within the virtual environmen"
before writing my post - but i'll try again.
you also write "Alternativly you can copy the IOPi.py file from the IOPi folder into the same folder as the script you are tring to run"
Do you think that this will be a better choice than running the setup.py after activating the virtual environment ?
What about updating new versions of the ABElectronics_Python_Libraries when new one released ?
Thank you !
If a new version of the ABElectronics_Python_Libraries is released you can just overwrite the old IOPi.py with the updated one and it should continue working.
Thanks for the update.
I want to go with this option of copying the whole ABElectronics_Python_Libraries library into my project root
and change the code to:
from ABElectronics.IOPi import IOPi
then i can move the entire project to another pi and it will be easier to maintain versions etc..
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.