I'm trying to install this library from pip:
https://github.com/ipazc/mtcnn
When I run the suggested command, I get this error:
$ pip3 install mtcnn
Collecting mtcnn
Downloading https://files.pythonhosted.org/packages/67/43/abee91792797c609c1bf30f1112117f7a87a713ebaa6ec5201d5555a73ef/mtcnn-0.1.0-py3-none-any.whl (2.3MB)
100% |████████████████████████████████| 2.3MB 604kB/s
Collecting opencv-python>=4.1.0 (from mtcnn)
Using cached https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz
Collecting keras>=2.0.0 (from mtcnn)
Downloading https://files.pythonhosted.org/packages/44/e1/dc0757b20b56c980b5553c1b5c4c32d378c7055ab7bfa92006801ad359ab/Keras-2.4.3-py2.py3-none-any.whl
Collecting numpy>=1.13.3 (from opencv-python>=4.1.0->mtcnn)
Using cached https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting pyyaml (from keras>=2.0.0->mtcnn)
Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
100% |████████████████████████████████| 645kB 2.1MB/s
Collecting scipy>=0.14 (from keras>=2.0.0->mtcnn)
Using cached https://files.pythonhosted.org/packages/c8/89/63171228d5ced148f5ced50305c89e8576ffc695a90b58fe5bb602b910c2/scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl
Collecting h5py (from keras>=2.0.0->mtcnn)
Downloading https://files.pythonhosted.org/packages/70/7a/e53e500335afb6b1aade11227cdf107fca54106a1dca5c9d13242a043f3b/h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0MB)
100% |████████████████████████████████| 4.0MB 362kB/s
Collecting cached-property; python_version < "3.8" (from h5py->keras>=2.0.0->mtcnn)
Downloading https://files.pythonhosted.org/packages/48/19/f2090f7dad41e225c7f2326e4cfe6fff49e57dedb5b53636c9551f86b069/cached_property-1.5.2-py2.py3-none-any.whl
Building wheels for collected packages: opencv-python
Running setup.py bdist_wheel for opencv-python ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/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/tmplsl7vw2mpip-wheel- --python-tag cp36:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
Failed building wheel for opencv-python
Running setup.py clean for opencv-python
Failed to build opencv-python
Installing collected packages: numpy, opencv-python, pyyaml, scipy, cached-property, h5py, keras, mtcnn
Running setup.py install for opencv-python ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/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-hs7o4egq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/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-hs7o4egq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-dzjs1nf_/opencv-python/
I had this same error when trying to pip install opencv-python. However, I resolved the issue by running sudo apt install python3-opencv successfully. The mtcnn packages tries to reinstall opencv with the pip method that fails. How do I get around this issue?
I am on an aws ec2 ubuntu 18.04.
First install Cmake by doing
pip install cmake
or
pip3 install cmake
Then install mtcnn
pip install mtcnn
Related
I would greatly appreciate help in tackling a problem that drives me crazy (I do need Ubuntu 18.04 and python 3). I did try using different scenarios, but everything fails when installing PyPI package isal on Ubuntu 18.04:
FROM ubuntu:18.04
RUN apt update -y && apt upgrade -y
RUN apt install -y python3 python3-pip
RUN pip3 install isal
docker build . fails with:
Step 3/3 : RUN pip3 install isal
---> Running in 71a47c31d97c
Collecting isal
Downloading https://files.pythonhosted.org/packages/d6/72/b997fd8ba95a0820edcd5da268505705a5518fd860d64bf28a7c1c343a3a/isal-0.11.0.tar.gz (680kB)
Building wheels for collected packages: isal
Running setup.py bdist_wheel for isal: started
Running setup.py bdist_wheel for isal: finished with status 'error'
....
running build_ext
/tmp/tmpk3o08f96/autogen.sh: 3: /tmp/tmpk3o08f96/autogen.sh: autoreconf: not found
error: [Errno 2] No such file or directory: '/tmp/tmpk3o08f96/configure': '/tmp/tmpk3o08f96/configure'
----------------------------------------
Failed building wheel for isal
Running setup.py clean for isal
Failed to build isal
Installing collected packages: isal
Running setup.py install for isal: started
Running setup.py install for isal: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-qa68yevk/isal/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-8qioc11y-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
....
running build_ext
/tmp/tmpnfxsy9ug/autogen.sh: 3: /tmp/tmpnfxsy9ug/autogen.sh: autoreconf: not found
error: [Errno 2] No such file or directory: '/tmp/tmpnfxsy9ug/configure': '/tmp/tmpnfxsy9ug/configure'
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-qa68yevk/isal/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-8qioc11y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-qa68yevk/isal/
The command '/bin/sh -c pip3 install isal' returned a non-zero code: 1
while FROM ubuntu:20.04 everything works fine
pip also fails:
FROM ubuntu:18.04
RUN apt update -y && apt upgrade -y \
&& apt install -y python python-pip
RUN pip install isal
Step 3/3 : RUN pip install isal
---> Running in 6e157d7d965a
Collecting isal
Could not find a version that satisfies the requirement isal (from versions: )
No matching distribution found for isal
The command '/bin/sh -c pip install isal' returned a non-zero code: 1
you can try apt install autoconf to resolve autoreconf: not found
I am not able to install librosa in Ubuntu 18.04. I have tried the following commands, all are failed.
pip install librosa
python3.8 -m pip install librosa
sudo pip install librosa
pip install -u librosa
The below error I am getting:
Failed cleaning build dir for numba
Running setup.py bdist_wheel for resampy ... done
Stored in directory: /home/nageshas/.cache/pip/wheels/fa/c1/56/e0e12c6f7f3d2cdea9712b35136a2d40a7817c6210ec096485
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zrky3kzn/llvmlite/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/tmphpnrxd05pip-wheel- --python-tag cp38:
running bdist_wheel
/usr/bin/python3.8 /tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 220, in <module>
main()
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 210, in main
main_posix('linux', '.so')
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 134, in main_posix
raise RuntimeError(msg) from None
RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Successfully built librosa audioread resampy
Failed to build numba llvmlite
Installing collected packages: audioread, decorator, joblib, llvmlite, numpy, setuptools, numba, chardet, urllib3, idna, certifi, requests, pyparsing, packaging, appdirs, pooch, scipy, six, resampy, threadpoolctl, scikit-learn, pycparser, cffi, soundfile, librosa
Running setup.py install for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zrky3kzn/llvmlite/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-f20fjedr-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
got version from file /tmp/pip-build-zrky3kzn/llvmlite/llvmlite/_version.py {'version': '0.36.0', 'full': 'e6bb8d137d922bec8beeb01a237254778759becd'}
running build_ext
/usr/bin/python3.8 /tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 220, in <module>
main()
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 210, in main
main_posix('linux', '.so')
File "/tmp/pip-build-zrky3kzn/llvmlite/ffi/build.py", line 134, in main_posix
raise RuntimeError(msg) from None
RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
error: command '/usr/bin/python3.8' failed with exit status 1
I came across the same issues too.
There are several steps that helped me, but I cannot define the exact one. So I will list all:
First, update setuptools and wheel
python3 -m pip install --upgrade pip setuptools wheel
Second
python setup.py bdist_wheel
Try to install the previous version of librosa
pip install librosa==0.7.2
I hope the first two steps will help
I am using
! pip install glove_python
I'm getting this error message:
Collecting glove_python
Downloading https://files.pythonhosted.org/packages/3e/79/7e7e548dd9dcb741935d031117f4bed133276c2a047aadad42f1552d1771/glove_python-0.1.0.tar.gz (263kB)
|████████████████████████████████| 266kB 16.9MB/s
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from glove_python) (1.19.5)
Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from glove_python) (1.4.1)
Building wheels for collected packages: glove-python
Building wheel for glove-python (setup.py) ... error
**ERROR: Failed building wheel for glove-python**
Running setup.py clean for glove-python
**ERROR: Failed cleaning build dir for glove-python**
Failed to build glove-python
Installing collected packages: glove-python
Running setup.py install for glove-python ... error
**ERROR: Command errored out with exit status 1**: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nypxp28t/glove-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nypxp28t/glove-python/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-cnn32mbr/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
As suggested below I tried
! python -m pip install glove_python --verbose
Which outputs the following recurring error with different members:
has no member named ‘exc_{member}’; did you mean ‘curexc_value’?
And ends with:
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Running setup.py install for glove-python ... error
Cleaning up...
Removing source in /tmp/pip-install-ru3hxbde/glove-python
Removed build tracker '/tmp/pip-req-tracker-ps3qzi71'
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ru3hxbde/glove-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ru3hxbde/glove-python/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-ywzvlm5m/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 455, in run
use_user_site=options.use_user_site,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/__init__.py", line 62, in install_given_reqs
**kwargs
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/req_install.py", line 888, in install
cwd=self.unpacked_source_directory,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/subprocess.py", line 275, in runner
spinner=spinner,
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ru3hxbde/glove-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ru3hxbde/glove-python/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-ywzvlm5m/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Trying pip install glove-python-binary is successful but when I import it I get the following error:
import glove-python-binary
^
SyntaxError: invalid syntax
Seems like glove_python package is very old, last relese of it on PIP was in 2016. And it has only sources there, so should be compiled by C/C++ compiler, which is usually problematic everywhere (needs manual installing correct compiler and all dependencies).
Looks like updated version is glove-python-binary it dates to 2020. Try installing it through ! pip install glove-python-binary.
According to pypi site glove-python-binary needs Python of versions 3.6 or 3.7 or 3.8, smaller or bigger version of Python will not probably work.
When you have any problem or error in pip try adding --verbose to pip command line, this will print you a lot of details about reasons of pip failure.
Also as #GameDev said sometimes you have to also try running command ! python -m pip install PACKAGE instead of ! pip install PACKAGE, to install any Python pip PACKAGE, because first command uses exactly python that you use to run the script, while second may use pip from other Python installation, not from Python installation that is used to run actual script later.
In the google-colab just write:
!pip install glove-python-binary
And for using, do this:
import glove
For example:
from glove import Glove
from glove import Corpus
This worked for me!
I'm using win10 and trying to install geopandas:
C:\Users\61432>pip install geopandas
Collecting geopandas
Using cached geopandas-0.7.0-py2.py3-none-any.whl (928 kB)
Requirement already satisfied: shapely in c:\users\61432\anaconda3\lib\site-packages (from geopandas) (1.7.0)
Collecting fiona
Using cached Fiona-1.8.13.post1.tar.gz (1.2 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\61432\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\61432\\AppData\\Local\\Temp\\pip-install-xgic7o3y\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\61432\\AppData\\Local\\Temp\\pip-install-xgic7o3y\\fiona\\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 'C:\Users\61432\AppData\Local\Temp\pip-install-xgic7o3y\fiona\pip-egg-info'
cwd: C:\Users\61432\AppData\Local\Temp\pip-install-xgic7o3y\fiona\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
First Download packages from https://www.lfd.uci.edu/~gohlke/pythonlibs/
(GDAL,FIONA) put in the file_path where you're working the project
Second Install the packages
cd the file_path> pip install GDAL
i.e (data) C:\Users\mourinho\project> pip install GDAL-3.2.1-cp39-cp39-win_amd64.whl
then
pip install Fiona
i.e (data) C:\Users\mourinho\project> pip install Fiona-1.8.18-cp39-cp39-win_amd64.whl
pip install geopandas
I downloaded wheel to the most recent version
But I'm not entirely sure how to make of this semi-cryptic error message
Failed building wheel for mysql-python
Command "/Users/username/Desktop/Project/venv/bin/python -u -c "import setuptools,
tokenize;__file__='/private/var/folders/bg/_nsyc_vxasdfx___h11f3jw00000gn/T/pip-build-rBf9R1/mysql-python/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/bg/_nsyc_vx4g___xbsh11f3jw00000gn/T/pip-Tjwbij-record/install-record.txt --single-version-externally-managed
--compile --install-headers /Users/username/Desktop/project/venv/include/site/python2.7/mysql-python" failed with error code 1 in
/private/var/folders/bg/_nsyc_vxasdf__xbsh11f3jw00000gn/T/pip-build-rBf9R1/mysql-python/
I tried
pip install --upgrade wheel
and I get
Requirement already up-to-date: wheel
MySQL version
mysql Ver 14.14 Distrib 5.7.10, for osx10.11 (x86_64) using EditLine wrapper
As for me, it is because my system lack of python3 developing lib. It warns that there is no "Python.h" while installing. The following command fix it for me.
yum install python34-devel -y
pip3 install mysqlclient
The topic is quite old but for the people who might be suffered from having this problem,this can be your solution:
First of all,you must open the file where you use Python like 3.5,3.6,Anaconda etc. Then open cmd in that file and run the command below:
$ pip install mysqlclient==1.3.12