ipython/ipython — Issue #1333: Warning when importing pkg_resources inside ipython
Author: astrofrog
Created: 2012-01-27 10:09:24+00:00
State: open

I'm using ipython 0.13dev (f3ee404d966346c9442d0b19435329bf665d732c) on MacOS 10.7. I have py27-readline installed in MacPorts. If I import pkg_resources or any module depending on pkg_resources, I get the following warning:

$ ipython
Python 2.7.2 (default, Jan 15 2012, 01:01:45)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: import pkg_resources
/opt/local/bin/ipython:1: UserWarning: Module readline was already imported from /Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/IPython/utils/rlineimpl.pyc, but /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline is being added to sys.path
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

If I don't have py27-readline installed, then there is no warning, but the ipython prompt is completely garbled:

$ ipython
/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/IPython/utils/rlineimpl.py:111: RuntimeWarning:
******************************************************************************
libedit detected - readline will not be well behaved, including but not limited to:
* crashes on tab completion
* incorrect history navigation
* corrupting long-lines
* failure to wrap or indent lines properly
It is highly recommended that you install readline, which is easy_installable:
easy_install readline
Note that `pip install readline` generally DOES NOT WORK, because
it installs to site-packages, which come *after* lib-dynload in sys.path,
where readline is located. It must be `easy_install readline`, or to a custom
location on your PYTHONPATH (even --user comes after lib-dyload).
******************************************************************************
RuntimeWarning)
Python 2.7.2 (default, Jan 15 2012, 01:01:45)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
34In[1;3[0;34][0import pkg_resources
34In[1;3[0;34][0