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
Related
hello guys i tried to install a python module called gmpy2 with pip install gmpy2 but error occurs during wheel building
running install
running build
running build_ext
building 'gmpy2' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -g -fdebug-prefix-map=/build/python3.6-LpWKty/python3.6-
3.6.5~rc1=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-
protector-strong -Wformat -Werror=format-security -Wdate-time -
D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -
I/usr/include/python3.6m -c src/gmpy2.c -o build/temp.linux-x86_64-
3.6/src/gmpy2.o
In file included from src/gmpy2.c:426:0:
src/gmpy.h:252:12: fatal error: mpfr.h: No such file or directory
# include "mpfr.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-
onv0x975/gmpy2/setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --
record /tmp/pip-izolloyr-record/install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in /tmp/pip-
build-onv0x975/gmpy2/
I tried both pip and pip3
You need to download MPFR source code and compile it. See installation manual: https://gmpy2.readthedocs.io/en/latest/intro.html#installation
system info :
Ubuntu 14.10
Linux vagrant-ubuntu-trusty 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
I first install virtualenv in ubuntu
sudo pip install virtualenv
virtualenv scrapy-env
cd scrapy-env/
source bin/activate
pip install scrapy
then I get this error:
running build_ext
building 'twisted.test.raiser' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/twisted
creating build/temp.linux-x86_64-2.7/src/twisted/test
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-2.7/src/twisted/test/raiser.o
src/twisted/test/raiser.c:4: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 "/vagrant/pyenv/scrapy-env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NJKTtN/Twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_i2ueH-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/pyenv/scrapy-env/include/site/python2.7/Twisted" failed with error code 1 in /tmp/pip-build-NJKTtN/Twisted/
Any suggestions that could help me fix it?
You don't have Python developer package installed. Try installing them
sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs
When I try to install oursql under virtual environment using pip install oursql I get following error:
Collecting oursql
Using cached oursql-0.9.3.1.tar.bz2
Building wheels for collected packages: oursql
Running setup.py bdist_wheel for oursql
Complete output from command /home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpe4k7ejpip-wheel-:
cython not found, using previously-cython'd .c file.
running bdist_wheel
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for oursql
Failed to build oursql
Installing collected packages: oursql
Running setup.py install for oursql
Complete output from command /home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-awH5dT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/raghav/janpro/release_1/venv/include/site/python2.7/oursql:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-awH5dT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/raghav/janpro/release_1/venv/include/site/python2.7/oursql" failed with error code 1 in /tmp/pip-build-ndxBoY/oursql
Then I installed MySQL C++ connectors with sudo apt-get install libmysqlcppconn-dev but still error was coming.
So, I tried sudo pip install oursql and got following output:
The directory '/home/raghav/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/raghav/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting oursql
Downloading oursql-0.9.3.1.tar.bz2 (119kB)
100% |████████████████████████████████| 122kB 986kB/s
Installing collected packages: oursql
Running setup.py install for oursql
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-GbfPiA/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-avSCME-record/install-record.txt --single-version-externally-managed --compile:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-GbfPiA/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-avSCME-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-GbfPiA/oursql
What is going wrong? I am unable to find out.
the directory '/home/raghav/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
I think you installed some library into your virtualenv using sudo pip. So now some files are owned by the root user and your user cannot write there. You never should use virtualenv as root.
If you have a requirements.txt file I think the easiest way is to create a new virtualenv and install everything again. If you don't want/can't do this try to change the permissions with chown
You do not have python development libraries installed. Try installing it first, and then running pip.
sudo apt-get install python2.7-dev
Try this -
$ sudo apt-get install libmysqlclient-dev
$ sudo pip install oursql
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
I am new to python3. I have created the virtual environment. I try to install the pycairo package using pip command. I need install python cairo. Please see the below info
pip install git+http://anongit.freedesktop.org/git/pycairo
Downloading/unpacking git+http://anongit.freedesktop.org/git/pycairo
Cloning http://anongit.freedesktop.org/git/pycairo to /tmp/pip-0c_foz-build
Running setup.py egg_info for package from git+http://anongit.freedesktop.org/git/pycairo
cairo >= 1.10.2 Successful
Installing collected packages: pycairo
Running setup.py install for pycairo
cairo >= 1.10.2 Successful
building 'cairo._cairo' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2:
cairo >= 1.10.2 Successful
creating py3cairo.pc
creating src/config.h
running install
running build
running build_ext
building 'cairo._cairo' extension
creating build
creating build/temp.linux-i686-3.2
creating build/temp.linux-i686-3.2/src
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2 failed with error code 1 in /tmp/pip-0c_foz-build
Storing complete log in /home/nyros/.pip/pip.log
But I got the error. Please solve my problem. Thanks
I think this may solve your problem:
sudo apt-get install python3-dev
But I cannot guarantee that this will work 100% :-)