5

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).  
bmu
  • 35,119
  • 13
  • 91
  • 108
clement
  • 51
  • 1
  • 3

4 Answers4

5

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).

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
  • 1
    Thank you for your quick answer. If I understand well, I should not try to set Ipython as an interpreter (because it is not), but just add the IPython path in the Pydev's PYTHONPATH, then Pydev automatically uses the IPython console. I added `/usr/lib/python2.7/site-packages/IPython/` in the Pydev's PYTHONPATH, but I get the error `PyDev console: using default backend (IPython not available).` The directory contains some directories and a lot of .py and .pyc files. I don't which ones are necessary ? Thank you again for your help (and sorry about my previous post, which was truncated) – clement Apr 20 '12 at 12:01
  • You should only add /usr/lib/python2.7/site-packages/, not /usr/lib/python2.7/site-packages/IPython to your PYTHONPATH (as you want to leave the parent folder of the library you want to use in it). – Fabio Zadrozny Apr 20 '12 at 16:14
  • I already have `/usr/lib/python2.7/site-packages/` in the PYTHONPATH, but it does not work ( `PyDev console: using default backend (IPython not available).`). That's why I tried to add the IPython path... Is there a way to get a more explicit error message to find out what is going wrong ? – clement Apr 23 '12 at 09:46
  • You can try opening org.python.pydev.debug/pysrc/pydevconsole.py and adding "import traceback;traceback.print_exc()" when the "from pydev_ipython_console import InterpreterInterface" fails to get more info. – Fabio Zadrozny Apr 24 '12 at 10:49
4

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!!

Luigi Tiburzi
  • 4,265
  • 7
  • 32
  • 43
1

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).

AlonG
  • 69
  • 2
0

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 ...

mr_endres
  • 336
  • 1
  • 2
  • 5