-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for "python -c 'import nest'" readline issues with Anaconda Python #209
Conversation
Does the pynest code assume that readline gets imported? If not, we shouldn't create a forced dependency on readline. Why not use python -c 'import readline, nest'? |
It should perhaps depend on whether you use --with-readline during 2016-01-19 20:45 GMT+09:00 Alexander Peyser [email protected]:
Jan Morén |
@JanneM : right. configure.ac currently has a --with/out-readline option, and on bgq it disables readline entirely. Doing a sed over an import file would seem overkill, as well as having a 'import nest_with_readline' option. There's /GNUreadline in systemdict, but that's available after the pynestkernel is imported, and anything more is overkill. @espenhgn : so I go back to asking, why not just do 'import readline, nest' manually for the Anaconda Python case? Or using your own anaconda-python script that does that? side note: Anaconda Python -- what an awful, awful name. Why name something intentionally ambiguously? |
@apeyser I don't think the average Nest user would quickly understand that importing readline before nest would fix that ImportError. Note that import nest in a py-script started from the command line crashes similarly, and why should people have to adapt their codes to run with a particular python environment? It's not like the init.py file do not already contain several workarounds for other issues already. Another less neat alternative could be to put the pynestkernel import within a try-except ImportError statement. |
@espenhgn Does this issue appear only with Anaconda Python? Do we know what's going on here? |
@apeyser Tested only with anaconda so far, could occur with e.g., Enthought. @tammoippen tried figuring out what libreadline is used when, but the conclusion was not clear to me. Traceback:
|
@espenhgn Anaconda seems to be a "bad thing". Who is using this kludge and for what? What does this add over pip and virtualenv's? |
@apeyser I'm not gonna survey who's using anaconda on their own machines, but at least in our lab everyone using Python on the Blaustein cluster is. This import issue do not occur there though. The main advantage I guess is that users won't have to deal with all dependencies e.g., for pip-installing scipy etc. |
@apeyser The main advantage of Anaconda is that it provides pre-built binaries for many Python packages. This saves a lot of time, compared to pip, when installing large packages such as Numpy, Scipy, Matplotlib. It is also a huge gain on OS X and Windows, where compiling such packages is sometimes tricky. (This advantage may disappear if/when Python wheels take off). |
Thanks for the info. So the problem here is essentially that people are putting pre-built binaries from one set-up on to their local distribution and there will be inevitable clashes in the dynamic libraries. So the solutions are:
|
I think the final solution to this, is that this is a problem of improper linking using anaconda. The build is picking up a different environment than the run. If I'm missing something, please let me know. Otherwise, I'll close the issue until someone fulfills request #210, which imho is the correct solution. |
…and sys.version, respectively
@tammoippen suggested to import readline only if 'linux' in sys.platform and 'Anaconda' in sys.version. |
Much less ugly... I wonder whether there should be a Makefile 'platform hacks' module created that gets loaded here... but I wonder, if NEST in Anaconda is so popular, why hasn't there been a volunteer to make a linux anaconda recipe? |
I think Anaconda is more popular with OS X and Windows users; it is not needed so much on Linux distros as they have fully-integrated package managers, and most open source tools are developed primarily for Linux and so build more reliably. |
During the NEST Core meeting on 15th of February 2016, we decided to merge this as we can't expect Anaconda to fix the problem in a general way and a Anaconda recipe for NEST is not in sight. |
fix for "python -c 'import nest'" readline issues with Anaconda Python
importing nest with Anaconda Python may be broken for some due to some mismatch between the system and Anaconda-provided readline library files, such that importing nest in a running python interpreter would work, while "python -c 'import nest'" would not. Importing readline before pynestkernel takes care of that.