Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

No module named 'readline' when starting "python"

Joachim_W_
Beginner
7,395 Views

I see 3 other forum posts about problems with readline but with different symptoms. I installed l_python35_pu_2017.0.035 using install_GUI.sh and the "install as current user" option. After sourcing ".../bin/activate" and starting "python" on the command line, I get the following error message:

$ python                                                                                                                                                                                  
Python 3.5.2 |Intel Corporation| (default, Oct 20 2016, 03:10:33)                                                                                                                                              
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux                                                                                                                                                               
Type "help", "copyright", "credits" or "license" for more information.                                                                                                                                         
Intel(R) Distribution for Python is brought to you by Intel Corporation.                                                                                                                                       
Please check out: https://software.intel.com/en-us/python-distribution                                                                                                                                         
Traceback (most recent call last):                                                                                                                                                                             
  File "/etc/pythonstart", line 7, in <module>                                                                                                                                                                 
    import readline                                                                                                                                                                                            
ImportError: No module named 'readline'                                                                                                                                                                        
>>>            

(Also note that the local python system under $HOME/intel/... should not run /etc/pythonstart but provide its own start-up script under $HOME/intel/.../etc/. My /etc/pythonstart is for a system-wide Python 2 installation. (I also have a system-wide Python 3 installation. It uses /etc/python3start. It differs in what name is used for the history file and whether or not exceptions occurring when writing the history are ignored. Therefore, I don't think the version of pythonstart is the reason for the readline problem. The /etc issue is a separate problem. The readline module clearly should be available in any Python installation.)

I tied "conda update conda" from the sticky "Known Issues" and, inspired by https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/623391, tried installing libreadline version 5 in addition to version 6 but this did not change the above message.

$ ls -l /lib64/libreadline* /usr/lib*/libreadline*
lrwxrwxrwx 1 root root     18 Nov 25 11:49 /lib64/libreadline.so.5 -> libreadline.so.5.2                                                                                                                       
-rwxr-xr-x 1 root root 267624 Oct  7 16:52 /lib64/libreadline.so.5.2                                                                                                                                           
lrwxrwxrwx 1 root root     18 Nov 24 19:06 /lib64/libreadline.so.6 -> libreadline.so.6.3                                                                                                                       
-rwxr-xr-x 1 root root 301032 Oct 18 12:55 /lib64/libreadline.so.6.3                                                                                                                                           
lrwxrwxrwx 1 root root     25 Nov 24 19:40 /usr/lib64/libreadline.so -> /lib64/libreadline.so.6.3  

This is on OpenSUSE Leap 42.2 (fresh install in a new VM).

Hope you find this report useful.

Best,

JJ

0 Kudos
4 Replies
Robert_C_Intel
Employee
7,395 Views

Hi JJ,

Intel Python does not include readline because it is uses GPL code, and the license is not compatible with the MKL library. We have found a way to provide a readline without GPL and are working on providing it in a future release. For a workaround, you can use the anaconda python but still use the rest of Intel's packages:

conda remove --force python
conda install -c anaconda python

Intel python does not explicitly read /etc/pythonstart. It will load the file pointed to by the PYTHONSTARTUP environment variable. I booted a fresh opensuse VM and see that PYTHONSTARTUP points to /etc/pythonstart. Anaconda python has the same behavior so I don't think we can change it without breaking behavior for others.

Sorry for the delay in responding, it was Thanksgiving holiday in US.

Robert

0 Kudos
Koltsakis__Efthymios
7,395 Views

Well I tried the suggestion above but it proved catastrophic

(root) mimis@goldberg:~/learning/INTEL/Intel_Python_2.7$ conda remove --force python      
Fetching package metadata .............

Package plan for package removal in environment /opt/intel/intelpython2:

The following packages will be REMOVED:

   python: 2.7.14-intel_2 intel [intel]

Proceed (/n)? y

(root) mimis@goldberg:~/learning/INTEL/Intel_Python_2.7$ conda install -c anaconda python
bash: /opt/intel/intelpython2/bin/conda: /opt/intel/intelpython2/bin/python: bad interpreter: No such file or directory


now I need to reinstall intel python

Mimis

0 Kudos
Koltsakis__Efthymios
7,395 Views

This does not work in my case:

mimis@goldberg:~/learning/INTEL/Intel_Python_2.7$ conda remove --force python
Fetching package metadata .............

Package plan for package removal in environment /opt/intel/intelpython2:

The following packages will be REMOVED:

   python: 2.7.14-intel_2 intel [intel]

Proceed (/n)? y

mimis@goldberg:~/learning/INTEL/Intel_Python_2.7$ conda install -c anaconda python
bash: /home/opt-relief/intel/intelpython2/bin/conda: /opt/intel/intelpython2/bin/python: bad interpreter: No such file or directory


Mimis

0 Kudos
Yuan__Zhihao
Beginner
7,395 Views
pip install gnureadline  # this is a statically linked version for python

But TBO, if you want a better interactive Python shell, just go look up ptpython.

0 Kudos
Reply