Opencv-contrib installation error: file not found - python

A Linux newbie here. On Linux Mint, python 3.8, under Anaconda, trying to install opencv-contrib-python by
pip install --no-binary opencv-contrib-python opencv-contrib-python
After a long and very resource-intensive process get this error. Any suggestions on what I am missing?
As a side note, normal pip installation without --no-binary works fine, but results in a runtime error that I am trying to resolve per this post.
Configuring Project
Working directory:
/tmp/pip-install-cwq7rmvu/opencv-contrib-python/_skbuild/linux-x86_64-3.8/cmake-build
Command:
cmake /tmp/pip-install-cwq7rmvu/opencv-contrib-python/opencv -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-cwq7rmvu/opencv-contrib-python/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/home/artem/anaconda3/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.5 -DPYTHON_INCLUDE_DIR:PATH=/home/artem/anaconda3/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/home/artem/anaconda3/lib/libpython3.8.so -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/skbuild/resources/cmake -DPYTHON3_EXECUTABLE=/home/artem/anaconda3/bin/python -DPYTHON3_INCLUDE_DIR=/home/artem/anaconda3/include/python3.8 -DPYTHON3_LIBRARY=/home/artem/anaconda3/lib/libpython3.8.so -DBUILD_opencv_python3=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_java=OFF -DOPENCV_PYTHON3_INSTALL_PATH=python -DINSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_apps=OFF -DBUILD_opencv_freetype=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_DOCS=OFF -DOPENCV_EXTRA_MODULES_PATH=/tmp/pip-install-cwq7rmvu/opencv-contrib-python/opencv_contrib/modules -DCMAKE_BUILD_TYPE:STRING=Release
Copying files from CMake output
Traceback (most recent call last):
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/artem/anaconda3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 221, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 207, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 496, in <module>
main()
File "setup.py", line 248, in main
skbuild.setup(
File "/tmp/pip-build-env-p4glm5l9/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 625, in setup
_classify_installed_files(cmake_manifest, package_data, package_prefixes,
File "setup.py", line 381, in _classify_installed_files_override
with open('scripts/__init__.py', 'r') as custom_init:
FileNotFoundError: [Errno 2] No such file or directory: 'scripts/__init__.py'
----------------------------------------
ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Could not build wheels for opencv-contrib-python which use PEP 517 and cannot be installed directly

Removing Anaconda and working with the python supplied with my Linux distro solved the issue.

Related

opencv-contrib-python build fails due to skbuild or Cmake error

My setup:
MacOS, Mojave, Mac Mini A1993 (2018)
Python 3.7.4, virtual environment
pip upgraded, setuptools wheel upgraded, XCode and command line tools installed.
Trying to run (sudo) pip3 install opencv-contrib-python==4.5.3.56 fails:
copying _skbuild/macosx-10.14-x86_64-3.7/cmake-install/share/opencv4/haarcascades/haarcascade_russian_plate_number.xml -> _skbuild/macosx-10.14-x86_64-3.7/cmake-install/cv2/data/haarcascade_russian_plate_number.xml
copying _skbuild/macosx-10.14-x86_64-3.7/cmake-install/share/opencv4/haarcascades/haarcascade_smile.xml -> _skbuild/macosx-10.14-x86_64-3.7/cmake-install/cv2/data/haarcascade_smile.xml
copying _skbuild/macosx-10.14-x86_64-3.7/cmake-install/share/opencv4/haarcascades/haarcascade_upperbody.xml -> _skbuild/macosx-10.14-x86_64-3.7/cmake-install/cv2/data/haarcascade_upperbody.xml
Copying files from non-default sourcetree locations
copying LICENSE.txt -> _skbuild/macosx-10.14-x86_64-3.7/cmake-install/cv2/LICENSE.txt
copying LICENSE-3RD-PARTY.txt -> _skbuild/macosx-10.14-x86_64-3.7/cmake-install/cv2/LICENSE-3RD-PARTY.txt
Traceback (most recent call last):
File "/Users/exhibition/Documents/venv_test_4/venv4/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/Users/exhibition/Documents/venv_test_4/venv4/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/exhibition/Documents/venv_test_4/venv4/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
metadata_directory)
File "/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-build-env-_g912da_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 245, in build_wheel
wheel_directory, config_settings)
File "/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-build-env-_g912da_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
self.run_setup()
File "/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-build-env-_g912da_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 282, in run_setup
self).run_setup(setup_script=setup_script)
File "/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-build-env-_g912da_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 462, in <module>
main()
File "setup.py", line 262, in main
cmake_source_dir=cmake_source_dir,
File "/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-build-env-_g912da_/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 686, in setup
skbuild_kw["cmake_install_dir"],
File "setup.py", line 413, in _classify_installed_files_override
cmake_install_dir=cmake_install_reldir,
TypeError: _classify_installed_files() got an unexpected keyword argument 'cmake_install_dir'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
Trying to run new version (sudo) pip3 install opencv-contrib-python fails:
Traceback (most recent call last):
An error occurred while building with CMake.
Command:
cmake --build . --target install --config Release --
Install target:
install
Source directory:
/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-install-6kfw2s0l/opencv-contrib-python_1cdac7916ab34fb98d01dacc90a69e53
Working directory:
/private/var/folders/42/tzk3gt4548d4s2znyqlsx_qm0000gn/T/pip-install-6kfw2s0l/opencv-contrib-python_1cdac7916ab34fb98d01dacc90a69e53/_skbuild/macosx-10.14-x86_64-3.7/cmake-build
Please check the install target is valid and see CMake's output for more information.
[end of output]
Based on issue #648 my first failed attempt is due to skbuild update, has anyone got past this? I'd want the older opencv version ideally but not a must. https://github.com/opencv/opencv-python/issues/648
Many thanks for any help!

