Encountered a problem while installing [ FastText ] library on MacOS - nlp

I have been trying to install the "FastText" library on macOS but I keep encountering a Runtime error.
System - MacOS: 13.0.1 (22A400)
Python Version: 3.10
IDE: Pycharm
I tried installing it from Pycharm but it did not work, then i tried using the Terminal and this is what i got.
pip3 install fasttext and sudo pip3 install fasttext
all resulted with the same error below:
Using cached fasttext-0.9.2.tar.gz (68 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (2.10.2)
Requirement already satisfied: setuptools>=0.7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (65.5.0)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (1.21.4)
Building wheels for collected packages: fasttext
Building wheel for fasttext (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
creating var
creating var/folders
creating var/folders/xg
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fasttext
Running setup.py clean for fasttext
Failed to build fasttext
Installing collected packages: fasttext
Running setup.py install for fasttext ... error
error: subprocess-exited-with-error
× Running setup.py install for fasttext did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 698, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> fasttext
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure. ```

As an initial observation: it's often a good practice to install the Python libraries you need for a particular development project into a project-specific virtual environment.
That is, you set up a separate and specific Python interpreter, of a version you consciously choose, with its own set of installed libraries, which does not then affect the system's default Python installation in any way. It then becomes easier to choose whatever libraries/versions you need for that project, without any risk of confusing things for other programs on the same system. It also helps enforce a clear declaration of your project's actual prerequisites, so that you can re-create an adequante virtual-environment later when needed in new places – rather than leaving that to the chance/history of what's been globally installed on the devlopment machine.
Either the conda tool or the venv functionality of Python 3 can be used to set up such an environment, and after creation, each time you want to use that specific Python installation, you must activate it – so that in a particular shell, it becomes the active Python.
All that said, the error you're having relates to the lack of needed c++ development tools, which your installation-method seems to require to compile to those non-Python parts of Facebook's FastText library.
A bunch of options you could consider to get around this:
installing Apple's full XCode, including C++ & a bunch of other compilation/build tools, might resolve or change your error. There's more discussion from people who've hit a similar error, and eventually gotten around it using XCode-related configuration, at an issue in the Fasttext project: https://github.com/facebookresearch/fastText/issues/753
if using conda – I usually start with miniconda per the minimal instructions at https://docs.conda.io/en/latest/miniconda.html – it might be smart enough to choose a package already precompiled properly for your setup, even if you don't have C++ build tools locally. That is, after setting up your desired environment, then activating it, doing a conda install fasttext inside that environment might just work for you, skipping the local compilation error.
depending on your fasttext needs, you might also consider using some other Python library with FastText support, like Gensim. It doesn't support -supervised mode, but does support the core word-vectors (and synthesis of out-of-vocabulary word-vectors via character n-grams) capabilities of FastText, with some extra flexibility & related utility functions.

Related

Errors when installing onnx with pip in Ubuntu 20.04

I'm trying to install onnx in a fresh Ubuntu 20.04 install, but I'm running into the error bellow. It seems that I need the protobuf compiler, although I haven't found any documentation that says that I need that package installed.
$ sudo python3 -m pip install 'onnx>=1.1.2'
Collecting onnx>=1.1.2
Using cached onnx-1.6.0.tar.gz (3.1 MB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from onnx>=1.1.2) (1.18.3)
Requirement already satisfied: protobuf in /usr/lib/python3/dist-packages (from onnx>=1.1.2) (3.6.1)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from onnx>=1.1.2) (1.14.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /usr/local/lib/python3.8/dist-packages (from onnx>=1.1.2) (3.7.4.2)
Building wheels for collected packages: onnx
Building wheel for onnx (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-akurq0e8/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-akurq0e8/onnx/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-zmzgb0kg
cwd: /tmp/pip-install-akurq0e8/onnx/
Complete output (64 lines):
fatal: not a git repository (or any of the parent directories): .git
running bdist_wheel
running build
running build_py
running create_version
running cmake_build
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Generated: /tmp/pip-install-akurq0e8/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:248 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:279 (relative_protobuf_generate_cpp)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-akurq0e8/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 315, in <module>
setuptools.setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 223, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 209, in run
self.run_command('cmake_build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 195, in run
subprocess.check_call(cmake_args)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '-DPYTHON_INCLUDE_DIR=/usr/include/python3.8', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-38-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-install-akurq0e8/onnx']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for onnx
Running setup.py clean for onnx
Failed to build onnx
Installing collected packages: onnx
Running setup.py install for onnx ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-akurq0e8/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-akurq0e8/onnx/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-txzgh5wg/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/onnx
cwd: /tmp/pip-install-akurq0e8/onnx/
Complete output (52 lines):
fatal: not a git repository (or any of the parent directories): .git
running install
running build
running build_py
running create_version
running cmake_build
Generated: /tmp/pip-install-akurq0e8/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:248 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:279 (relative_protobuf_generate_cpp)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-akurq0e8/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 315, in <module>
setuptools.setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.8/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 209, in run
self.run_command('cmake_build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-akurq0e8/onnx/setup.py", line 195, in run
subprocess.check_call(cmake_args)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '-DPYTHON_INCLUDE_DIR=/usr/include/python3.8', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-38-x86_64-linux-gnu.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/tmp/pip-install-akurq0e8/onnx']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-akurq0e8/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-akurq0e8/onnx/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-txzgh5wg/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/onnx Check the logs for full command output.
Then I tried installing the protobuf compiler (sudo apt install protobuf-compiler) and now I get this other error, which seems to indicate that some script in the installation process requires a python binary. Since this is Ubuntu 20.04, no python 2.7 is installed and no python binary exists.
sudo pip3 install 'onnx>=1.1.2'
Collecting onnx>=1.1.2
Using cached onnx-1.6.0.tar.gz (3.1 MB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from onnx>=1.1.2) (1.18.3)
Requirement already satisfied: protobuf in /usr/lib/python3/dist-packages (from onnx>=1.1.2) (3.6.1)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from onnx>=1.1.2) (1.14.0)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /usr/local/lib/python3.8/dist-packages (from onnx>=1.1.2) (3.7.4.2)
Building wheels for collected packages: onnx
Building wheel for onnx (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t7al85w7/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t7al85w7/onnx/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-30aavuu6
cwd: /tmp/pip-install-t7al85w7/onnx/
Complete output (135 lines):
fatal: not a git repository (or any of the parent directories): .git
running bdist_wheel
running build
running build_py
running create_version
running cmake_build
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1")
Generated: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
Generated: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
CMake Warning at CMakeLists.txt:394 (find_package):
By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "pybind11",
but CMake did not find one.
Could not find a package configuration file provided by "pybind11"
(requested version 2.2) with any of the following names:
pybind11Config.cmake
pybind11-config.cmake
Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
"pybind11_DIR" to a directory containing one of the above files. If
"pybind11" provides a separate development package or SDK, be sure it has
been installed.
--
-- ******** Summary ********
-- CMake version : 3.16.3
-- CMake command : /usr/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 9.3.0
-- CXX flags : -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions :
-- CMAKE_PREFIX_PATH :
-- CMAKE_INSTALL_PREFIX : /usr/local
-- CMAKE_MODULE_PATH :
--
-- ONNX version : 1.6.0
-- ONNX NAMESPACE : onnx
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler : /usr/bin/protoc
-- Protobuf includes : /usr/include
-- Protobuf libraries : /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread
-- BUILD_ONNX_PYTHON : ON
-- Python version :
-- Python executable : /usr/bin/python3
-- Python includes : /usr/include/python3.8
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build
Scanning dependencies of target gen_onnx_proto
Scanning dependencies of target onnxifi_loader
Scanning dependencies of target onnxifi_dummy
[ 1%] Building C object CMakeFiles/onnxifi_dummy.dir/onnx/onnxifi_dummy.c.o
[ 3%] Building C object CMakeFiles/onnxifi_loader.dir/onnx/onnxifi_loader.c.o
[ 4%] Running gen_proto.py on onnx/onnx.in.proto
/tmp/pip-install-t7al85w7/onnx/onnx/onnxifi_dummy.c: In function ‘onnxGetExtensionFunctionAddress’:
/tmp/pip-install-t7al85w7/onnx/onnx/onnxifi_dummy.c:173:21: warning: assignment to ‘onnxExtensionFunctionPointer’ {aka ‘int (*)(void)’} from incompatible pointer type ‘onnxStatus (*)(void *, const char *, onnxStatus (**)(void))’ {aka ‘int (*)(void *, const char *, int (**)(void))’} [-Wincompatible-pointer-types]
173 | *function = &onnxGetExtensionFunctionAddress;
| ^
/tmp/pip-install-t7al85w7/onnx/onnx/onnxifi_dummy.c:176:21: warning: assignment to ‘onnxExtensionFunctionPointer’ {aka ‘int (*)(void)’} from incompatible pointer type ‘onnxStatus (*)(void *, uint32_t, const onnxTensorDescriptorV1 *, uint32_t, const onnxTensorDescriptorV1 *, onnxMemoryFenceV1 *)’ {aka ‘int (*)(void *, unsigned int, const struct onnxTensorDescriptorV1 *, unsigned int, const struct onnxTensorDescriptorV1 *, struct onnxMemoryFenceV1 *)’} [-Wincompatible-pointer-types]
176 | *function = &onnxSetIOAndRunGraph;
| ^
Processing /tmp/pip-install-t7al85w7/onnx/onnx/onnx.in.proto
Writing /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
Writing /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto3
generating /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx_pb.py
[ 6%] Running C++ protocol buffer compiler on /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
[ 8%] Linking C static library libonnxifi_loader.a
/usr/bin/env: ‘python’: No such file or directory
--mypy_out: protoc-gen-mypy: Plugin failed with status code 127.
make[2]: *** [CMakeFiles/gen_onnx_proto.dir/build.make:62: onnx/onnx-ml.pb.cc] Error 1
make[1]: *** [CMakeFiles/Makefile2:250: CMakeFiles/gen_onnx_proto.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 9%] Linking C shared library libonnxifi_dummy.so
[ 9%] Built target onnxifi_loader
[ 9%] Built target onnxifi_dummy
make: *** [Makefile:130: all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 315, in <module>
setuptools.setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 223, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 209, in run
self.run_command('cmake_build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 203, in run
subprocess.check_call(build_args)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', '.', '--', '-j', '12']' returned non-zero exit status 2.
----------------------------------------
ERROR: Failed building wheel for onnx
Running setup.py clean for onnx
Failed to build onnx
Installing collected packages: onnx
Running setup.py install for onnx ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t7al85w7/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t7al85w7/onnx/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-b60n_z7m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/onnx
cwd: /tmp/pip-install-t7al85w7/onnx/
Complete output (107 lines):
fatal: not a git repository (or any of the parent directories): .git
running install
running build
running build_py
running create_version
running cmake_build
Generated: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
Generated: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto
CMake Warning at CMakeLists.txt:394 (find_package):
By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "pybind11",
but CMake did not find one.
Could not find a package configuration file provided by "pybind11"
(requested version 2.2) with any of the following names:
pybind11Config.cmake
pybind11-config.cmake
Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
"pybind11_DIR" to a directory containing one of the above files. If
"pybind11" provides a separate development package or SDK, be sure it has
been installed.
--
-- ******** Summary ********
-- CMake version : 3.16.3
-- CMake command : /usr/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 9.3.0
-- CXX flags : -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions :
-- CMAKE_PREFIX_PATH :
-- CMAKE_INSTALL_PREFIX : /usr/local
-- CMAKE_MODULE_PATH :
--
-- ONNX version : 1.6.0
-- ONNX NAMESPACE : onnx
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler : /usr/bin/protoc
-- Protobuf includes : /usr/include
-- Protobuf libraries : /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread
-- BUILD_ONNX_PYTHON : ON
-- Python version :
-- Python executable : /usr/bin/python3
-- Python includes : /usr/include/python3.8
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build
[ 1%] Running C++ protocol buffer compiler on /tmp/pip-install-t7al85w7/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
[ 4%] Built target onnxifi_dummy
[ 8%] Built target onnxifi_loader
Scanning dependencies of target onnxifi_wrapper
/usr/bin/env: ‘python’: No such file or directory
--mypy_out: protoc-gen-mypy: Plugin failed with status code 127.
make[2]: *** [CMakeFiles/gen_onnx_proto.dir/build.make:62: onnx/onnx-ml.pb.cc] Error 1
make[1]: *** [CMakeFiles/Makefile2:250: CMakeFiles/gen_onnx_proto.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 9%] Building C object CMakeFiles/onnxifi_wrapper.dir/onnx/onnxifi_wrapper.c.o
[ 11%] Linking C shared module libonnxifi.so
[ 11%] Built target onnxifi_wrapper
make: *** [Makefile:130: all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 315, in <module>
setuptools.setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.8/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 209, in run
self.run_command('cmake_build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-t7al85w7/onnx/setup.py", line 203, in run
subprocess.check_call(build_args)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', '.', '--', '-j', '12']' returned non-zero exit status 2.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t7al85w7/onnx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t7al85w7/onnx/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-b60n_z7m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/onnx Check the logs for full command output.
To circumvent this issue a symbolic link can be made so that the python command actually runs python3.
In summary, to install onnx successfully in Ubuntu 20.04, you'll need to:
1) Install protobuf-compiler: sudo apt install protobuf-compiler
2) Make a link from python3 to python: sudo ln -s /usr/bin/python3 /usr/bin/python
Note: Maybe I missed another dependency, I already installed a bunch of other packages while installing the OpenVINO dependencies.
Just validated the tips from tgonzaleza on Ubuntu 18.04.
After this fix, below error was displayed:
Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Can be fixed with this:
sudo apt-get install libprotobuf-dev
In summary, to install onnx successfully in Ubuntu 20.04, you'll need to install this version of onnx
pip install onnx==1.4.1
goodluck

Caffe2 doesn't seem to see cuDNN?

I am trying to install SpConv (spatially sparse convolution library), however when running python3 setup.py bdist_wheel, I get an error which seems to be related to Caffe2 not being able to see cuDNN, as I infer from this message:
CMake Error at /home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:96 (message):
Your installed Caffe2 version uses cuDNN but I cannot find the cuDNN
libraries. Please set the proper cuDNN prefixes and / or install cuDNN.
I have tried reinstalling cuDNN but no luck. Can I manually point Caffe2 to cuDNN? This is because usually cuda is located in /usr/local/cuda/, however I have it in /usr/lib/cuda.
Full output below:
running bdist_wheel
running build
running build_py
running build_ext
Release
|||||CMAKE ARGS||||| ['-DCMAKE_PREFIX_PATH=/home/ivan/.local/lib/python3.6/site-packages/torch', '-DPYBIND11_PYTHON_VERSION=3.6', '-DSPCONV_BuildTests=OFF', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/mnt/home/ivan/second.pytorch/second/spconv/build/lib.linux-x86_64-3.6/spconv', '-DCMAKE_BUILD_TYPE=Release']
-- Caffe2: CUDA detected: 9.1
-- Caffe2: CUDA nvcc is: /usr/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr
-- Caffe2: Header version is: 9.1
-- Could NOT find CUDNN (missing: CUDNN_INCLUDE_DIR)
CMake Warning at /home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:131 (message):
Caffe2: Cannot find cuDNN library. Turning the option off
Call Stack (most recent call first):
/home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
/home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:20 (find_package)
-- Autodetected CUDA architecture(s): 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
CMake Error at /home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:96 (message):
Your installed Caffe2 version uses cuDNN but I cannot find the cuDNN
libraries. Please set the proper cuDNN prefixes and / or install cuDNN.
Call Stack (most recent call first):
/home/ivan/.local/lib/python3.6/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:20 (find_package)
-- Configuring incomplete, errors occurred!
See also "/mnt/home/ivan/second.pytorch/second/spconv/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
See also "/mnt/home/ivan/second.pytorch/second/spconv/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "setup.py", line 99, in <module>
zip_safe=False,
File "/home/ivan/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 204, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 40, in run
self.build_extension(ext)
File "setup.py", line 82, in build_extension
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/mnt/home/ivan/second.pytorch/second/spconv', '-DCMAKE_PREFIX_PATH=/home/ivan/.local/lib/python3.6/site-packages/torch', '-DPYBIND11_PYTHON_VERSION=3.6', '-DSPCONV_BuildTests=OFF', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/mnt/home/ivan/second.pytorch/second/spconv/build/lib.linux-x86_64-3.6/spconv', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
System: Ubuntu 18.04, CUDA 9.1, cuDNN 7.6.3
Found the problem. I needed to set CUDNN_INCLUDE_DIR to /usr/lib/cuda/include (i.e. where the cudnn.h file is located).
Lesson learnt: take time to understand the error, missing: CUDNN_INCLUDE_DIR was key.
Another way to fix this:
Acquire cuDNN from here. You may have to register to do this, but the registration is free.
Unpack the cuDNN archive file.
Move the cuDNN files as follows:
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
Alternately, place a symoblic link at /usr/local/ pointing to the cuda directory produced by unpacking the cuDNN archive.

Dlib installation error? [duplicate]

This question already has answers here:
dlib installation on Windows 10
(19 answers)
Closed 3 years ago.
Visual studio 2015 is not installed
I have installed all the requirements before building dlib in python:
Cmake
python 3.6 and other bindings.
while installing dlib using pip:
pip install dlib
Got an error:
Collecting dlib
Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command "c:\users\vikas tiwari\anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\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 C:\Users\VIKAST~1\AppData\Local\Temp\pip-wheel-nnayeybw --python-tag cp36:
running bdist_wheel
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\users\vikas tiwari\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version to target Windows 10.0.17134.
CMake Error in CMakeLists.txt:
Failed to run MSBuild command:
C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 8/7/2018 1:07:47 PM.
Project "C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Done Building Project "C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.03
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/Vikas Tiwari/AppData/Local/Temp/pip-install-4f4b8868/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\vikas tiwari\anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\vikas tiwari\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
self.run_command('build')
File "c:\users\vikas tiwari\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\vikas tiwari\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\vikas tiwari\anaconda3\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\vikas tiwari\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command "c:\users\vikas tiwari\anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\VIKAST~1\AppData\Local\Temp\pip-record-aol24hcc\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\users\vikas tiwari\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version to target Windows 10.0.17134.
CMake Error in CMakeLists.txt:
Failed to run MSBuild command:
C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 8/7/2018 1:07:50 PM.
Project "C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Done Building Project "C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Users\Vikas Tiwari\AppData\Local\Temp\pip-install-4f4b8868\dlib\build\temp.win-amd64-3.6\Release\CMakeFiles\3.12.0\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.03
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/Vikas Tiwari/AppData/Local/Temp/pip-install-4f4b8868/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\vikas tiwari\anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\vikas tiwari\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\vikas tiwari\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\vikas tiwari\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vikas tiwari\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\vikas tiwari\anaconda3\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\vikas tiwari\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Command ""c:\users\vikas tiwari\anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VIKAST~1\\AppData\\Local\\Temp\\pip-install-4f4b8868\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\VIKAST~1\AppData\Local\Temp\pip-record-aol24hcc\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\VIKAST~1\AppData\Local\Temp\pip-install-4f4b8868\dlib\
I really don't have any idea what's the real issue here. Do i have to install Visual Studio to compile c++ files of dlib ?
Don't have VS 2015 installed right now!!
Here is how I solved the same issue.
Make sure you have installed cmake and CMAKE_FOLDER\bin added it in environment varaible
Install anaconda
then run following commands in anaconda shell.
conda update conda
conda update anaconda
create new environment conda create -n env_dlib python=3.6
activate enviroment conda activate env_dlib
install dlib conda install -c conda-forge dlib
Verify your installation in python shell using
import dlib
dlib.__version__
Forget Everything and try the method to install dlib and/or opencv here from scratch.
It's a very simple 3 step method
Install anaconda
Activate virtual enviroment using cmd
Install dlib and opencv using pip through cmd.
You can connect to this thread as well.
Here you go :
Download CMake from cmake and add it to PATH(C:\Program Files\CMake\bin)
Install dlib using pip(pip install dlib==19.4)

Error installing dlib in windows 10

I can't seem to install dlib on my windows 10 machine using pip.
I am using python 3.6.1
i did try pip installing dlib using the following commands
pip install dlib
but it returns me with the following error.
Collecting dlib
Using cached dlib-19.10.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command c:\users\ayush\appdata\local\programs\python \python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ayush\\AppData\\Local\\Temp\\pip-build-iu6_cvvs\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Ayush\AppData\Local\Temp\pip-uhnfkgpd-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Invoking CMake setup: 'cmake C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\build\lib.win32-3.6 -DPYTHON_EXECUTABLE=c:\users\ayush\appdata\local\programs\python\python36-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\build\lib.win32-3.6'
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Ayush/AppData/Local/Temp/pip-build-iu6_cvvs/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Ayush/AppData/Local/Temp/pip-build-iu6_cvvs/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\setup.py", line 249, in <module>
'Topic :: Software Development',
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\setup.py", line 129, in run
self.build_extension(ext)
File "C:\Users\Ayush\AppData\Local\Temp\pip-build-iu6_cvvs\dlib\setup.py", line 163, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\ayush\appdata\local\programs\python\python36-32\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Ayush\\AppData\\Local\\Temp\\pip-build-iu6_cvvs\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Ayush\\AppData\\Local\\Temp\\pip-build-iu6_cvvs\\dlib\\build\\lib.win32-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\ayush\\appdata\\local\\programs\\python\\python36-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Ayush\\AppData\\Local\\Temp\\pip-build-iu6_cvvs\\dlib\\build\\lib.win32-3.6']' returned non-zero exit status 1.
i have Cmake installed and i also tried setting a environmental variable path to the Cmake library but the same error occurs.

Installing cython on windows 7, python 3.4.3 with pip

I try to install cython on windows 7 64bit ( Python 3.4.3 ) via
pip install cython
and ends with the error message
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
Which I find kinda strange since I have visual studio community 2013 installed.
When I ask windows where vcvarsall.bat is it kindly answers me
C:\Users\me>where vcvarsall.bat
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
So it is in my path. Do I need a different visual studio version and with that a different version of vcvarsall.bat?
Edit 1
I downloaded the VS2010 ISO SonicARG provided. Thank you.
Now cython acknowledges the compiler, but still fails to install.
pip install cython
Running setup.py install for cython
Complete output from command C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\me\\AppData\\Local\\Temp\\pip-build-12j3y7gp\\cython\\setup.py';exec(compile(getattr(t
okenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\me\AppData\Local\Temp\pip-lgya62cy-record\install-record.txt --single-version-external
ly-managed --compile:
Unable to find pgen, not compiling formal grammar.
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.4
copying cython.py -> build\lib.win-amd64-3.4
creating build\lib.win-amd64-3.4\Cython
copying Cython\CodeWriter.py -> build\lib.win-amd64-3.4\Cython
[Many lines of copying and creating]
copying Cython\Debugger\Tests\cfuncs.c -> build\lib.win-amd64-3.4\Cython\Debugger\Tests
running build_ext
cythoning C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\Cython\Plex\Scanners.py to C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\Cython\Plex\Scanners.c
building 'Cython.Plex.Scanners' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\setup.py", line 357, in <module>
**setup_args
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Python34\lib\distutils\command\install.py", line 539, in run
self.run_command('build')
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\distutils\command\build.py", line 126, in run
self.run_command(cmd_name)
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\Cython\Distutils\build_ext.py", line 164, in run
_build_ext.build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\setup.py", line 192, in build_extensions
build_ext_orig.build_extensions(self)
File "C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython\Cython\Distutils\build_ext.py", line 172, in build_extensions
self.build_extension(ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\site-packages\setuptools\msvc9_support.py", line 52, in query_vcvarsall
return unpatched['query_vcvarsall'](version, *args, **kwargs)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
----------------------------------------
Command "C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\me\\AppData\\Local\\Temp\\pip-build-12j3y7gp\\cython\\setup.py';exec(compile(getattr(tokenize, 'open', open)(_
_file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\me\AppData\Local\Temp\pip-lgya62cy-record\install-record.txt --single-version-externally-managed --compile" fa
iled with error code 1 in C:\Users\me\AppData\Local\Temp\pip-build-12j3y7gp\cython
Python 3.4 is built against Microsoft's Visual Studio 2010; in order to build native modules you must use the exact version. You can just download the Express Edition to build them, the entire IDE is not necessary. You can fetch the VS2010 ISO from here, and install the C++ component, then try again.
Note for future: If you plan to upgrade Python to 3.5 (release date is September 13, 2015), the Visual Studio version will be 2015, so you can be ready if you have the save problem

Resources