installing regex on python 2.7 fails with exit status 1 [duplicate] - python

This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 1 year ago.
I want to use the PyTLDR. Someone in the issue section on GitHub stated that the module was written in Python 2. Therefore, I set up a Python 2.7 environment for this project.
My pip version is 20.3 which should still work for Python 2 modules.
While installing the PyTLDR module via pip install pytldr I got the following error message:
[33mDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.[0m
Processing /home/zyko/.cache/pip/wheels/ba/d8/92/30e242ea7de520ed1eaf44ba37f7e73a2ac1e6b4e305b99e74/PyTLDR-0.1.4-py2-none-any.whl
Processing /home/zyko/.cache/pip/wheels/c7/b1/76/54236c34227a12d32dc9cfe18731976baf8950d8a5aabaea6c/nltk-3.5-py2-none-any.whl
Collecting numpy>=1.8.0
Using cached numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0 MB)
Collecting scipy>=0.13.2
Using cached scipy-1.2.3-cp27-cp27mu-manylinux1_x86_64.whl (24.8 MB)
Processing /home/zyko/.cache/pip/wheels/df/80/48/106e63760ff0dcd3658613d93c1ecf64301b9261172f2c1acf/networkx-2.2-py2.py3-none-any.whl
Processing /home/zyko/.cache/pip/wheels/09/dd/9a/3eff624a1731b5df39e1a946425532b9c1e0330c4e705a629d/goose_extractor-1.0.25-py2-none-any.whl
Collecting scikit-learn>=0.15.2
Using cached scikit_learn-0.20.4-cp27-cp27mu-manylinux1_x86_64.whl (5.5 MB)
Requirement already satisfied: tqdm in ./venv/lib/python2.7/site-packages (from nltk>=3.0.0->pytldr) (4.61.1)
Requirement already satisfied: click in ./venv/lib/python2.7/site-packages (from nltk>=3.0.0->pytldr) (7.1.2)
Requirement already satisfied: joblib in ./venv/lib/python2.7/site-packages (from nltk>=3.0.0->pytldr) (0.14.1)
Collecting regex
Using cached regex-2021.4.4.tar.gz (693 kB)
Requirement already satisfied: decorator>=4.3.0 in ./venv/lib/python2.7/site-packages (from networkx>=1.9.1->pytldr) (4.4.2)
Collecting cssselect
Using cached cssselect-1.1.0-py2.py3-none-any.whl (16 kB)
Processing /home/zyko/.cache/pip/wheels/4b/8e/29/f0d0909969495c5f279c6cba4ceca07db79a0f7bb54f3f087b/jieba-0.42.1-py2-none-any.whl
Collecting beautifulsoup
Using cached BeautifulSoup-3.2.2-py2-none-any.whl (32 kB)
Collecting lxml
Using cached lxml-4.6.3-cp27-cp27mu-manylinux1_x86_64.whl (5.5 MB)
Collecting Pillow
Using cached Pillow-6.2.2-cp27-cp27mu-manylinux1_x86_64.whl (2.1 MB)
Building wheels for collected packages: regex
Building wheel for regex (setup.py) ... [?25l- error
[31m ERROR: Command errored out with exit status 1:
command: /home/zyko/PycharmProjects/PyTLDR/venv/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9Mtbpc/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9Mtbpc/regex/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-URFXXo
cwd: /tmp/pip-install-9Mtbpc/regex/
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/regex
copying regex_2/__init__.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/regex.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/_regex_core.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/test_regex.py -> build/lib.linux-x86_64-2.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/regex_2
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-QDqKfA/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c regex_2/_regex.c -o build/temp.linux-x86_64-2.7/regex_2/_regex.o
regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory
50 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------[0m
[31m ERROR: Failed building wheel for regex[0m
[?25h Running setup.py clean for regex
Failed to build regex
Installing collected packages: regex, nltk, numpy, scipy, networkx, cssselect, jieba, beautifulsoup, lxml, Pillow, goose-extractor, scikit-learn, pytldr
Running setup.py install for regex ... [?25l- error
[31m ERROR: Command errored out with exit status 1:
command: /home/zyko/PycharmProjects/PyTLDR/venv/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9Mtbpc/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9Mtbpc/regex/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-pYEqUQ/install-record.txt --single-version-externally-managed --compile --install-headers /home/zyko/PycharmProjects/PyTLDR/venv/include/site/python2.7/regex
cwd: /tmp/pip-install-9Mtbpc/regex/
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/regex
copying regex_2/__init__.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/regex.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/_regex_core.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/test_regex.py -> build/lib.linux-x86_64-2.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/regex_2
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-QDqKfA/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c regex_2/_regex.c -o build/temp.linux-x86_64-2.7/regex_2/_regex.o
regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory
50 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------[0m
[31mERROR: Command errored out with exit status 1: /home/zyko/PycharmProjects/PyTLDR/venv/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9Mtbpc/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9Mtbpc/regex/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-pYEqUQ/install-record.txt --single-version-externally-managed --compile --install-headers /home/zyko/PycharmProjects/PyTLDR/venv/include/site/python2.7/regex Check the logs for full command output.[0m
[33mWARNING: You are using pip version 20.3; however, version 20.3.4 is available.
You should consider upgrading via the '/home/zyko/PycharmProjects/PyTLDR/venv/bin/python2.7 -m pip install --upgrade pip' command.[0m
[?25h
It looks like the regex module can not be installed. A manual pip install regex throws the same error message.
How can I get regex to work within the old Python 2.7 version and subsequently get the PyTLDR module to work properly?

First thing, read the first line of the output: You should not start new projects in python2.
However, the issue is quite straightforward:
regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory
50 | #include "Python.h"
| ^~~~~~~~~~
This means that you don't have the headers for python dev installed.
Fix is quite straightforward as well (assuming you're running ubuntu or debian:
sudo apt-get install python-dev

Related

Cannot install pyfftw3 by pip

I am trying using FFTW3 in python and when I try to install it I got this:
xxxxxxx#iMac ~ % pip3 install pyfftw3
Collecting pyfftw3
Using cached PyFFTW3-0.2.1.tar.gz (25 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-m021xxq5/pyfftw3_69a9370f7f41441eaca6ae508a6a1544/setup.py'"'"'; __file__='"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-m021xxq5/pyfftw3_69a9370f7f41441eaca6ae508a6a1544/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-pip-egg-info-m06gikf1
cwd: /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-m021xxq5/pyfftw3_69a9370f7f41441eaca6ae508a6a1544/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-m021xxq5/pyfftw3_69a9370f7f41441eaca6ae508a6a1544/setup.py", line 81
print "build %s from template %s" %(outfile, tmplfile)
^
SyntaxError: invalid syntax
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/58/07/e070b9a44429bbd5481f9f0b2d1b35d896fbfd180051e05c840186a31c8a/PyFFTW3-0.2.1.tar.gz#sha256=8941a023e6e4f501e7cec92382c3d3f76f47c7583e9eade738840dd9e4e467c4 (from https://pypi.org/simple/pyfftw3/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pyfftw3
ERROR: No matching distribution found for pyfftw3
I have the newest version of python installed by Homebrew.
Pip is also the newest version.
I have tried pip install -U setuptools
Inspired by 'Swetank Poddar': I found the pyfftw3 is a python2 library, so I tried pip3 install pyfftw. But, I got a new question:
Collecting pyfftw
Downloading pyFFTW-0.12.0.tar.gz (137 kB)
|████████████████████████████████| 137 kB 167 kB/s
Requirement already satisfied: numpy<2.0,>=1.10 in /usr/local/lib/python3.9/site-packages (from pyfftw) (1.19.5)
Building wheels for collected packages: pyfftw
Building wheel for pyfftw (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/setup.py'"'"'; __file__='"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/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 /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-wheel-e51wsh5k
cwd: /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.9
creating build/lib.macosx-10.15-x86_64-3.9/pyfftw
copying pyfftw/config.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw
copying pyfftw/_version.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw
copying pyfftw/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw
creating build/lib.macosx-10.15-x86_64-3.9/pyfftw/builders
copying pyfftw/builders/builders.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/builders
copying pyfftw/builders/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/builders
copying pyfftw/builders/_utils.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/builders
creating build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/cache.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/scipy_fft.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/dask_fft.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/numpy_fft.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/scipy_fftpack.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/_utils.py -> build/lib.macosx-10.15-x86_64-3.9/pyfftw/interfaces
UPDATING build/lib.macosx-10.15-x86_64-3.9/pyfftw/_version.py
set build/lib.macosx-10.15-x86_64-3.9/pyfftw/_version.py to '0.12.0'
running build_ext
error: Could not find any of the FFTW libraries
----------------------------------------
ERROR: Failed building wheel for pyfftw
Running setup.py clean for pyfftw
Failed to build pyfftw
Installing collected packages: pyfftw
Running setup.py install for pyfftw ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/setup.py'"'"'; __file__='"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-record-ljyxfo00/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/python#3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyfftw
cwd: /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/
Complete output (7 lines):
running install
running build
running build_py
UPDATING build/lib.macosx-10.15-x86_64-3.9/pyfftw/_version.py
set build/lib.macosx-10.15-x86_64-3.9/pyfftw/_version.py to '0.12.0'
running build_ext
error: Could not find any of the FFTW libraries
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/setup.py'"'"'; __file__='"'"'/private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-install-p3twpksg/pyfftw_a5a93b1d21cd45bb90489634e47c82a5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/xc/vzy2gb2j2hs8tyv7j70d979h0000gn/T/pip-record-ljyxfo00/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/python#3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyfftw Check the logs for full command output.
It looks like the problem is mainly about the "Building wheel for pyfftw".
Alternatively you could install pyFFTW: pip install pyFFTW
Install instructions for Mac OS:
Install FFTW from homebrew:
brew install fftw
Set temporary environmental variables, such that pyfftw finds fftw:
export DYLD_LIBRARY_PATH=/usr/local/lib export LDFLAGS="-L/usr/local/lib"
export CFLAGS="-I/usr/local/include"
Now install pyfftw from pip:
pip install pyfftw
It has been suggested that macports might also work fine. You should then replace the LD environmental variables above with the right ones.
DYLD - path for libfftw3.dylib etc - find /usr -name libfftw3.dylib
LDFLAGS - path for fftw3.h - find /usr -name fftw3.h
check the python version once ,by typing python --version and if it is the latest version of python go to the code that you are typing and check the print statement as it is showing error in command prompt as you mentioned...in latest version of python you have to use parenthesis after print("you have to use parenthesis")
Refer to https://github.com/pyFFTW/pyFFTW/issues/303
Run brew install fftw
Install the lib with LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include -Wno-error=implicit-function-declaration" python setup.py install

Failed to install quadprog on Linux Mint 20

has anyone installed this quadprog lib on Python 3.8 and Linux Mint 20? I'm trying to install and the following error is appearing:
pip install quadprog
Collecting quadprog
Using cached quadprog-0.1.8.tar.gz (269 kB)
Requirement already satisfied: Cython in ./anaconda3/lib/python3.8/site-packages (from quadprog) (0.29.21)
Building wheels for collected packages: quadprog
Building wheel for quadprog (setup.py) ... [?25lerror
ERROR: Command errored out with exit status 1:
command: /home/hugosouza/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8o_4txn2/quadprog_089e8c8a9afa4563849d61ace43b3f03/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8o_4txn2/quadprog_089e8c8a9afa4563849d61ace43b3f03/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-r3kgatse
cwd: /tmp/pip-install-8o_4txn2/quadprog_089e8c8a9afa4563849d61ace43b3f03/
Complete output (12 lines):
running bdist_wheel
running build
running build_ext
skipping 'quadprog/quadprog.cpp' Cython extension (up-to-date)
building 'quadprog' extension
creating build
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/quadprog
gcc -pthread -B /home/hugosouza/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iquadprog -I/home/hugosouza/anaconda3/include/python3.8 -c quadprog/quadprog.cpp -o build/temp.linux-x86_64-3.8/quadprog/quadprog.o
gcc: fatal error: cannot execute ‘cc1plus’: execvp: Arquivo ou diretório não encontrado
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for quadprog
nning setup.py clean for quadprog
Failed to build quadprog
^C
ERROR: Operation cancelled by user
Note: you may need to restart the kernel to use updated packages.
You need to install g++ or build-essential (which will install g++)
apt-get install g++

Why does pyheif crash on python import?

When trying to import 'pyheif' in a python 3 program, I get this crash dump below.
Can anyone explain how to successfully import this package? I have tried multiple versions, made sure "wheel" was installed, etc., searched Stack and done other searches but have not found out how to resolve.
Thanks in advance!
Collecting pyheif
Using cached pyheif-0.5.1.tar.gz (17 kB)
Requirement already satisfied: cffi>=1.0.0 in /Users/user/venv/HEICToJPG/lib/python3.8/site-packages (from pyheif) (1.14.4)
Requirement already satisfied: pycparser in /Users/user/venv/HEICToJPG/lib/python3.8/site-packages (from cffi>=1.0.0->pyheif) (2.20)
Building wheels for collected packages: pyheif
Building wheel for pyheif (setup.py): started
Building wheel for pyheif (setup.py): finished with status 'error'
Running setup.py clean for pyheif
Failed to build pyheif
Installing collected packages: pyheif
Running setup.py install for pyheif: started
Running setup.py install for pyheif: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/user/venv/HEICToJPG/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/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 /private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-wheel-8kzdauau
cwd: /private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/
Complete output (27 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/error.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/constants.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/reader.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/writer.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
creating build/lib.macosx-10.9-x86_64-3.8/pyheif/data
copying pyheif/data/version.txt -> build/lib.macosx-10.9-x86_64-3.8/pyheif/data
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
generating cffi module 'build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c'
creating build/temp.macosx-10.9-x86_64-3.8
building '_libheif_cffi' extension
creating build/temp.macosx-10.9-x86_64-3.8/build
creating build/temp.macosx-10.9-x86_64-3.8/build/temp.macosx-10.9-x86_64-3.8
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/include -I/usr/include -I/Users/user/venv/HEICToJPG/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-3.8/build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.o
build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c:570:15: fatal error: 'libheif/heif.h' file not found
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyheif
ERROR: Command errored out with exit status 1:
command: /Users/user/venv/HEICToJPG/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-record-phe46c7r/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user/venv/HEICToJPG/include/site/python3.8/pyheif
cwd: /private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/error.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/constants.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/reader.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
copying pyheif/writer.py -> build/lib.macosx-10.9-x86_64-3.8/pyheif
creating build/lib.macosx-10.9-x86_64-3.8/pyheif/data
copying pyheif/data/version.txt -> build/lib.macosx-10.9-x86_64-3.8/pyheif/data
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
generating cffi module 'build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c'
creating build/temp.macosx-10.9-x86_64-3.8
building '_libheif_cffi' extension
creating build/temp.macosx-10.9-x86_64-3.8/build
creating build/temp.macosx-10.9-x86_64-3.8/build/temp.macosx-10.9-x86_64-3.8
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/include -I/usr/include -I/Users/user/venv/HEICToJPG/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c -o build/temp.macosx-10.9-x86_64-3.8/build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.o
build/temp.macosx-10.9-x86_64-3.8/_libheif_cffi.c:570:15: fatal error: 'libheif/heif.h' file not found
#include "libheif/heif.h"
^~~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/user/venv/HEICToJPG/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-install-q3c_oaef/pyheif_88ea55c096834e3e8b4bbae48bc5e633/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ts/yxklk_lj3f32_q1kkljflz5h0000gn/T/pip-record-phe46c7r/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user/venv/HEICToJPG/include/site/python3.8/pyheif Check the logs for full command output.
We need to know a bit more about your environment, like what type of machine do you have, are you using docker, if yes what type of docker image are you using, etc.
I will try to give you a generic answer and maybe we can discuss in detail your problem once you will be back.
Try to follow the commands as described in repo https://github.com/carsales/pyheif
brew install libffi libheif
In case that you are using docker then add the following packages into a RUN command
RUN apt-get install -y libffi-dev libheif-dev libde265-dev

Error when trying to install nltk - Python

This is the error I am getting when trying to install nltk.
Collecting nltk
Using cached nltk-3.5.zip (1.4 MB)
Requirement already satisfied: click in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from nltk) (7.1.2)
Requirement already satisfied: joblib in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from nltk) (0.16.0)
Collecting regex
Using cached regex-2020.7.14.tar.gz (690 kB)
Collecting tqdm
Using cached tqdm-4.49.0-py2.py3-none-any.whl (69 kB)
Using legacy 'setup.py install' for nltk, since package 'wheel' is not installed.
Using legacy 'setup.py install' for regex, since package 'wheel' is not installed.
Installing collected packages: regex, tqdm, nltk
Running setup.py install for regex ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-izrsarsv/regex/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-izrsarsv/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-cqr8q0er/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex
cwd: /private/tmp/pip-install-izrsarsv/regex/
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/regex_3
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.8/regex_3/_regex.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-izrsarsv/regex/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-izrsarsv/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-cqr8q0er/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex Check the logs for full command output.
My python & pip are up to date. Does anyone know how to successfully install this package?

Error in the installation of scrapy

I just tried to run a simple
sudo pip install scrapy
and after the download of every component it gives me an error:
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-s37cTl/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-62NAJB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-s37cTl/cffi
I satisfy all the dependecies, don't know what can be.
I run Debian 7.
Thanks!
EDIT: I paste the whole installations terminal output:
:~$ sudo pip install scrapy
Collecting scrapy
Using cached Scrapy-0.24.5-py2-none-any.whl
Collecting cssselect>=0.9 (from scrapy)
Using cached cssselect-0.9.1.tar.gz
Collecting queuelib (from scrapy)
Using cached queuelib-1.2.2-py2.py3-none-any.whl
Collecting pyOpenSSL (from scrapy)
Using cached pyOpenSSL-0.14.tar.gz
Collecting w3lib>=1.8.0 (from scrapy)
Using cached w3lib-1.11.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/local/lib/python2.7/dist-packages (from scrapy)
Collecting Twisted>=10.0.0 (from scrapy)
Using cached Twisted-15.0.0.tar.bz2
Collecting six>=1.5.2 (from scrapy)
Using cached six-1.9.0-py2.py3-none-any.whl
Collecting cryptography>=0.2.1 (from pyOpenSSL->scrapy)
Using cached cryptography-0.8.tar.gz
Collecting zope.interface>=3.6.0 (from Twisted>=10.0.0->scrapy)
Using cached zope.interface-4.1.2.tar.gz
Collecting pyasn1 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
Using cached pyasn1-0.1.7.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.2.1->pyOpenSSL->scrapy)
Collecting enum34 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
Using cached enum34-1.0.4.tar.gz
Collecting cffi>=0.8 (from cryptography>=0.2.1->pyOpenSSL->scrapy)
Using cached cffi-0.9.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=0.8->cryptography>=0.2.1->pyOpenSSL->scrapy)
Installing collected packages: cffi, enum34, pyasn1, zope.interface, cryptography, six, Twisted, w3lib, pyOpenSSL, queuelib, cssselect, scrapy
Running setup.py install for cffi
building '_cffi_backend' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-i686-2.7/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-tIHlcr/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dPM9YP-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/cffi
copying cffi/lock.py -> build/lib.linux-i686-2.7/cffi
copying cffi/model.py -> build/lib.linux-i686-2.7/cffi
copying cffi/api.py -> build/lib.linux-i686-2.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-i686-2.7/cffi
copying cffi/gc_weakref.py -> build/lib.linux-i686-2.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-i686-2.7/cffi
copying cffi/verifier.py -> build/lib.linux-i686-2.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-i686-2.7/cffi
copying cffi/__init__.py -> build/lib.linux-i686-2.7/cffi
copying cffi/cparser.py -> build/lib.linux-i686-2.7/cffi
copying cffi/commontypes.py -> build/lib.linux-i686-2.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-i686-2.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-i686-2.7
creating build/temp.linux-i686-2.7/c
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-i686-2.7/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-tIHlcr/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dPM9YP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-tIHlcr/cffi
On Mint 17, I was able to install Scrapy after installing following packages:
sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev
For CentOS
yum install libffi libffi-devel
then
pip install cffi
pip install Scrapy

Categories