craver2000
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 servo_demo.py 
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

 python myscript.py
) since using the command

Code: Select all

 sudo python myscript.py 
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 "my_script.py", 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”

Who is online

Users browsing this forum: No registered users and 2 guests