Opened 13 years ago

Closed 11 years ago

#31938 closed defect (fixed)

python27 rev 86868 breaks py27-ipython

Reported by: oliver.andrich@… Owned by: akitada@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Cc: mf2k (Frank Schima), jmroot (Joshua Root), michelle.lynn.gill@…, nerdling (Jeremy Lavergne), jyrkiwahlstedt, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), thimo@…
Port: py-ipython python27 python26

Description (last modified by mf2k (Frank Schima))

I am using ipython, but after upgrading to r86868 of the python27 port, ipython can't display a colored prompt. I think this is related to the removal of readline and adding libedit.

Can you please check.

Change History (19)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to jwa@…

comment:2 Changed 13 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:3 Changed 13 years ago by michelle.lynn.gill@…

I can confirm the same issue. This is the specific error I get upon running iPython:

/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/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)

Rolling back to the previous version of python 2.7 fixed the issue.

comment:4 Changed 13 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:5 Changed 13 years ago by mf2k (Frank Schima)

Cc: jmr@… added
Port: python26 added

py26-ipython is also broken for me.

comment:6 Changed 13 years ago by jmroot (Joshua Root)

Works for me. The ipython ports now depend on py-readline. I didn't rev bump because ipython doesn't actually need to be rebuilt, it just needs the readline module installed. Feel free to do the rev bump if you think users would rather an unnecessary rebuild than a dependency that isn't automatically installed unless they upgrade a non-outdated port.

comment:7 in reply to:  6 Changed 13 years ago by michelle.lynn.gill@…

Replying to jmr@…:

Works for me. The ipython ports now depend on py-readline. I didn't rev bump because ipython doesn't actually need to be rebuilt, it just needs the readline module installed. Feel free to do the rev bump if you think users would rather an unnecessary rebuild than a dependency that isn't automatically installed unless they upgrade a non-outdated port.

For me this issue does not relate to py27-readline. Rather, ipython seems to be finding another port, libedit, which is causing this error. (I've listed the full error this time):

/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/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)

Installing py27-readline and restarting ipython did not correct this error.

% port installed py27-readline
The following ports are currently installed:
  py27-readline @6.2.1_0 (active)
% port installed python27 | grep active
  python27 @2.7.2_2+universal (active)

Because libedit has a number of ports which depend on it (see below, including python27), I tried force uninstalling it.

--->  Unable to uninstall libedit @20110802-3.0_0+universal, the following ports depend on it:
--->  	pcre @8.12_1
--->  	sqlite3 @3.7.8_1
--->  	sqlite3 @3.7.8_1+universal
--->  	sqlite3 @3.7.9_0+universal
--->  	python26 @2.6.7_2
--->  	python27 @2.7.2_2+universal

After uninstalling libedit (and without readline installed), only a warning is generated when ipython is started:

WARNING: Readline services not available or not loaded.
WARNING: The auto-indent feature requires the readline library

This warning is easily fixed by installing the readline library.

Thus, it seems that ipython needs to be patched (or recompiled?) so that it uses readline instead of libedit? The readline dependency should also be added, obviously.

Let me know if there are questions.

comment:8 Changed 13 years ago by michelle.lynn.gill@…

Cc: michelle.lynn.gill@… added

Cc Me!

comment:9 in reply to:  6 ; Changed 13 years ago by oliver.andrich@…

Replying to jmr@…:

Works for me. The ipython ports now depend on py-readline. I didn't rev bump because ipython doesn't actually need to be rebuilt, it just needs the readline module installed. Feel free to do the rev bump if you think users would rather an unnecessary rebuild than a dependency that isn't automatically installed unless they upgrade a non-outdated port.

I can confirm, that this works for me. I did the following

port uninstall py27-ipython port selfupdate port install py27-ipython -scientific

Along with py27-ipython py27-readline was installed. Afterwards everything works again.

comment:10 in reply to:  9 Changed 13 years ago by michelle.lynn.gill@…

Replying to oliver.andrich@…:

Replying to jmr@…:

