5
votes

I would like to use IPython as interpreter in Pydev eclipse plugin.

I have IPython 0.10 and Pydev 2.5.0, running on linux (opensuse).

When I go into Pydev preferences and try to set the IPython path (as explained on this page : http://pydev.org/manual_101_interpreter.html) , I get the following error

"Python stdlib not found or stdlib found without .py files"

The ipython interpreter works fine from a bash terminal, and i get the path from the command "which ipython".

Can someone help me ?

Thanks !

The interpreterInfo.py output is :

python /home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc/interpreterInfo.py 


<xml>
<version>2.7</version>
<executable>/usr/bin/python</executable>
<lib path="out">/home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/scikits.timeseries-0.91.3-py2.7-linux-x86_64.egg</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/distribute-0.6.19-py2.7.egg</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/MeshPy-2011.1-py2.7-linux-x86_64.egg</lib>
<lib path="out">/data/dvp/python</lib>
<lib path="out">/home/mayet</lib>
<lib path="ins">/usr/lib/python27.zip</lib>
<lib path="ins">/usr/lib64/python2.7</lib>
<lib path="ins">/usr/lib64/python2.7/plat-linux2</lib>
<lib path="ins">/usr/lib64/python2.7/lib-tk</lib>
<lib path="ins">/usr/lib64/python2.7/lib-old</lib>
<lib path="ins">/usr/lib64/python2.7/lib-dynload</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/PIL</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages</lib>
<lib path="ins">/usr/local/lib/python2.7/site-packages</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/gtk-2.0</lib>
<lib path="ins">/usr/lib/python2.7/site-packages</lib>
<lib path="ins">/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode</lib>
<forced_lib>__builtin__</forced_lib>
<forced_lib>__main__</forced_lib>
<forced_lib>_ast</forced_lib>
<forced_lib>_codecs</forced_lib>
<forced_lib>_sre</forced_lib>
<forced_lib>_symtable</forced_lib>
<forced_lib>_warnings</forced_lib>
<forced_lib>errno</forced_lib>
<forced_lib>exceptions</forced_lib>
<forced_lib>gc</forced_lib>
<forced_lib>imp</forced_lib>                                                                                                                                                        
<forced_lib>marshal</forced_lib>                                                                                                                                                    
<forced_lib>posix</forced_lib>                                                                                                                                                      
<forced_lib>pwd</forced_lib>                                                                                                                                                        
<forced_lib>signal</forced_lib>                                                                                                                                                     
<forced_lib>sys</forced_lib>                                                                                                                                                        
<forced_lib>thread</forced_lib>                                                                                                                                                     
<forced_lib>xxsubtype</forced_lib>                                                                                                                                                  
<forced_lib>zipimport</forced_lib>                                                                                                                                                  
</xml>Traceback (most recent call last):                                                                                                                                            
  File "/home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc/interpreterInfo.py", line 142, in <module>                                                              
raise RuntimeError('Ok, this is so that it shows the output (ugly hack for some platforms, so that it releases the output).')                                                   
RuntimeError: Ok, this is so that it shows the output (ugly hack for some platforms, so that it releases the output).  
4

4 Answers

5
votes

This means that in none of those paths (the xml tag), PyDev can find the Python library files (such as threading.py or traceback.py, etc -- note that this may happen if you have only .pyc files too and not the actual .py files in one of those folders).

Or you didn't leave the folder containing the Python libraries selected during the interpreter configuration process.

Note that you don't really set 'IPython' as an interpreter, you set Python itself as the interpreter and you can have the IPython library installed to make use in the interactive console: http://pydev.org/manual_adv_interactive_console.html (but from your output it seems you're doing this right as you're pointing to configure /usr/bin/python).

4
votes

To get Ipython as default shell do the followings: go to Window-->Preferences-->PyDev-->Interactive Console. In the Initial Interpreter Commands filed add this 2 commands: import IPython; IPython.Shell.IPShell().mainloop() Now every time you'll start your console IPython will be launched as default.

Note1: of course,you need IPython installed of your system for this to work Note2: the interpreter will still complain with something like "In [1]: PyDev console: using default backend (IPython not available)" but it is because it prints it automatically before you have the chance to import IPython.

Hope this helps!! Bye!!

1
votes

Besides the steps mentioned by @mr_endres I also had to verify the path for site-packages. Had the folder but turned out it was empty.

To verify the proper path you can start ipython from terminal and do the following (just an example):

 1. import numpy as np
 2. np.__file__

which returned:

'`/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages`/numpy/__init__.pyc'

I then added: '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages' to the PYTHONPATH (in Eclipse its through preferences->PyDev->Interpreter - Python -> New folder in the PYTHON PATH section).

0
votes

For me the following two steps worked: 1) Add "/usr/lib/python2.7/site-packages/" to the PYTHONPATH 2) Enable under Window->Preferences->PyDev->Interactive Console the option "Connect console to Variables Debug View"

Strangely only with the second step IPython started ...