Ipython no readline available and pip install readline error - python

I installed ipython but it doesn't have the readline option. I first downloaded gnu readline and compiled and installed. DIdn't know whether it was a proper solution but was the first thing I thought of. It still wouldn't work to no avail with the same error as before:
WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library
Then I tried using pip install readline and I get the error below. Any help would be appreciated:
running install
running build
running build_ext
building 'readline' extension
creating build
creating build/temp.linux-x86_64-2.6
creating build/temp.linux-x86_64-2.6/Modules
creating build/temp.linux-x86_64-2.6/Modules/2.x
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/home/jspender/include/python2.6 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.6/Modules/2.x/readline.o -Wno-strict-prototypes
creating build/lib.linux-x86_64-2.6
gcc -pthread -shared build/temp.linux-x86_64-2.6/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -L/home/jspender/lib -lncurses -lpython2.6 -o build/lib.linux-x86_64-2.6/readline.so
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/jspender/bin/python2.6 -c "import setuptools;__file__='/home/jspender/build/readline/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-lBWIOm-record/install-record.txt failed with error code 1
Storing complete log in /home/jspender/.pip/pip.log

tmaric is right. I had the same problem while installing iPython (Ubuntu 12.10, quantal, 32-bit). I was missing the dev version of the ncurses5 library. Try:
sudo apt-get install libncurses5-dev
and then installing the readline module again through pip
pip install readline

You have a linker error: library ncurses is not installed, or it is installed and the linker is searching for the wrong object file.
What platform/operating system are you using?
If you're running Linux/Unix, try:
locate libncurses
to see if the library is installed. If there are no libncurses*.{o,so,so.[0-9].[0-9]} files on your system, just install the library, and the readline. If there are some, then check which one is searched for by the readline compilation process, it could be that you just have to make a symbolic link, naming the library file properly.

I had the same issue with my Ubuntu 14.04 install trying to get some python libraries installed. iPython I believe requires readline which was failing for me until I ran the following commands.
sudo apt-get install python-dev
sudo apt-get install libncurses5-dev
sudo pip install readline

Related

Unable to execute 'gcc-8': No such file or directory error: command 'gcc-8' failed with exit status 1. PySIT package installation

