Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VirtualEnv not setting paths correctly, unable to use installed module

Short Version: How do I have PyQt4's configure.py use the SIP version installed in the Virtual Env?

Long version: I know variations on this question have been asked like a million times here but I cannot seem to find the answer. I am trying to install SIP and PyQt4 in a Virtual Env (VE). I am unable to install it to the main system as it is a work computer. We have an older version of PyQt so I am unable just to copy from the site packages.

I have installed SIP in my VE (configure.py --incdir , make, make install) however when I go to run configure on PyQt4 I get the error: Error: This version of PyQt requires SIP v4.19.0 or later. I installed Version 4.19.2. When running sipconfig it tells me it is still using the systems version, even with the VE activated. How do I tell configure.py for PyQt to use the package installed in the VE?

Thanks all!

EDIT: By the looks of it, it seems that my VE is not pulling the python libs from the right place, even when the VE is activated. I added a line to activate append the site-packages and bin dirs the the path and the site-packages to the pythonpath without success. It is still not finding the correct libs.

like image 948
jspada Avatar asked Oct 17 '22 14:10

jspada


1 Answers

Install pip in your virtual env. And check if the pip is using the correct directory using which pip. If it is not using the correct directory, Try this:

pip install --target=<location of site packages of your pip in your virtual env> sip==4.19

If you get an error called permission denied, use

sudo chown -R your_username:your_username path/to/virtuaelenv/

Then do:

pip install PyQt4

If none of the above works, please follow these instructions:

http://movingthelamppost.com/blog/html/2013/07/12/installing_pyqt____because_it_s_too_good_for_pip_or_easy_install_.html

like image 126
Abhishek Menon Avatar answered Oct 21 '22 03:10

Abhishek Menon