I was trying to install the brickpi3 python module in a python virtual environment. I created the the environment with virtualenv env --python=python3 I then ran the install.sh script and even tried running the setup.py script. It does not import. Yes I ran this all with the environment activated and also rebooted.
Anyone have any ideas?
Hi @graykevinb,
I was able to import brickpi3 module with Python 2 and Python 3 within a virtualenv environment.
Here’s what I’ve been doing:
-
I cd-ed to ~/Desktop where the user has rw permissions.
-
Created a virtual environment with the virtualenv env --python=python3 command.
-
Activated the env environment with source env/bin/activate.
-
Created another folder on the Desktop called env-test, where than I cd-ed to it.
-
git clone https://github.com/DexterInd/BrickPi3.git - we need the user to have rw access to it, otherwise, pip freeze won’t show up our package.
-
cd-ed to ~/Desktop/env-test/BrickPi3/Software/Python.
-
Run the following commands in this order:
-
python setup.py clean - removes the old build (if there’s one)
-
python setup.py build - creates a new build
-
python setup.py install - installs the current build
-
Install spidev package with pip install spidev.
-
Type python and try to import the brickpi3 module - it’s going to work.
If there are any other questions, Kevin, please tell us here.
Thank you!
1 Like
It worked! Big thanks! I did things a bit differently. I used python3 and did it in the home folder.
Hi @graykevinb,
I’m glad it worked for you.
I’m now closing the thread.
Thank you!