I am trying to install a package called PySIT to be run with Python, and have followed the instructions on this install page (https://pysit.readthedocs.io/en/latest/install.html) using pip on my terminal to install PySIT.
I am using macOS Catalina for this, and have Anaconda installed on my computer.
This is the output I get on my terminal when I run the command: python setup.py install
gcc-8 -fno-strict-aliasing -I/Users/KBrindha/anaconda2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/KBrindha/anaconda2/lib/python2.7/site-packages/numpy/core/include -Ipysit/solvers/fd_tools -I/Users/KBrindha/anaconda2/include/python2.7 -c pysit/solvers/constant_density_acoustic/time/scalar/solvers_wrap.cxx -o build/temp.macosx-10.6-x86_64-2.7/pysit/solvers/constant_density_acoustic/time/scalar/solvers_wrap.o -O3 -fopenmp -ffast-math
unable to execute 'gcc-8': No such file or directory
error: command 'gcc-8' failed with exit status 1
Any help on how to bypass this issue or install gcc-8 would be appreciated.
For further information, I have Xcode and Xcode Command Line Tools installed in my computer.
I also have "just" gcc (not gcc-8) installed at /usr/bin/gcc.
The authors inserted fixed names for compilers right into their setup.py. This is a bug and I recommend to report it.
Meanwhile you can clone the repository or download source code, extract it, edit setup.py and remove or replace these fixed names. Then build with the command pip install .

Can't install module python pip

i'm new to python. I'd like to use pysnmp module, so i tried to install it with pip but i'm getting errors from it :
Failed building wheel for pycrypto
I tried on multiple system (Ubuntu, Debian and RH) and I always get the same error. How can i install pysnmp ? Or are there any other alternative to work with snmp with python ?
Shell Command :
sudo -H pip install pysnmp
Result :
...
configure: creating ./config.status
config.status: creating src/config.h
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastm ath.
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
x86_64-linux-gnu-gcc -pthread -fwrapv -Wall -Wstrict-prototypes -fstack-prot ector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOUR CE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.4m -c src/MD2.c -o build/temp.linux-x86_64-3.4/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip- build-7gwchpkq/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(_ _file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp /pip-6mlabkyq-record/install-record.txt --single-version-externally-managed --co mpile" failed with error code 1 in /tmp/pip-build-7gwchpkq/pycrypto/
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
The actual error is that you do not have the dev files for python language (python.h not found).
So, install python-dev:
sudo apt-get install python-dev
Try:
sudo pip install setuptools --upgrade
Try,
wget https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py
easy_install pysnmp

#include <zbar.h> 1 error generated when running pip install zbar

I'm trying to run pip install zbar and for some reason I can't seem to find an answer to solve this dependency issue. Any help would be extremely appreciated. See traceback below:
Downloading/unpacking zbar
Downloading zbar-0.10.tar.bz2
Running setup.py
egg_info for package zbar
Installing collected packages: zbar
Running setup.py install for zbar
building 'zbar' extension
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.9-x86_64-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
#include <zbar.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build/temp.macosx-10.9-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.9-x86_64-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
include <zbar.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
In my case I was running Ubuntu and had to install libzbar-dev package:
sudo apt-get install libzbar-dev
$ brew install zbar
and after that
$ pip install zbar
The header files will then be found (zbar.h)
Encountered this problem again after 2 years... this is what worked for me
LDFLAGS=-L/usr/local/lib/ CPATH=/usr/local/include/ pip install zbar
In case others run into this issue aren't able to use pip to install zbar for python:
Install zbar: brew install zbar
Install PIL: brew install pillow
Download zbar source: https://pypi.python.org/pypi/zbar
Unzip zbar: tar -xjvf zbar-0.10.tar.bz2
Install: python setup.py install --user
I encountered this issue recently while attempting to launch a service locally from Mac OS in a virtual environment, that imports zbar in the python application. The service was still running python2.7.
Having the service running in a virtual environment I was unwilling to attempt anything that required global system changes.
I solved it by having to install zbar through Homebrew (globally). Then exporting flags or implicit rules used in the C compiling "recipe" to the virtual environment. Finally I installed a similar library to the zbar dependancy in the virtual environment.
$ brew install zbar
Then when sourced in the virtual environment I do the following to change the implicit rules in the c compilation recipe:
$ export LDFLAGS="-L$(brew --prefix zbar)/lib"
$ export CFLAGS="-I$(brew --prefix zbar)/include"
Finally I install a light version of zbar inside the venv:
$ pip install zbarlight
After the above, with the additional dependancy of pyzbar below included in my requirements.txt I am able to import zbar with python2.7 in the virtual environment.
pyzbar==0.1.7
Testing the import in the virtual environment:
$ python
>>> import zbar
>>>
Hope this helps someone in the future. I struggled quite a bit in getting this to work and resources regarding zbar are fairly scarce.

gevent/libevent.h:9:19: fatal error: event.h: No such file or directory

I was trying to work on Pyladies website on my local folder. I cloned the repo, (https://github.com/pyladies/pyladies) ! and created the virtual environment. However when I do the pip install -r requirements, I am getting this error
Installing collected packages: gevent, greenlet
Running setup.py install for gevent
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/opt/local/include -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-i686-2.7/gevent/core.o
In file included from gevent/core.c:253:0:
gevent/libevent.h:9:19: fatal error: event.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/akoppad/virt/pyladies/bin/python -c "import setuptools;__file__='/home/akoppad/virt/pyladies/build/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-4MSIGy-record/install-record.txt --install-headers /home/akoppad/virt/pyladies/include/site/python2.7:
running install
running build
running build_py
running build_ext
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/opt/local/include -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-i686-2.7/gevent/core.o
In file included from gevent/core.c:253:0:
gevent/libevent.h:9:19: fatal error: event.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/akoppad/virt/pyladies/bin/python -c "import setuptools;__file__='/home/akoppad/virt/pyladies/build/gevent/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-4MSIGy-record/install-record.txt --install-headers /home/akoppad/virt/pyladies/include/site/python2.7 failed with error code 1 in /home/akoppad/virt/pyladies/build/gevent
Storing complete log in /home/akoppad/.pip/pip.log.
I tried doing this,
sudo port install libevent
CFLAGS="-I /opt/local/include -L /opt/local/lib" pip install gevent
It says port command not found.
I am not sure how to proceed with this. Thanks!
I had the same problem and just as the other answer suggested I had to install "libevent". It's apparently not called "libevent-devel" anymore (apt-get couldn't find it) but doing:
$ apt-cache search libevent
listed a bunch of available packages.
$ apt-get install libevent-dev
worked for me.
I think you just forget to install the "libevent" in the environment. If you are on a OSX machine, please try to install brew here http://mxcl.github.io/homebrew/ and use brew install libevent to install the dependency. If you are on an ubuntu machine, you can try apt-get to install the corresponding library.
I had this issue while trying to
pip install Flask-Sockets
and
sudo apt-get install libevent-dev
worked for me
yum install libevent-*
This command works for me because I am on centos.
I ran into this error on MacOS 10.10.1 (Yosemite) running pip install. The solution for me was to add the path to libevent which pip was missing. These are C files, and CFLAGS and DFLAGS are bash environment variables that let pip know where to find these files. On my system, libevent is found at /usr/local/include/event2.
$ CFLAGS=-I/usr/local/include/event2 DFLAGS=-L/usr/local/lib pip install -r requires.txt

How to install SSL for python 2.5 on Debian Linux?

Question
How do I install SSL for Python 2.5 on Debian?
I have tried:
sudo easy_install ssl
But getting:
$ python setup.py build
looking for /usr/include/openssl/ssl.h
looking for /usr/include/krb5.h
running build
running build_py
running build_ext
building 'ssl._ssl2' extension
creating build/temp.linux-i686-2.5
creating build/temp.linux-i686-2.5/ssl
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./ssl/2.5.1 -I/usr/include/python2.5 -c ssl/_ssl2.c -o build/temp.linux-i686-2.5/ssl/_ssl2.o
In file included from ssl/_ssl2.c:75:
./ssl/2.5.1/socketmodule.h:45:33: error: bluetooth/bluetooth.h: No such file or directory
./ssl/2.5.1/socketmodule.h:46:30: error: bluetooth/rfcomm.h: No such file or directory
./ssl/2.5.1/socketmodule.h:47:29: error: bluetooth/l2cap.h: No such file or directory
./ssl/2.5.1/socketmodule.h:48:27: error: bluetooth/sco.h: No such file or directory
In file included from ssl/_ssl2.c:75:
./ssl/2.5.1/socketmodule.h:98: error: field ‘bt_l2’ has incomplete type
./ssl/2.5.1/socketmodule.h:99: error: field ‘bt_rc’ has incomplete type
./ssl/2.5.1/socketmodule.h:100: error: field ‘bt_sco’ has incomplete type
error: command 'gcc' failed with exit status 1
Solution
sudo apt-get install libbluetooth-dev
sudo rm /usr/lib/python2.5/site-packages/ssl/__init__.pyc
For reference, you must install libbluetooth-dev.
In fact, you shouldn't compile your own version of python ssl module for several reasons:
you won't get automatic security updates of your python ssl module;
you won't get smooth upgrade path if you decide to upgrade Debian system on your server.
The best way to obtain python ssl module is to install it from official Debian repositories using apt-get:
apt-get install python-openssl
Hope this helps.

Categories