Posts: 7
Joined: Mon Dec 11, 2017 1:43 am

Installing and running a servo library in virtual environment

Mon Dec 11, 2017 1:53 am

Hi, I wanted to ask if it is possible to use pigpio in a virtual environment?

Running the servo demo script worked for me in a non-virtual environment with the command

Code: Select all

 sudo python 
When I activated the virtual env and proceeded with the same installation and activation steps, I am likewise able to use the demo script with the same command.

However, the problem arise if I leave out sudo in my bash commands (i.e.

Code: Select all

) since using the command

Code: Select all

 sudo python 
would render another module of this script unavailable in the virtual environment.

The error message when I used the non-sudo command goes:
Traceback (most recent call last):
File "", line 13, in
import pigpio
ImportError: No module named pigpio

I suspect the problem lies in the process of installation as I had to use sudo make install in one of the steps. I think I have to install via an alternative method that avoids global installation i.e. sudo. My understanding is that only pip can install packages into a virtualenv (from Pypi) (v.s. sudo which leads to global installation). Is there a way that I can install pigpio into a virtual environment? I appreciate any advice on how I can run pigpio module without using sudo in a virtual environment.

Return to “General programming discussion”