25

I am trying to add an interpreter (created using virtualenv) to PyDev but I get the following error:

It seems that the Python /Lib folder (which contains the standard library) was not found /selected during the instal process.

This folder (which contains files such as threading.py and traceback.py) is required for PyDev to function properly (and it must contain the actual source files, not only .pyc files) ...

Note that if this is a virtualenv install, the /Lib folder from the base install needs to be selected (unlike the site-packages which is optional)...

The problem is that there is no /lib folder under my default installation... I created the virtualenv with the 'no-site-packages' option... How can I solve? thanks!

2 Answers 2

23

I've come across this myself before. When adding an interpreter created using virtualenv in PyDev, when it asks for the folders that need to be added to the SYSTEM pythonpath, I had to select
/usr/lib/python2.7
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/plat-linux2
See the screenshot for what I had to do. Here temp is my virtualenv.

enter image description here

Even though the system Python directory was added, PyDev did not pick up the global site packages, so you still achieve the "no-site-packages" effect. I'm assuming you would have to do something similar on Windows i.e. select all the folder in the "Select Needed" dialog, including the C:\Pythonx.x folder.

EDIT: I just tried it out with PyDev 2.3 on Eclipse Indigo (Arch Linux with virtualenv 1.7), and it seems that plat-linux2 does not need to be selected (not sure about lib-tk, but /usr/lib/python2.7 is definitely required). Thanks fijiaaron for pointing it out.

EDIT 2: Pydev 2.5 (and probably 2.6 too, from the docs) still requires the /Lib folder to function properly, though it now lets you ignore the "Python stdlib not found" dialog and add the interpreter anyway (but mentions that it still needs to be included later).

Sign up to request clarification or add additional context in comments.

6 Comments

Can this possibly interfere with the virtual env setup if you run things from within that eclipse environment - ie would it end up using the wrong version of interpreter and libs?
As long global site-packages directory isn't selected, the virtualenv libs should be used. And the selected directory would only include the interpreter that the virtualenv was created with. Haven't noticed any issues so far.
Are you sure /usr/lib/python2.7 has to be selected? This guy doesn't select anything when he sets up the interpreter.
Seems Pydev 2.5 allows you to ignore the dialog but mentions that the /Lib folder needs to be added later for Pydev to function properly. I've updated my answer. Thanks
@Anshuman, how can you say that the "no-site-packages" effect is still preserved. As /usr/lib/python2.7 is added to the path, /usr/lib/python2.7/dist-packages should be picked up
|
0

to skip this message in pydev you can create manual symbolic links to stdlib not linked by virtualenv.

Example:

ln -s /usr/lib/python3.3/threading.py /home/path/to/virtual/myenv/lib/python3.3/threading.py
ln -s /usr/lib/python3.3/traceback.py /home/path/to/virtual/myenv/lib/python3.3/traceback.py

There is a lot of stdlib not linked in virtualenv. Probably you should make as you need manualy.

Look at /usr/lib/python3.3 and compare with /home/path/to/virtual/myenv/lib/python3.3

You can add, per example, /usr/lib/python3.3/concurrent/ in your pydev path.

if you add /usr/lib/python2.7 (or /usr/lib/python3.3) as suggest by Mr. Bhaduri you can explode your virtualenv because your package could look at site-packages directory in /usr/lib/python2.7 and this is exactly what you dont want.

You want isolate your enviroment. You want your package look only in /home/path/to/virtual/myenv/lib/python3.3/site-packages/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.