Using python3.8.1, installing newest version, on Windows 10:
pip install PyNaCl gives me this error (last 10 lines):
File "C:\Program Files (x86)\Python3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files (x86)\Python3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "setup.py", line 161, in run
raise Exception("ERROR: The 'make' utility is missing from PATH")
Exception: ERROR: The 'make' utility is missing from PATH
----------------------------------------
Failed building wheel for PyNaCl
Running setup.py clean for PyNaCl
Failed to build PyNaCl
Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly
It seems to be related to wheels, so i tried to install it with no-binary, which also failed:
File "C:\Program Files (x86)\Python3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Administrator\AppData\Local\Temp\pip-install-q0db5s_n\PyNaCl\setup.py", line 161, in run
raise Exception("ERROR: The 'make' utility is missing from PATH")
Exception: ERROR: The 'make' utility is missing from PATH
----------------------------------------
Command "C:\Users\Administrator\Documents\DiscordBot\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-q0db5s_n\\PyNaCl\\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\Administrator\AppData\Local\Temp\pip-record-s27dvlrv\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Administrator\Documents\DiscordBot\venv\include\site\python3.8\PyNaCl" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pip-install-q0db5s_n\PyNaCl\
EDIT: This only seems to be an issue in my venv (made by Pycharm) - i have no clue what the issue is, both setuptools and wheel are installed.
I ultimately solved it by using python -m pip install --no-use-pep517 pynacl
Upgrading pip within the venv worked for me:
.\env\Scripts\activate
pip install -U pip
pip install -r requirements.txt
deactivate
Related
I'm trying to install dlib. I followed every single tip on the internet but its just not working.
I'm using/tried
windows 10
cmake 3.21.4 (it's on path)
python 3.8.12 and 3.6.4
conda 4.10.3
pip 21.3.1
visual studio 2019
components in vs (1)
components in vs (2)
I have conda and pip installed, tried both with
pip install dlib
pip install dlib --verbose
pip install "some urls"
conda install -c conda-forge dlib
conda install -c conda-forge/label/cf201901 dlib
The error I'm getting is:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 222, in <module>
setup(
File "c:\users\sophi\anaconda3\lib\site-packages\setuptools\__init__.py", line 159, in setup
return distutils.core.setup(**attrs)
File "c:\users\sophi\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\sophi\anaconda3\lib\site-packages\setuptools\command\install.py", line 68, in run
return orig.install.run(self)
File "c:\users\sophi\anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\sophi\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\sophi\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\sophi\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 174, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "c:\users\sophi\anaconda3\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1: 'c:\users\sophi\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sophi\\AppData\\Local\\Temp\\pip-install-3w7lgrlb\\dlib_ffabe5e6a08e472b835f598e7803e3d4\\setup.py'"'"'; __file__='"'"'C:\\Users\\sophi\\AppData\\Local\\Temp\\pip-install-3w7lgrlb\\dlib_ffabe5e6a08e472b835f598e7803e3d4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\sophi\AppData\Local\Temp\pip-record-kvd3vwdq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\sophi\anaconda3\Include\dlib' Check the logs for full command output.
For me, it seems like the problem is somethin with the cmake command, but I have no idea what the exact problem is. I used pip install cmake and installed cmake from source, none of both worked.
Has anyone an idea how to solve this?
This may be late response but I was facing the exact same issue when trying to install dlib on visual studio code. This was my error I was receiving when trying to run the command "pip install dlib"
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
ERROR: CMake must be installed to build dlib
[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.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
So my next approach was to install cmake which where the installation worked however I receive a warning that the file path to the exe was not added to my path. This resulted when running "cmake --version" to outputted in terminal
'cmake' is not recognized as an internal or external command,
operable program or batch file.
I would suspected to not run correctly, and to fix this I simply copy the path that it had printed out to my terminal after install cmake and went to
Advance System Settings -> Advanced Tab -> Environment Variables -> User Variables for 'your desktop name' open up "Path" -> click on new -> paste path
After following those steps running the command "cmake --version" correctly printed out the version install, meaning it is accessing the correct path. After that "pip install dlib" worked perfectly as proof below
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... done
Successfully installed dlib-19.23.1
I hope this may help as it is one approach that worked for me in installing dlib. As you mention your cmake is on path I would check by running the command to see if the version is correctly printing out.
Althoug trying to test every combination of the commands mentioned in my question, there apparently was one combination I didn't try:
Conda environment with python 3.6.4 and then
conda install -c conda-forge dlib
Not able to install dlib on Windows 10 and Python 3.7
As Berkay is mentioning, anaconda apparently requires python <=3.6.x, which solved it for me.
! pip install dlib would not work in this environment (probably because of another version problem with this environment) !
I am using python3.6 and have installed dlib using its wheel file dlib-19.8.1-cp36-cp36m-win_amd64.whl on windows 10 x64. This wheel file installed dlib but the version installed is 19.8.1. I want to upgrade it to 19.20 which is the latest version. To do this, I am using upgrade command python -m pip install dlib --upgrade but this gives me below error:
Collecting dlib
Using cached dlib-19.20.0.tar.gz (3.2 MB)
Using legacy setup.py install for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Attempting uninstall: dlib
Found existing installation: dlib 19.8.1
Uninstalling dlib-19.8.1:
Successfully uninstalled dlib-19.8.1
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\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\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib'
cwd: C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\
Complete output (55 lines):
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 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\python3.6\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:3 (project):
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/AbhinavRawat/AppData/Local/Temp/pip-install-erx7t440/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\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\python3.6\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python3.6\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python3.6\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\python3.6\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python3.6\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\python3.6\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\python3.6\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Rolling back uninstall of dlib
Moving to c:\python3.6\lib\site-packages\dlib-19.8.1.dist-info\
from c:\python3.6\lib\site-packages\~lib-19.8.1.dist-info
Moving to c:\python3.6\lib\site-packages\dlib\
from c:\python3.6\lib\site-packages\~lib
ERROR: Command errored out with exit status 1: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\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\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib' Check the logs for full command output.
Can anyone please help me here. Thanks
pip install dlib==19.8.1 it should install this version
Sorry I am new to all this.
I can't install dlib inside pipenv virtual environment, however, I able to install and import it outside pipenv virtual env.
When I navigate to the folder containing my code and type pipenv shell and then python3 example.py which is the code I want to run, I get this error:
import dlib
ModuleNotFoundError: No module named 'dlib'
Then I tried to install dlib using these commands:
$ sudo apt-get update
$ sudo apt-get install build-essential cmake
$ sudo apt-get install libopenblas-dev liblapack-dev
$ sudo apt-get install libx11-dev libgtk-3-dev
$ sudo apt-get install python python-dev python-pip
$ sudo apt-get install python3 python3-dev python3-pip
$ pip3 install dlib
everything worked fine except the last command, here is the output I am getting, in red:
$ pip3 install dlib
Collecting dlib
Using cached dlib-19.19.0.tar.gz (3.2 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/bin/python3.5m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-24bjeekz/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-24bjeekz/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 /tmp/pip-wheel-3n4hx6v_
cwd: /tmp/pip-install-24bjeekz/dlib/
Complete output (292 lines):
running bdist_wheel
running build
running build_py
package init file 'dlib/__init__.py' not found (or not a regular file)
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
Building extension for Python 3.5.9 (default, Nov 24 2019, 01:35:13)
Invoking CMake setup: 'cmake /tmp/pip-install-24bjeekz/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-24bjeekz/dlib/build/lib.linux-x86_64-3.5 -DPYTHON_EXECUTABLE=/home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/bin/python3.5m -DCMAKE_BUILD_TYPE=Release'
/tmp/pip-install-24bjeekz/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:134: recipe for target 'CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_python.dir/all' failed
make[1]: *** [CMakeFiles/dlib_python.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-24bjeekz/dlib/setup.py", line 261, in <module>
'Topic :: Software Development',
File "/home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/lib/python3.5/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/lib/python3.5/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
self.run_command('build')
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.5/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-24bjeekz/dlib/setup.py", line 135, in run
self.build_extension(ext)
File "/tmp/pip-install-24bjeekz/dlib/setup.py", line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "/usr/lib/python3.5/subprocess.py", line 271, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j4']' returned non-zero exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: /home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/bin/python3.5m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-24bjeekz/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-24bjeekz/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 /tmp/pip-record-ifngrgm8/install-record.txt --single-version-externally-managed --compile --install-headers /home/hany/.local/share/virtualenvs/vesselware-rtITNVcC/include/site/python3.5/dlib Check the logs for full command output.
When I tried doing the same thing outside the virtual env, everything worked fine.
I am out of ideas, I very much appreciate your advice.
Edit 1
I tried installing dlib within the pipenv virtual environment using conda, here is the result:
Launching subshell in virtual environment…
. /home/hano/.local/share/virtualenvs/vesselware-rtITNVcC/bin/activate
hano#hano-asus:~/scripts/vesselware$ . /home/hano/.local/share/virtualenvs/vesselware-rtITNVcC/bin/activate
(vesselware) hano#hano-asus:~/scripts/vesselware$ conda install -c menpo dlib
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- dlib -> python[version='2.7.*|3.5.*|>=3.5,<3.6.0a0']
- dlib -> python[version='>=2.7,<2.8.0a0']
Your python: python=3.7
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with each other:
Package certifi conflicts for:
python=3.7 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
dlib -> python=3.5 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
Package wheel conflicts for:
dlib -> python=3.5 -> pip -> wheel
python=3.7 -> pip -> wheel
Package pip conflicts for:
dlib -> python=3.5 -> pip
python=3.7 -> pip
Package ca-certificates conflicts for:
python=3.7 -> openssl[version='>=1.1.1a,<1.1.2a'] -> ca-certificates
dlib -> python=3.5 -> ca-certificates
Package setuptools conflicts for:
python=3.7 -> pip -> setuptools
dlib -> python=3.5 -> pip -> setuptools
Edit 2
I made sure that pipenv uses python 3.5 (as you can see in the pip3 error above), but I still can't install dlib neither by pip3 nor by conda. And the strange thing is that conda error tells me Your python: python=3.7 while pip3 error states clearly that I am using python 3.5:Building extension for Python 3.5.9
Please advice.
Try the following:
conda create --name python3_5 python=3.5
conda activate python3_5
conda install -c menpo dlib
I am trying to install PyTorch but every time it throws the same error ( ModuleNotFoundError: No module named ‘tools.nnwrap’).
This is what is typed: pip install torch
This is what I get every time:
Collecting torch
Using cached https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz
Requirement already satisfied: pyyaml in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from torch) (5.1.2)
Installing collected packages: torch
Running setup.py install for torch … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\user\appdata\local\programs\python\python37-32\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\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\User\AppData\Local\Temp\pip-record-b_c49sh\install-record.txt’ --single-version-externally-managed --compile
cwd: C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch
Complete output (23 lines):
running install
running build_deps
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 265, in
description=“Tensors and Dynamic neural networks in Python with strong GPU acceleration”,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\setuptools_init.py", line 145, in setup
return distutils.core.setup(**attrs)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\core.py”, line 148, in setup
dist.run_commands()
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 966, in run_commands
self.run_command(cmd)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command
cmd_obj.run()
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 99, in run
self.run_command(‘build_deps’)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command
cmd_obj.run()
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named ‘tools.nnwrap’
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\users\user\appdata\local\programs\python\python37-32\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\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\User\AppData\Local\Temp\pip-record-_b_c49sh\install-record.txt’ --single-version-externally-managed --compile Check the logs for full command output.
Do anyone knows how to fix this error!!
# for OS: Windows, package: pip, Language: python3.6 (below command is valid for only mentioned python 3.6)
pip3 install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp36-cp36m-win_amd64.whl
pip3 install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp36-cp36m-win_amd64.whl
For another version/type of the software (OS, package, Language) installed, the command must be generated from the below-mentioned link: https://pytorch.org/get-started/locally/
It is recommended to directly get the desired URL that matches system configuration from the Pytorch website-https://pytorch.org/get-started/locally/
Select the options that meet your system config and using anaconda pip install the url
Try to paste the command
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
in the Anaconda Prompt. Worked for me.
I have already installed CMake by pip install cmake and tried to install face_recognition but it still gives me a RuntimeError. I'm using 'Python 3.7.3, x32'
I also tried to install the dlib by pip install dlib since it is one of the reasons why I can't install face_recognition.
C:\Users\user>python -m pip install cmake
Requirement already satisfied: cmake in c:\users\user\appdata\roaming\python\python37\site-packages (3.14.4)
C:\Users\user>python -m pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Complete output from command 'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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\user\AppData\Local\Temp\pip-record-yf2kdjpx\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "C:\Python\Python37\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "C:\Python\Python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
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\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Python\Python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Python\Python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Python\Python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 125, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
----------------------------------------
ERROR: Command "'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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\user\AppData\Local\Temp\pip-record-yf2kdjpx\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\
Download and install dlib wheel from here
Then pip install face_recognition
pip install cmake
In visual studio, Individual Components
tab,Visual C++ tools for Cmake checkbox under Compilers,build tools
and runtimes Section
On Visual Studio Command prompt run, pip install face_recognition
Source
What works for is ...
After getting lots of Red Errors, I run following
conda install -c conda-forge dlib
pip install cmake
pip install face_recognition
Even the error says me to reinstall VS Code for c++. but above sequential installation works.
Python version was 3.8
Try install dlib using conda
conda install -c conda-forge dlib
For me, non of the solutions didn't work. Then, I downloaded all libraries in face_recognition package manually (like "pip install dlib==19.7", "pip install Click". At last, I installed face recognition with this command "pip install --no-deps face_recognition"