4

I've been trying to set up ipython 3 (running 2.7 works fine) on a mac running Lion, but can't seem to get rid of the following error:

192:~ mlauria$ /Library/Frameworks/Python.framework/Versions/3.2/bin/ipython3
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages\
/IPython/utils/rlineimpl.py:96: RuntimeWarning: Leopard libedit detected - \
readline will not be well behaved including some crashes on tab completion, and \
incorrect history navigation. It is highly recommended that you install readline,\
which is easy_installable with: 'easy_install readline'
  RuntimeWarning)
Python 3.2.2 (v3.2.2:137e45f15c0b, Sep  3 2011, 17:28:59)

easy_install readline worked correctly to fix this on ipython 2.7, but this doesn't fix 3.2.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
gnr
  • 2,324
  • 1
  • 22
  • 24
  • Does `easy_install readline` work correctly and then not help, or does it have errors installing? – blahdiblah Nov 27 '11 at 20:40
  • I should note that `pip install readline` *does not count*, because it will (by default) install readline *behind* the system readline that uses libedit. If you think you already have readline, you might do: `easy_install-3.2 -a readline`. – minrk Nov 27 '11 at 20:51
  • easy_install readline works correctly when fixing this error for ipython 2.7, but doesn't fix it for 3.2. – gnr Nov 27 '11 at 23:00
  • easy_install only installs things for the python easy_install is run with. So if `easy_install readline` works for 2.7, you will need to do `easy_install-3.2 readline` or some such for Python 3.2. You would need setuptools/distribute installed for your Python 3.2 in order to have this command available, of course. I should note that this certainly *does* work in my experience for Python.org 3.2 on OSX 10.7.2. – minrk Nov 28 '11 at 06:30

2 Answers2

6

This is unfortunate as more and more Python distributions on OS X are being built with the Apple-supplied libedit in OS X rather than the GPL-licensed GNU readline library which Apple does not ship. For instance, current 64-bit/32-bit python.org installers for OS X use libedit while the 32-bit-only installers currently use readline since libedit was buggy on older versions of OS X. While the 32-bit-only installer for Python 3.2 can be installed on 10.7, it is problematic on 10.7 if you need to install any C extension modules, as that Python was built with the older 10.4u SDK and ppc archs which are not supported on 10.7. Ideally, iPython should be modified to work correctly with either libedit or readline. If there are Python bugs inhibiting that, bugs against Python itself should be filed. Also, perhaps the maintainers of the readline package on PyPI can be persuaded to build and put a 3.2 binary package out there.

Otherwise you can build it yourself using their source distribution, assuming you have installed Xcode for Lion. If the Python 3.2 bin framework is not in your path, you'll need to do:

$ export PATH=/Library/Frameworks/Python.framework/Versions/3.2/bin:$PATH

Then if you have not already installed Distribute for Python 3.2:

$ curl -O http://python-distribute.org/distribute_setup.py
$ python3.2 distribute_setup.py

Then download, build, and install the readline package from PyPI:

$ easy_install-3.2 readline

Or you could install a version of Python 3.2 from a third-party distributor like MacPorts which does provide a readline port (py32-readline) along with an iPython port.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • thanks ned, this is very helpful - i ended up just going through MacPorts, fairly painless, in case it's helpful to anyone else i also had to run: sudo port -f activate py32-distribute; sudo port install py32-ipython and then make the appropriate alias (though macports gives you the option to create it at the end). – gnr Nov 27 '11 at 22:49
  • Glad it was of help. BTW, when you ask a question on StackOverflow you should either mark the most helpful answer as accepted or edit your question until you do get an acceptable answer. – Ned Deily Nov 28 '11 at 00:06
0

Do you have a command called something like easy_install-3.2?

Looking at readline on PyPI, it looks like there isn't a binary built for Python 3, so you'll probably need the relevant stuff to compile it from source (unless you can find a Python 3 build elsewhere).

Thomas K
  • 39,200
  • 7
  • 84
  • 86
  • To get `easy_install-3.2`, you will need to install Distribute (http://pypi.python.org/pypi/distribute) for your Python 3.2 instance, i.e. download then run `python3.2 distribute_setup.py`. But, as noted, that won't help if there is no 3rd-party `readline` package built for Python 3.2. – Ned Deily Nov 27 '11 at 21:10