PyOxidizer icon indicating copy to clipboard operation
PyOxidizer copied to clipboard

Cannot import readline in the macos distribution

Open mssun opened this issue 3 years ago • 6 comments
trafficstars

Cannot import the readline module in the macos distribution.

$ pyoxidizer init-config-file pyapp
$ cd pyapp
$ pyoxidizer run
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'

mssun avatar Mar 14 '22 21:03 mssun

On Mon, Mar 14, 2022 at 02:08:04PM -0700, Mingshen Sun wrote:

Cannot import the readline module in the macos distribution.

Seeing 'MacOS' did made think of #524 I hope this helps. Thing I'm trying to say: "there was MacOS change the last 24 hours"

stappersg avatar Mar 14 '22 21:03 stappersg

Thanks @stappersg. I'm not sure if #525 is related to this issue.

mssun avatar Mar 14 '22 22:03 mssun

I found that "curses and readline have linking issues" here:

https://github.com/indygreg/PyOxidizer/blob/main/pyoxidizer/src/py_packaging/standalone_distribution.rs#L77

Thanks!

mssun avatar Mar 14 '22 22:03 mssun

Even though the readline extension module is disabled, I don't think it should be. I want to say that readline is fixed in a modern version of the Python distributions and this hack can be deleted. But I'm not 100% sure about that. Either way, we should have this issue to track a working readline on macOS.

indygreg avatar Mar 15 '22 01:03 indygreg

Probably of interest here:

https://stackoverflow.com/a/29572581

On OSX, if you are using the built-in Python shipped by Apple, you will be missing a proper readline implementation as Apple ships instead a library called libedit that provides only some of readline’s functionality. While you may find libedit sufficient, we have occasional reports of bugs with it and several developers who use OS X as their main environment consider libedit unacceptable for productive, regular use with IPython.

christian-krieg avatar Jul 31 '22 22:07 christian-krieg

Anecdotal, but I was able to remove readline from the list of broken macOS extensions for my build over cpython-3.9.16+20230116 and things appeared to be working.

@indygreg Is this as trivial to remove in reality as it was for me just now? All I did was remove the line from the vec in the path linked above, with pyoxidizer/0.24.0 checked out. If it really is that simple, I would be willing to put up a patch.

aaronsky avatar Mar 24 '23 18:03 aaronsky