I was having trouble installing a package (plumed) using pip3.6. Specifically, with the command pip3.6 install --user plumed, I got the following error:
Collecting plumed
Using cached plumed-2.6.1.tar.gz (189 kB)
Building wheels for collected packages: plumed
Building wheel for plumed (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-js3bt49u
cwd: /tmp/pip-install-cnvim96k/plumed/
Complete output (17 lines):
Module name plumed
Version number 2.6.1
using available plumed.cpp file
running bdist_wheel
running build
running build_ext
building 'plumed' extension
creating build
creating build/temp.linux-x86_64-3.6
/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC -I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
In file included from /usr/include/python3.6m/Python.h:8:0,
from plumed.cpp:31:
/usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
# include <x86_64-linux-gnu/python3.6m/pyconfig.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for plumed
Running setup.py clean for plumed
Failed to build plumed
Installing collected packages: plumed
Running setup.py install for plumed ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/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-record-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed
cwd: /tmp/pip-install-cnvim96k/plumed/
Complete output (17 lines):
Module name plumed
Version number 2.6.1
using available plumed.cpp file
running install
running build
running build_ext
building 'plumed' extension
creating build
creating build/temp.linux-x86_64-3.6
/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC
-I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
In file included from /usr/include/python3.6m/Python.h:8:0,
from plumed.cpp:31:
/usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
# include <x86_64-linux-gnu/python3.6m/pyconfig.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/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-record-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed Check the logs for full command output.
I know that there are already a lot of relevant discussions on the forum, but none of the solutions worked for me. I've tried the following solutions:
sudo apt-get install python-dev libxml2-dev libxslt-dev
sudo apt-get install python3.6-dev
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h
The weird thing is that I had pyconfig.h in /usr/include/x86_64-linux-gnu/python3.6m/ but it couldn't be found when I used pip3.6. I was using Ubuntu 18.04, so the systematic pip was associated with Python 3.6.9. I'm wondering if there is any solution that could deal with this problem. Thanks!
For me it turned out an old package wasn't fully installed somewhere. If you get apt-get -f install anywhere in your error messages, just run that, it'll re-install your packages. Not 100% certain it'll work for everyone, but that was my specific problem with this.
Related
I am trying to install pyodbc in a virtual environment. The following command line commands shows the steps:
>python3.9 -m venv .venv
>source .venv/bin/activate
>pip install pyodbc
and then I get the following error:
Collecting pyodbc
Using cached pyodbc-4.0.32.tar.gz (280 kB)
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ebp/Documents/studies/docker_test/.venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k9moe3om/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k9moe3om/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-0qe855ng
cwd: /tmp/pip-install-k9moe3om/pyodbc/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for pyodbc
Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: /home/ebp/Documents/studies/docker_test/.venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k9moe3om/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k9moe3om/pyodbc/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-record-kb5_zw4a/install-record.txt --single-version-externally-managed --compile --install-headers /home/ebp/Documents/studies/docker_test/.venv/include/site/python3.9/pyodbc
cwd: /tmp/pip-install-k9moe3om/pyodbc/
Complete output (14 lines):
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.32 -I/home/ebp/Documents/studies/docker_test/.venv/include -I/usr/include/python3.9 -c src/buffer.cpp -o build/temp.linux-x86_64-3.9/src/buffer.o -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/local/include
In file included from src/buffer.cpp:12:
src/pyodbc.h:45:10: fatal error: Python.h: No such file or directory
45 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ebp/Documents/studies/docker_test/.venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k9moe3om/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k9moe3om/pyodbc/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-record-kb5_zw4a/install-record.txt --single-version-externally-managed --compile --install-headers /home/ebp/Documents/studies/docker_test/.venv/include/site/python3.9/pyodbc Check the logs for full command output.
I am using wsl ubuntu. In my wsl system I have already installed pyodbc with success, but in virtual environment it can't be done. What am I doing wrong?
I solved the problem by installing python3.9-dev on linux:
> sudo apt-get install python3.9-dev
root#kali:/home/kali/Desktop# pip install NetfilterQueue
Collecting NetfilterQueue
Using cached NetfilterQueue-0.8.1.tar.gz (58 kB)
Building wheels for collected packages: NetfilterQueue
Building wheel for NetfilterQueue (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-v0vd42ah
cwd: /tmp/pip-install-6ltnc7gf/netfilterqueue/
Complete output (13 lines):
running bdist_wheel
running build
running build_ext
skipping 'netfilterqueue.c' Cython extension (up-to-date)
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.8
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c netfilterqueue.c -o build/temp.linux-x86_64-3.8/netfilterqueue.o
netfilterqueue.c:437:10: fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
437 | #include "libnfnetlink/linux_nfnetlink.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for NetfilterQueue
Running setup.py clean for NetfilterQueue
Failed to build NetfilterQueue
DEPRECATION: Could not build wheels for NetfilterQueue which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: NetfilterQueue
Running setup.py install for NetfilterQueue ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/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-record-qodwn5k_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/NetfilterQueue
cwd: /tmp/pip-install-6ltnc7gf/netfilterqueue/
Complete output (13 lines):
running install
running build
running build_ext
skipping 'netfilterqueue.c' Cython extension (up-to-date)
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.8
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c netfilterqueue.c -o build/temp.linux-x86_64-3.8/netfilterqueue.o
netfilterqueue.c:437:10: fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
437 | #include "libnfnetlink/linux_nfnetlink.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/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-record-qodwn5k_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/NetfilterQueue Check the logs for full command output.
I tried apt-get install build-essential python3-dev libnetfilter-queue-dev
but then i get
root#kali:/home/kali/Desktop# apt-get install build-essential python3-dev libnetfilter-queue-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libnetfilter-queue-dev
i'm trying to install netfilterqueue library for python3 but i cant install netfilter queue, any help? ive tried installing livnetfilter queue but it also doesn't work, ive searched online and i couldn't find anything. whats the problem
After researching a lot in this area, I find that scapy does not work well in python-python2 and netfilterqueue does not work well in python3, without downgrading the language I can achieve this, I recommend you to correct any additional error, execute << dpkg - configure -a >> and then << apt-get update >>, because this version is unattended and can generate broken packages in your repository list
apt install python3-pip git libnfnetlink-dev libnetfilter-queue-dev
pip3 install -U git+https://github.com/kti/python-netfilterqueue
hello first install netfilterqueue on your linux machine
sudo apt install libnfnetlink-dev libnetfilter-queue-dev
then you should know netfilterqueue for python3+ is named nfqp3 so install it with
pip3 install nfqp3
it is worth mentioning that when importing it in a python script you should import it as netfilterqueue not nfqp3
To install from source:
$ git clone git#github.com:kti/python-netfilterqueue.git
cd python-netfilterqueue
python setup.py install
pip install https://github.com/johnteslade/python-netfilterqueue/archive/refs/heads/update-cython-code.zip
it will work by this command 100%
This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 2 years ago.
I am trying to upgrade pycairo package but getting following error:
$ python3 -m pip install -U pycairo
Defaulting to user installation because normal site-packages is not writeable
Collecting pycairo
Using cached pycairo-1.19.1.tar.gz (205 kB)
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ho1du2qw/pycairo/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-record-21711no1/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/abcde/.local/include/python3.7m/pycairo
cwd: /tmp/pip-install-ho1du2qw/pycairo/
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.7/cairo
running build_ext
building 'cairo._cairo' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cairo
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=19 -DPYCAIRO_VERSION_MICRO=1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/python3.7m -c cairo/device.c -o build/temp.linux-x86_64-3.7/cairo/device.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
cairo/device.c:30:10: 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
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ho1du2qw/pycairo/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-record-21711no1/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/abcde/.local/include/python3.7m/pycairo Check the logs for full command output.
Where is the problem?
File Python.h means you have to install python-dev with C/C++ headers .h because it has to compile some C/C++ code.
On Linux Mint/Ubuntu/Debian it could be one of this command
apt install python-dev
apt install python3-dev
apt install python3.7-dev
When trying to install Marine-traffic-api im getting an error:
Installing collected packages: ujson, Marine-Traffic-API
Running setup.py install for ujson: started
Running setup.py install for ujson: finished with status 'error'
Complete output from command /home/benjamin/PycharmProjects/ShipTracking/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pycharm-packaging/ujson/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-record-ys30b_z8/install-record.txt --single-version-externally-managed --compile --install-headers /home/benjamin/PycharmProjects/ShipTracking/venv/include/site/python3.7/ujson:
Warning: 'classifiers' should be a list, got type 'filter'
running install
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/python
creating build/temp.linux-x86_64-3.7/lib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/home/benjamin/PycharmProjects/ShipTracking/venv/include -I/usr/include/python3.7m -c ./python/ujson.c -o build/temp.linux-x86_64-3.7/./python/ujson.o -D_GNU_SOURCE
In file included from ./python/ujson.c:39:0:
./python/py_defines.h:39:10: 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
Install the needed packages:
sudo apt-get install build-essential python3 python-dev python3-dev
After that, run:
pip install --no-cache-dir ujson
Currently trying to run pip install python-lzo in any environment fails for me (I have tried on three different machines: ubuntu 16.04, macosx and inside a docker container based on python:2.7):
Collecting python-lzo
Downloading python-lzo-1.11.tar.gz
Building wheels for collected packages: python-lzo
Running setup.py bdist_wheel for python-lzo ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/tmp4XTk5Ipip-wheel- --python-tag cp27:
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
warnings.warn(msg)
running bdist_wheel
running build
running build_ext
building 'lzo' extension
creating build
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/lzo -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lzomodule.c -o build/temp.macosx-10.11-x86_64-2.7/lzomodule.o
lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
#include <lzo1x.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for python-lzo
Running setup.py clean for python-lzo
Failed to build python-lzo
Installing collected packages: python-lzo
Running setup.py install for python-lzo ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-iXLv5I-record/install-record.txt --single-version-externally-managed --compile:
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
warnings.warn(msg)
running install
running build
running build_ext
building 'lzo' extension
creating build
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/lzo -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lzomodule.c -o build/temp.macosx-10.11-x86_64-2.7/lzomodule.o
lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
#include <lzo1x.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-iXLv5I-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/
Really I am trying to build a docker container that runs this:
RUN pip install python-lzo
Any thoughts here? Thanks!
You must install liblzo2-dev in debian base image and install lzo-devel in centos base image.
Fixed this with the following Dockerfile:
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y python python-pip python-lzo zlib1g-dev unzip
RUN pip install bx-python
So apparently you can install python-lzo directly through apt instead of using pip? sigh