Works for me. The ipython ports now depend on py-readline. I didn't rev bump because ipython doesn't actually need to be rebuilt, it just needs the readline module installed. Feel free to do the rev bump if you think users would rather an unnecessary rebuild than a dependency that isn't automatically installed unless they upgrade a non-outdated port.

I can confirm, that this works for me. I did the following

port uninstall py27-ipython port selfupdate port install py27-ipython -scientific

Along with py27-ipython py27-readline was installed. Afterwards everything works again.

This DID NOT work for me and I just repeated your steps exactly as written. I still get the following error upon starting ipython after uninstalling and reinstalling:

/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/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)

I DO have readline installed, and it was installed at the time that I rebuilt ipython.

% port installed py27-readline
The following ports are currently installed:
  py27-readline @6.2.1_0 (active)

As I said above, I suspect the issue is that ipython is finding libedit first and using that instead of readline. I suspect that those not getting this error don't have libedit installed.

comment:11 Changed 13 years ago by nerdling (Jeremy Lavergne)

Cc: snc@… added

When you reinstalled, did it build from source or use a prebuilt archive?

comment:12 in reply to:  11 Changed 13 years ago by michelle.lynn.gill@…

Replying to snc@…:

When you reinstalled, did it build from source or use a prebuilt archive?

My MacPorts installation is not in /opt/local, so it should build from source each time, correct?

Regardless, I just tried uninstalling, cleaning, and then reinstalling py27-ipython with the "-s" flag to force a source install. I still encounter the same issue described above when python27 @2.7.2_2+universal is active (during the ipython build and when ipython is launched). When I switch to python27 @2.7.2_1+universal, ipython is fine.

For some reason, ipython with readline is not happy using a python compiled against libedit, at least on my machine.

Any other suggestions are welcome.

comment:13 Changed 13 years ago by jmroot (Joshua Root)

It shouldn't make a difference anyway. The warning message doesn't advise to reinstall ipython, but to 'easy_install readline'. Installing py-readline should be effectively the same thing as that.

comment:14 Changed 13 years ago by jmroot (Joshua Root)

Cc: jwa@… mcalhoun@… added
Owner: changed from jwa@… to akitada@…
Port: py-ipython added

comment:15 Changed 13 years ago by thimo@…

Cc: thimo@… added

Cc Me!

comment:16 in reply to:  13 Changed 13 years ago by michelle.lynn.gill@…

Replying to jmr@…:

It shouldn't make a difference anyway. The warning message doesn't advise to reinstall ipython, but to 'easy_install readline'. Installing py-readline should be effectively the same thing as that.

Happy to report that I have finally figured out the problem, which persists for me with python 2.7.2_3 and with py27-ipython 0.11_1. Even though py27-readline was installed, it's not being found by the python installation. The command 'easy_install readline' does one very important thing which installing via macports does not--it updates the easy-install.pth ($PYTHONHOME/lib/python2.7/site-packages/easy-install.pth) with the path to readline (./readline). When this change is made either by easy_install or manually, everything works fine.

So, it seems the installation of py-readline should either be adjusted to add ./readline to easy-install.pth or altered so that readline doesn't require help from easy-install.pth for it to be found by python.

Either way, installing py-readline via macports is NOT the same as installing readline via easy_install for this reason.

comment:17 Changed 13 years ago by jmroot (Joshua Root)

The py-readline subports do install readline.pth which imports readline_path.py which takes care of modifying sys.path such that the new readline module is found before the built-in one.

comment:18 Changed 13 years ago by michelle.lynn.gill@…

My apologies for reviving an old thread, but I figured out the problem in the event that others report a similar issue...

The file readline.pth imports "readline_path" which, in turn, loads readline only if the directory "/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload" is found in sys.path.

Unfortunately, I had the variable $PYTHONHOME set to "/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/Current", thus my analogous sys.path entry is "/Volumes/Files/macports/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/lib-dynload". These two strings never match and, thus, readline was never being loaded for me.

It's not an issue for me to change my PYTHONHOME variable, but maybe there's a more robust change that should be made to the readline-associated files? Regardless, hopefully this will help in the future if the problem arises again. Thanks!!

comment:19 Changed 11 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: newclosed

This has long since been fixed.

Note: See TracTickets for help on using tickets.