-1

I am working with python 3.8.6 but for some reason it cant build a wheel for netifaces

error:

C:\Users\cuerv>pip install --upgrade netifaces Collecting netifaces Using cached netifaces-0.10.9.tar.gz (28 kB) Building wheels for collected packages: netifaces Building wheel for netifaces (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'c:\users\cuerv\downloads\my code\imports\python 3.8.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\setup.py'"'"'; file='"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\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\cuerv\AppData\Local\Temp\pip-wheel-qxm_uil5' cwd: C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17
Complete output (5 lines): running bdist_wheel running build running build_ext building 'netifaces' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

ERROR: Failed building wheel for netifaces Running setup.py clean for netifaces Failed to build netifaces Installing collected packages: netifaces Running setup.py install for netifaces ... error ERROR: Command errored out with exit status 1: command: 'c:\users\cuerv\downloads\my code\imports\python 3.8.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\setup.py'"'"'; file='"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\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\cuerv\AppData\Local\Temp\pip-record-b4lmtpzg\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\cuerv\downloads\my code\imports\python 3.8.6\Include\netifaces' cwd: C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17
Complete output (5 lines): running install running build running build_ext building 'netifaces' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\cuerv\downloads\my code\imports\python 3.8.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\setup.py'"'"'; file='"'"'C:\Users\cuerv\AppData\Local\Temp\pip-install-femvpx3w\netifaces_673ef3fc78424548962ff6e3f9ac8b17\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\cuerv\AppData\Local\Temp\pip-record-b4lmtpzg\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\cuerv\downloads\my code\imports\python 3.8.6\Include\netifaces' Check the logs for full command output.

Jigsaw
  • 219
  • 2
  • 13
  • https://stackoverflow.com/search?q=%5Bpip%5D+error%3A+Microsoft+Visual+C%2B%2B+14.0+is+required – phd Dec 24 '20 at 19:47

1 Answers1

1

The relevant line is this:

Complete output (5 lines): 
running install running build running build_ext building 'netifaces' extension error: Microsoft Visual C++ 14.0 is required. 
Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ 

It is telling you that to complete the install you need to go get the tools it mentions and install them. The package is trying to run a compile during install and it needs those tools

LhasaDad
  • 1,519
  • 1
  • 11
  • 17
  • Is there any way to avoid running a compile while installing ? It many cases it is absolutely not appropriate to run a compile (ie: install a compiler, system dependencies and so on) when installing a packages. I used to rely on pip --prefer-binary for that, but for some reason that doesn't work any more with netifaces. – kriss Mar 16 '21 at 13:54
  • There is a precompiled version of netifaces available. check here: https://www.lfd.uci.edu/~gohlke/pythonlibs/ for the package. you should be able to install it directly from the downloaded package. – LhasaDad Mar 18 '21 at 00:39
  • 1
    Thanks for the link. Actually I could even do that myself (compile binary package on another machine, copy it on the target machine and install it). But I still believe pip should do the job and the precompiled versions should be available on pypi. Compiling a package may be right for a developer but looks unfit for deploiement. – kriss Mar 18 '21 at 16:07
  • I don't disagree, I prefer packages (when possible) that only have python content and do not need to ship what would be an opaque binary. – LhasaDad Mar 18 '21 at 23:27