Error when trying to install autodocking Vina

I'm trying to install Autodock Vina with pip command. But when I run the command pip install -U numpy vina: I get a the following error:
Collecting vina
Using cached vina-1.2.3.tar.gz (95 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [52 lines of output]
Version found 1.2.3 (from __init__.py)
running egg_info
writing vina.egg-info\PKG-INFO
writing dependency_links to vina.egg-info\dependency_links.txt
writing requirements to vina.egg-info\requires.txt
writing top-level names to vina.egg-info\top_level.txt
Boost library is not installed in this conda environment.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
main()
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 162, in get_requires_for_build_wheel
return self._get_build_requires(
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 346, in <module>
setup(
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 299, in run
self.find_sources()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 306, in find_sources
mm.run()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 541, in run
self.add_defaults()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 578, in add_defaults
sdist.add_defaults(self)
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 228, in add_defaults
self._add_defaults_ext()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "setup.py", line 247, in finalize_options
raise ValueError(error_msg)
ValueError: Boost library location was not found!
Directories searched: conda env, /usr/local/include and /usr/include.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I have had a similar issue and fixed it by installing boost and swig libraries. Unfortunately, I do not completely know how to do that on Windows, but the rough sketch of what you should do is:
Locate your active conda environment. If there are none, create and activate one before installing your project dependencies. To get to know the location of your environment, use conda info. For more, see this stackoverflow thread.
Download boost and swig as archives from these links to their official website.
Unpack the archives into the conda environment folder.
Try installing again (make sure you have activated the environment) pip install -U numpy vina.
For the Linux and MacOS users that may have the same issue, the solution is very similar, except that you do not have to activate a conda environment. Instead, you can install boost and swig globally in your system, as described in this guide in the autodock-vina website.
Install C++ compiler.
Ubuntu/Debian: sudo apt-get install build-essentials
macOS: Install Xcode from the AppStore and the Command Line Tools (CLT) from the terminal xcode-select --install
Install boost and swig in your system
Ubuntu/Debian: sudo apt-get install libboost-all-dev swig
macOS (with Homebrew): brew install boost swig

Cython "ModuleNotFoundError" even though it was just installed via requirements.txt while building docker image

Installing packages when building a docker image via the requirements.txt. In the Dockerfile it reads
COPY requirements.txt /app/requirements.txt
RUN pip3 install -r /app/requirements.txt
In the requirements.txt I put down deploy token for installing a private git repo, such as this example one:
git+https://gitlab+deploy-token-123456:a1b2c3d4e5f6g7h8j9#gitlab.com/example/lib.git#a1b2c3d4e5f6g7h8j9k1l2m3n4o5p6q7r8s9t
It throws an error, ModuleNotFoundError: No module named 'Cython'.
However, even though I include Cython in the requirements and it gets collected correctly, I get the same error.
Here is the complete message:
docker build -t docker.example/example:dev .
Sending build context to Docker daemon 8.704kB
Step 1/7 : FROM python:3.6.6-alpine
---> a78e257617d1
Step 2/7 : RUN apk update
---> Using cache
---> 35e6b7308e61
Step 3/7 : RUN apk add gcc build-base musl-dev libc-dev util-linux-dev linux-headers python3-dev git ca-certificates libffi-dev bash postgresql-libs postgresql-dev
---> Using cache
---> 5ca54839bb7c
Step 4/7 : RUN python3 -m ensurepip
---> Using cache
---> 03d95f700108
Step 5/7 : RUN pip install --upgrade pip
---> Using cache
---> e462d855f07f
Step 6/7 : COPY requirements.txt /app/requirements.txt
---> f69aa355732a
Step 7/7 : RUN pip3 install -r /app/requirements.txt
---> Running in d75911af46c7
Collecting git+https://gitlab%2Bdeploy-token-171703:****#gitlab.com/example/lib.git#f75285be6ee56360d6f0cfbf64f09a86819def5c (from -r /app/requirements.txt (line 2))
Cloning https://gitlab%2Bdeploy-token-171703:****#gitlab.com/example/lib.git (to revision f75285be6ee56360d6f0cfbf64f09a86819def5c) to /tmp/pip-req-build-yt5mk7q5
Running command git clone -q 'https://gitlab%2Bdeploy-token-171703:****#gitlab.com/example/lib.git' /tmp/pip-req-build-yt5mk7q5
Collecting Cython==0.29.17
Downloading Cython-0.29.17-py2.py3-none-any.whl (971 kB)
Collecting psychrolib==2.5.0
Downloading PsychroLib-2.5.0.zip (9.5 kB)
Collecting influxdb==5.2.2
Downloading influxdb-5.2.2-py2.py3-none-any.whl (70 kB)
Collecting configparser==3.5.0
Downloading configparser-3.5.0.tar.gz (39 kB)
Collecting reportlab
Downloading reportlab-3.5.42.tar.gz (2.9 MB)
Collecting PyPDF2
Downloading PyPDF2-1.26.0.tar.gz (77 kB)
Collecting matplotlib>=2.2.2
Downloading matplotlib-3.2.1.tar.gz (40.3 MB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mqz7vwwc/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mqz7vwwc/matplotlib/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 /tmp/pip-install-mqz7vwwc/matplotlib/pip-egg-info
cwd: /tmp/pip-install-mqz7vwwc/matplotlib/
Complete output (112 lines):
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_bounded_integers.pyx.in
Traceback (most recent call last):
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 61, in process_pyx
from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named 'Cython'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 238, in <module>
main()
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 234, in main
find_process_files(root_dir)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 225, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 191, in process
processor_function(fromfile, tofile)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 94, in process_tempita_pyx
process_pyx(pyxfile, tofile)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/tools/cythonize.py", line 66, in process_pyx
raise OSError('Cython needs to be installed in Python as a module')
OSError: Cython needs to be installed in Python as a module
Running from numpy source directory.
/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 488, in <module>
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 469, in setup_package
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 275, in generate_cython
)
RuntimeError: Running cythonize failed!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-mqz7vwwc/matplotlib/setup.py", line 274, in <module>
cmdclass=cmdclass,
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 134, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 777, in resolve
replace_conflicting=replace_conflicting
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1060, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1072, in obtain
return installer(requirement)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 581, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 676, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 702, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 887, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1155, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1141, in run_setup
run_setup(setup_script, args)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 488, in <module>
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 469, in setup_package
File "/tmp/easy_install-ho_rizu1/numpy-1.18.4/setup.py", line 275, in generate_cython
)
RuntimeError: Running cythonize failed!
Edit setup.cfg to change the build options; suppress output with --quiet.
BUILDING MATPLOTLIB
matplotlib: yes [3.2.1]
python: yes [3.6.6 (default, Sep 12 2018, 02:15:29) [GCC 6.4.0]]
platform: yes [linux]
sample_data: yes [installing]
tests: no [skipping due to configuration]
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl/Tk]
macosx: no [Mac OS-X only]
Cythonizing sources
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install -r /app/requirements.txt' returned a non-zero code: 1
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 1
I was able to resolve the problem by including
RUN pip3 install Cython
in the Dockerfile, above the requirements installation.
So the problem is you installed two versions of Python, I'm guessing:
The Docker image has Python included.
You then installed the Alpine system Python with apk.
You should remove the python-dev package from apk install line.
Also—you only need to compile matplotlib, numpy, etc. because you're using Alpine. If you switch to a base image that isn't Alpine based (e.g. python:3.6-slim-buster) you'll be able to use pre-compiled wheels and your build process will be much faster. See https://pythonspeed.com/articles/alpine-docker-python/ for longer discussion, but basically Alpine uses libc that's different than standard Linux glibc and so wheels from PyPI don't work.

Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output - while installing auto-py-to-exe through pip

I am trying to download auto-py-to-exe on a different (windows) device than I usually use through pip. However when run I get the error (sorry it is so very very long):
ERROR: Command errored out with exit status 1:
command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\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\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\pip-egg-info'
cwd: C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\
Complete output (113 lines):
Traceback (most recent call last):
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 127, in <module>
HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 105, in uses_msvc
include_dirs=include_dirs)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 843, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 485, in __init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\setup.py", line 427, in <module>
run_setup(EXT_MODULES, run_make=_BUILDING)
File "C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\setup.py", line 328, in run_setup
setup(
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
dist = best[req.key] = env.best_match(
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
return installer(requirement)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
return cmd.easy_install(req)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
run_setup(setup_script, args)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
raise
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
saved_exc.resume()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 127, in <module>
HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 105, in uses_msvc
include_dirs=include_dirs)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 843, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 485, in __init__
self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Even though it does state that I need Visual Studio C++ 14.0 my computer won't install it and I have not needed it before. I checked This Stack Overflow Question but it relates to another pip install and has no answers. If the only answer is to install Visual Studio then I am kinda screwed.
Edit
Since this answer was posted, gevent has released several new versions, including prebuilt wheels for Python 3.8 on Windows, so the pip install gevent --pre shouldn't be necessary anymore - just run pip install auto-py-to-exe as usual and it should work.
Original answer
Allow prerelease gevent versions via
$ pip install gevent --pre
$ pip install auto-py-to-exe
Explanation: auto-py-to-exe is installable on Python 3.8 on Windows without any issues (this can be verified e.g. by running pip install auto-py-to-exe --no-deps). However, it requires bottle-websocket to be installed, which in turn has gevent dependency. gevent did not release a stable version that offers prebuilt wheels for Python 3.8 yet (this would be 1.5), so pip doesn't pick up prebuilt wheels and tries to build gevent==1.4 from source dist. Installing the prerelease 1.5 version of gevent avoids this.
In your problem, there are two problems occurred
IndexError: list index out of range.
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required
For the first error, You can try this code
pip install --no-use-wheel --upgrade distribute
if --no-use-wheel part didn't work, use --no-binary :all: instead.
Source
For the second error, you can use
pip install --upgrade setuptools
Source
If the above methods didn't work
If your build tools further not answering to your problem, try to install build tools manually through this link.
After that you have to restart your PC or laptop.
Then try to run your code again
for installing GDAL on mac:
brew install gdal
and then
pip install gdal
solved this for me
I got this error while installing mysqlclient. Here is the solution in simple steps:
Step 0: sudo apt install python3-dev build-essential
Step 1: sudo apt install libssl1.1
Step 2: sudo apt install libssl1.1=1.1.1f-1ubuntu2
Step 3: sudo apt install libssl-dev
Step 4: sudo apt install libmysqlclient-dev
Step 5: pip3 install mysqlclient
That's it!

Unable to install gdal in python 3.6.1 in macos Sierra

I was trying to install gdal in python 3.6.1, but getting the following error. How to overcome this?
bibinwilson ~ $ pip3 install gdal
Collecting gdal Downloading GDAL-2.2.1.tar.gz (475kB)
100% |████████████████████████████████| 481kB 397kB/s
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 131, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 707, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 1326, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 179, in get_gdal_config
return fetch_config(option, gdal_config = self.gdal_config)
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 135, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 131, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 707, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",
line 1326, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 339, in <module>
**extra )
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py",
line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 955, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 974, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 279, in run
self.find_sources()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 306, in find_sources
mm.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 533, in run
self.add_defaults()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/egg_info.py",
line 562, in add_defaults
sdist.add_defaults(self)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/py36compat.py",
line 36, in add_defaults
self._add_defaults_ext()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/py36compat.py",
line 119, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py",
line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py",
line 107, in ensure_finalized
self.finalize_options()
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 214, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 188, in get_gdal_config
return fetch_config(option)
File "/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/setup.py",
line 135, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in
/private/var/folders/43/7yqv__4j5776m508kggs_dxm0000gn/T/pip-build-naebgem9/gdal/
I had this error and installing GDAL through Homebrew fixed this for me. Installing the the binaries for GDAL didn't correct the error but once I installed through brew it was resolved.
brew install gdal
seems like the same issue as here: Python GDAL: pip install --no-install GDAL fails
If you've already installed the binaries (like I had) then this answer worked for me: https://stackoverflow.com/a/44051123/3969685
This simple procedure seemed to work for me on MAC sierra, python 3.6, GDAL 2.2.3
1) Install GDAL framework using dmg installer for MAC [GDAL MAC
Frameworks]: http://www.kyngchaos.com/software/frameworks
2) Add gdal-config folder to your path and get your version:
$ export PATH=/Library/Frameworks/GDAL.framework/Versions/2.2/Programs:$PATH
$ gdal-config --version
3) Use pip to install the version reported by gdal-config --version:
$ pip install gdal==2.2.3
Step 1 Seems to set up the python site-packages under its install framework folders and I think you could copy them to your python site-packages. But better to use pip install.
This simple procedure seemed to work for me on MAC
Install GDAL framework using Brew
> brew install gdal
gdal-config --version
gdal-config --version
2.4.4
3. GDAL Python binding
pip3 install gdal==2.4.4
Note the GDAL version of the end of the command, it must be the same as the obtained in the step above using gdal-config. To avoid conflicts or any further issues, it’s important to install and use the exact versions that any component will require.

Categories