installing spaCy with pip failed with error "Failed building wheel for blis" - pip

Tried to install spaCy with pip (version 20.0.2)
but got error like bellow
gcc -c /tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmpu1wg8fg1/bli_amaxv_zen_int.o -O3 -mavx2 -mfma -mfpmath=sse -march=core-avx2 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-f2b27qwm/blis/blis/_src/include/linux-x86_64
gcc: error: unrecognized command line option '-mavx2'
gcc: error: unrecognized command line option '-mfma'
gcc: error: unrecognized command line option '-mfpmath=sse'
gcc: error: unrecognized command line option '-march=core-avx2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 277, in <module>
"Topic :: Scientific/Engineering",
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
self.run_command('build')
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 103, in build_extensions
objects = self.compile_objects(compiler.split("-")[0], arch, OBJ_DIR)
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 188, in compile_objects
objects.append(self.build_object(env=env, **spec))
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 201, in build_object
subprocess.check_call(command, cwd=BLIS_DIR)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['gcc', '-c', '/tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c', '-o', '/tmp/tmpu1wg8fg1/bli_amaxv_zen_int.o', '-O3', '-mavx2', '-mfma', '-mfpmath=sse', '-march=core-avx2', '-fPIC', '-std=c99', '-D_POSIX_C_SOURCE=200112L', '-DBLIS_VERSION_STRING="0.5.1"', '-DBLIS_IS_BUILDING_LIBRARY', '-Iinclude/linux-x86_64', '-I./frame/3/', '-I./frame/ind/ukernels/', '-I./frame/1m/', '-I./frame/1f/', '-I./frame/1/', '-I./frame/include', '-I/tmp/pip-install-f2b27qwm/blis/blis/_src/include/linux-x86_64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for blis
Running setup.py clean for blis
Failed to build numpy blis
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: /home/{user_name}/.conda/envs/ncn/bin/python /home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3j47_tuc/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython>=0.25' 'thinc<7.4.0,>=7.3.0' 'preshed<3.1.0,>=3.0.2' 'murmurhash<1.1.0,>=0.28.0' wheel 'cymem<2.1.0,>=2.0.2' Check the logs for full command output.
it seems there are numpy problem
but i already installed numpy(1.16.5) while installing pytorch(1.12.0)
some stackoverflow solutions did not solve the problem
(Python Cannot install module spaCy)
(Failed building wheel for spacy)
because my machine runs on ppc64le, IBM watson machine.
so there are no wheel for my machine.
several packages are available (https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/)
but spaCy is not one of them.
What should I do for installing spaCy?

You may install version 2.2.1 of spacy compiled for ppc64le in the powerai supplementary channel that was recently added.
conda install -c powerai spacy
You may also git clone https://github.com/IBM/powerai and modify https://github.com/IBM/powerai/blob/master/conda-recipes/spacy-feedstock/recipe/meta.yaml#L2-L3 to be version 2.1.6 and then conda-build the package yourself if you want that specific version. (You would then run conda-build from the conda-recipes/spacy-feedstock directory to generate the conda package)

It looks like the package is trying to build code using x86 specific flags: -mavx, flags that use SSE, etc. You should contact the package authors about this: they will need to change their package to not use those flags on platforms other than x86.

Related

Visual Studio 2019 with C++ has been installed but CMake can't find it

Visual Studio 2019 has been installed in my windows. I have coded c++ with it, and it doesn't have any problem with the compiler.
The compiler, cl.exe, exists in this directory:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64
When I wanted to install dlib using pip, CMake couldn't compile it.
pip install dlib ─╯
Collecting dlib
Using cached dlib-19.22.1.tar.gz (7.4 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\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\ali entezari\AppData\Local\Temp\pip-wheel-cc19gyz4'
cwd: C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=D:\Anaconda\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 222, in <module>
setup(
File "D:\Anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "D:\Anaconda\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "D:\Anaconda\anaconda3\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=D:\\Anaconda\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
I've checked my environment variable path; VS2019INSTALLDIR was there.
VS2019INSTALLDIR
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
I had this problem with compiling Mozilla Firefox before, and I couldn't solve it. I will be appreciated if anyone could help me to get rid of this problem. Sorry for English, I'm not a native speaker :).
I had the same problem. It was probably related to the plugins and extensions you have installed. My issue was not resolved until I reinstalled Visual Studio. Try to install it again.

trouble installing dlib with pip

I tried downloading dlib with pip and here's what I got instead:
Building wheel for dlib (setup.py) ... error
> ERROR: Command errored out with exit status 1: command: 'c:\program
> files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools,
> tokenize; sys.argv[0] =
> '"'"'C:\\Users\\kiddr\\AppData\\Local\\Temp\\pip-install-6dc0zubd\\dlib\\setup.py'"'"';
> __file__='"'"'C:\\Users\\kiddr\\AppData\\Local\\Temp\\pip-install-6dc0zubd\\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\kiddr\AppData\Local\Temp\pip-wheel-f242luxg'
> cwd: C:\Users\kiddr\AppData\Local\Temp\pip-install-6dc0zubd\dlib\
> Complete output (53 lines): running bdist_wheel running build
> running build_py package init file 'tools\python\dlib\__init__.py'
> not found (or not a regular file) running build_ext Traceback
> (most recent call last):
> File "C:\Users\kiddr\AppData\Local\Temp\pip-install-6dc0zubd\dlib\setup.py",
> line 120, in get_cmake_version
> out = subprocess.check_output(['cmake', '--version'])
> File "c:\program files (x86)\python38-32\lib\subprocess.py", line 411, in check_output
> return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
> File "c:\program files (x86)\python38-32\lib\subprocess.py", line 489, in run
> with Popen(*popenargs, **kwargs) as process:
> File "c:\program files (x86)\python38-32\lib\subprocess.py", line 854, in __init__
> self._execute_child(args, executable, preexec_fn, close_fds,
> File "c:\program files (x86)\python38-32\lib\subprocess.py", line 1307, in _execute_child
> hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file
> specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\kiddr\AppData\Local\Temp\pip-install-6dc0zubd\dlib\setup.py", line 223, in <module>
setup(
File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\program files (x86)\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\kiddr\AppData\Roaming\Python\Python38\site-packages\wheel\bdist_wheel.py", line 290, in run
self.run_command('build')
File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files (x86)\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\kiddr\AppData\Local\Temp\pip-install-6dc0zubd\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\kiddr\AppData\Local\Temp\pip-install-6dc0zubd\dlib\setup.py", line 122, in get_cmake_version
raise RuntimeError("\n*******************************************************************\n" +
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: _dlib_pybind11
*******************************************************************
----------------------------------------
ERROR: Failed building wheel for dlib
Which is weird, because I did install CMake and even restarted my pc. I also added the path to site-packages into my PATH environment. I also already made sure that the pip was upgraded to the latest version, and tried manually downloading the zip version from github and installing it by unpacking the file and running setup.py as administrator. I ran into the exact same error code though.
Can anyone help please? Thank you so much in advance!
1.use python 3.6.9 version
2.first install cmake.
conda install -c anaconda cmake
use these command to install dlib
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f

Issue with installation of dlib

I am trying to install dlib with
pip install dlib
and I ma getting this error message . Any advice on how to help solve this issue ;
C:\Users\xxxxx>pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\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\xxxxx\AppData\Local\Temp\tmp97einqqvpip-wheel- --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.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\xxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\xxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/xxxxx/AppData/Local/Temp/pip-build-z3ahr2ci/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\xxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\xxxx\AppData\Roaming\Python\Python36\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxx\AppData\Roaming\Python\Python36\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=C:\\ProgramData\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\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:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\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\wb421558\AppData\Local\Temp\pip-98zm2ie0-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
Building extension for Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\xxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/xxxx/AppData/Local/Temp/pip-build-z3ahr2ci/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\xxxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\xxxx\AppData\Roaming\Python\Python36\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxx\AppData\Roaming\Python\Python36\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\xxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\xxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=C:\\ProgramData\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\xxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Command "C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-build-z3ahr2ci\\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\xxxxx\AppData\Local\Temp\pip-98zm2ie0-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\xxxxx\AppData\Local\Temp\pip-build-z3ahr2ci\dlib\
install visual studio with Visual C++ tools for CMake and then try to run it again.
If you are not developing in C++, you would need a redistributable for the language installed on your PC.
You do not have to install the whole Visual Studio for this. Just download a build tool for the 64bit arch from the following link and install it. Microsoft Visual Studio 2019 Build Tool
Try running the dlib installation after that and it should work

Cython not able to compile

I am trying to compile following trivial code with Cython on Windows7 (64bit) and WinPython:
File testpy.py:
print("hello world from testpy.py file.")
File compile.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("testpy", ["testpy.py"]),
# ... all your modules that need be compiled ...
]
setup(
name = 'My Program Name',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
I first give command to use mingw:
D:\myfolder> make_cython_use_mingw
cython has been set to use mingw32
to remove this, remove file "E:\WinPython\settings\pydistutils.cfg"
I then give command to compile:
D:\myfolder> python compile.py build_ext --inplace
The process starts but ends with following error:
running build_ext
skipping 'testpy.c' Cython extension (up-to-date)
building 'testpy' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IE:\WinPython\python-3.6.5.amd64\include -IE:\WinPython\python-3.6.5.amd64\include -c testpy.c -o build
\temp.win-amd64-3.6\Release\testpy.o
In file included from E:\WinPython\python-3.6.5.amd64\include/Python.h:68:0,
from testpy.c:4:
E:\WinPython\python-3.6.5.amd64\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outsid
e of this definition or declaration
struct timeval *tv,
^~~~~~~
E:\WinPython\python-3.6.5.amd64\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outsid
e of this definition or declaration
struct timeval *tv,
^~~~~~~
writing build\temp.win-amd64-3.6\Release\testpy.cp36-win_amd64.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.6\Release\testpy.o build\temp.win-amd64-3.6\Release\testpy.cp36-win_amd64.def -LE:\Wi
nPython\python-3.6.5.amd64\libs -LE:\WinPython\python-3.6.5.amd64\PCbuild\amd64 -lpython36 -o D:\myfolder\testpy.cp36-win_amd64.pyd
Cannot export PyInit_testpy: symbol not defined
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Where is the problem and how can it be solved?
Edit:
On renaming py file as pyx as suggested by #ead in comments, it worked to create pyd file. However, on trying it gives following error:
D:\Myfolder>python -c "import Testpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Why is this not a valid Win32 application?
My python version is as follows:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Edit: I found that I had mingw installed separately also (apart from part of winpython). I removed that and tried again. I am now getting following error:
python compile.py build_ext --inplace
Traceback (most recent call last):
File "compile.py", line 12, in <module>
ext_modules = ext_modules
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "E:\WinPython\python-3.6.5.amd64\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\command\build_ext.py", line 308, in run
force=self.force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\ccompiler.py", line 1031, in new_compiler
return klass(None, dry_run, force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\cygwinccompiler.py", line 282, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\cygwinccompiler.py", line 126, in __init__
if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'
How can this be corrected?

pycrypto on Ubuntu giving compiler error

I am trying to install pycrypto2.6 on Ubuntu 10.04 (Lucid Lynx) with Python 2.7.3.
I am encountering the following error:
running build
running build_py
running build_ext
running build_configure
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/pratibha/Desktop/pycrypto-2.6':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Traceback (most recent call last):
File "setup.py", line 456, in <module>
core.setup(**kw)
File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 251, in run
self.run_command(cmd_name)
File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
I checked Software Centre, and I have GCC installed on my system, but the "which gcc" command is not returning any path.
I got it by creating the symbolic link:
ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
I had a similar problem, but in my case it turns out I didn't have gcc installed at all.
So a simple sudo apt-get install gcc did the trick.
If you have it installed, but which gcc doesn't return any path, then go to /usr/bin/ and look for gcc. Then create a symbolic link, like so:
ln -s /usr/bin/gcc-<version-number> /usr/bin/gcc
where you replaced <version-number> with the appropriate version number, of course.
I ran into a similar error message when installing pycrypto on a shared host (Webfaction). The solution was to change the temporary directory while installing:
TMPDIR=~/tmp pip install pycrypto
I was having the same problem, and trying the above step of installing gcc did not help.
Once I installed the python-dev package, everything compiled perfectly.
sudo apt-get install python-dev

Resources