How to install pythonnet in VS Code? - python

I tried to install pythonnet in vs code by input
pip install pythonnet
in terminal and the error come up.
I also tried to git install
pip install git+https://github.com/pythonnet/pythonnet -U --force
and cd to the dir and run python setup.py install
And I am sure that my setuptool and wheel is up to date
any easy way to install the pythonnet?
thank for anyone help !
error:
PS C:\Users\User\Desktop\Python> pip install pythonnet
Collecting pythonnet
Using cached pythonnet-2.4.0.tar.gz (1.8 MB)
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\user\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\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\User\AppData\Local\Temp\pip-wheel-l_p_t2zy'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\
Complete output (76 lines):
running bdist_wheel
running build
running build_ext
?????? https://www.nuget.org/api/v2/ ????
?????? NuGet.exe 4.1.0?
???? NuGet.exe ? 5.4.0?
?????
Cannot find the specified version of msbuild: '14'
MSBuild auto-detection: using msbuild version '16.0.462.64354' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Microsoft.CSharp.CurrentVersion.targets(321,5): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk. [C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\src\runtime\Python.Runtime.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Microsoft.CSharp.CurrentVersion.targets(321,5): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk. [C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\src\testing\Python.Test.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Microsoft.CSharp.CurrentVersion.targets(321,5): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk. [C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\src\embed_tests\Python.EmbeddingTest.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Microsoft.CSharp.CurrentVersion.targets(321,5): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk. [C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\src\console\Console.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Microsoft.CSharp.CurrentVersion.targets(321,5): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk. [C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\src\clrmodule\clrmodule.csproj]
??: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
Restoring NuGet package UnmanagedExports.1.2.7.
Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
Restoring NuGet package NUnit.3.7.1.
Adding package 'NUnit.3.7.1' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
Added package 'NUnit.3.7.1' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\packages'
NuGet Config files used:
C:\Users\User\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Users\User\.nuget\packages\
https://api.nuget.org/v3/index.json
Installed:
3 package(s) to packages.config projects
Traceback (most recent call last):
File "tools\geninterop\geninterop.py", line 24, in <module>
from pycparser import c_ast, c_parser
ModuleNotFoundError: No module named 'pycparser'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\setup.py", line 623, in <module>
setup(
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\setup.py", line 610, in run
return bdist_wheel.bdist_wheel.run(self)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
self.run_command('build')
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\setup.py", line 298, in build_extension
subprocess.check_call([sys.executable, geninterop, interop_file])
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\User\\appdata\\local\\programs\\python\\python38-32\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtime\\interop38.cs']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\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-msg167e6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\User\appdata\local\programs\python\python38-32\Include\pythonnet'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-35qtcmee\pythonnet\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-35qtcmee\\pythonnet\\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-msg167e6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\User\appdata\local\programs\python\python38-32\Include\pythonnet' Check the logs for full command output.```

Related

Error: Failed building wheel for pythonnet

I am trying to install pythonnet and i can't for some reason and it just gives me this error whenever i try to install it
pip3 install pythonnet
Collecting pythonnet
Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in c:\users\0991t\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pythonnet) (2.20)
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\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'"'"'))' bdist_wheel -d 'C:\Users\0991t\AppData\Local\Temp\pip-wheel-u9mp60rw'
cwd: C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\
Complete output (80 lines):
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.1.0.
Updating NuGet.exe to 6.0.0.
Update successful.
Cannot find the specified version of msbuild: '14'
MSBuild auto-detection: using msbuild version '16.11.2.50704' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'.
Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
Restoring NuGet package NUnit.3.12.0.
Restoring NuGet package System.ValueTuple.4.5.0.
Restoring NuGet package UnmanagedExports.1.2.7.
Adding package 'NUnit.3.12.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
Added package 'NUnit.3.12.0' to folder 'C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\packages'
NuGet Config files used:
C:\Users\0991t\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Users\0991t\.nuget\packages\
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Installed:
4 package(s) to packages.config projects
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 630, in <module>
setup(
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 612, in run
return bdist_wheel.bdist_wheel.run(self)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\_distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 345, in build_extension
manifest = self._get_manifest(dest_dir)
File "C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\setup.py", line 389, in _get_manifest
subprocess.check_call(" ".join(cmd), shell=False)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\mt.exe -inputresource:"C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe" -out:"C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\build\lib.win-amd64-3.9\app.manifest"' returned non-zero exit status 31.
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\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\0991t\AppData\Local\Temp\pip-record-l9hhufpc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet'
cwd: C:\Users\0991t\AppData\Local\Temp\pip-install-oqtzzy7u\pythonnet_3e469843a44f4517b9f84bc86e79df93\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\0991t\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\setup.py'"'"'; __file__='"'"'C:\\Users\\0991t\\AppData\\Local\\Temp\\pip-install-oqtzzy7u\\pythonnet_3e469843a44f4517b9f84bc86e79df93\\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\0991t\AppData\Local\Temp\pip-record-l9hhufpc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\0991t\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet' Check the logs for full command output.
I have tried updating setuptools, pip, and wheel. I have tried a lot of things but i just can't wrap my head around why it is causing this error. I am using the latest pip version and using the latest python version. Im also using the latest setuptools version and the latest wheel version. Sorry i am trying to make my question not mostly code so i can actually post it lol.
This can help you #Thomas.
I had the same issue, this solved my problem and install successfully.
Due to pythonnet version mismatch python 3.10.1 reported this error.
Go to: https://pypi.org/project/pythonnet/
Then Follow these steps:
Open the official website :pythonnet.
Click on the "Download files".
Then download "pythonnet-2.5.2-cp38-cp38-win_amd64.whl" (for 64-bit python version)
Modify file name like this:
Before: pythonnet-2.5.2-cp38-cp38-win_amd64.whl
After: pythonnet-2.5.2-cp310-none-any.whl
And now try to install like: pip install path of the file
ex: pip install C:\users\user5\desktop\pythonnet-2.5.2-cp310-none-any.whl
I hope this help you. All the best.
Original post: https://www.codestudyblog.com/cs2112pyc/1221121223.html

dlib not installing pycharm, how to fix? No other posts have helped. I need to use python 3.9

I am not able to install dlib on my computer. It gives me this error, but no other posts have helped me. I have been searching for a few hours now but to no avail. I am not familiar with the pip command, so this error does not tell me any meaningful information. Can someone who is more experienced please tell me why this is not working? I have already tried reinstalling Microsoft Visual Studio C++ 2015, but that did not work. Installing CMake did not work either. Can someone please help me fix this?
Error:
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: 'C:\Users\danie\Desktop\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\danie\\AppData
\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\setup.py'"'"'; __file__='"'"'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\d
lib_74869802ec0f4350b1acbcfa765926a5\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setupto
ols import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\
danie\AppData\Local\Temp\pip-wheel-aho58vt2'
cwd: C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\
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.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTOR
Y=C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=C:\Users\danie\Desktop\python
Project\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\bu
ild\lib.win-amd64-3.9 -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\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 222, in <module>
setup(
File "C:\Users\danie\Desktop\pythonProject\venv\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\Desktop\pythonProject\venv\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\tools\\python'
, '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\build\\lib.win-amd64-3.9', '-DP
YTHON_EXECUTABLE=C:\\Users\\danie\\Desktop\\pythonProject\\venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\danie\\AppData\\Local\\Temp\
\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: 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
ERROR: Command errored out with exit status 1:
command: 'C:\Users\danie\Desktop\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\danie\\AppDa
ta\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\setup.py'"'"'; __file__='"'"'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\
\dlib_74869802ec0f4350b1acbcfa765926a5\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setup
tools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Us
ers\danie\AppData\Local\Temp\pip-record-3n7tervb\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\danie\Desktop\pythonProje
ct\venv\include\site\python3.9\dlib'
cwd: C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\
Complete output (60 lines):
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
Building extension for Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECT
ORY=C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=C:\Users\danie\Desktop\pyth
onProject\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\
build\lib.win-amd64-3.9 -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\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 222, in <module>
setup(
File "C:\Users\danie\Desktop\pythonProject\venv\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\Desktop\pythonProject\venv\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 546, in run
self.run_command('build')
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\danie\AppData\Local\Temp\pip-install-qaxhyxsu\dlib_74869802ec0f4350b1acbcfa765926a5\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\danie\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\tools\\pytho
n', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\build\\lib.win-amd64-3.9', '-
DPYTHON_EXECUTABLE=C:\\Users\\danie\\Desktop\\pythonProject\\venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\danie\\AppData\\Local\\Tem
p\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\danie\Desktop\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[
0] = '"'"'C:\\Users\\danie\\AppData\\Local\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\setup.py'"'"'; __file__='"'"'C:\\Users\\danie\\AppData\\L
ocal\\Temp\\pip-install-qaxhyxsu\\dlib_74869802ec0f4350b1acbcfa765926a5\\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__, '"'"'exe
c'"'"'))' install --record 'C:\Users\danie\AppData\Local\Temp\pip-record-3n7tervb\install-record.txt' --single-version-externally-managed --compile --install-headers 'C
:\Users\danie\Desktop\pythonProject\venv\include\site\python3.9\dlib' Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\danie\Desktop\pythonProject\venv\Scripts\python.exe -m pip install --upgrade pip' command.
download cmake executable file on your pc, install it and install cmake build tools for c++ from visual studio build tools. After installing cmake with visual studio build tools, you need to download dlib wheel file from this github repo: https://github.com/Tobyyosoba777/Computer-Vision-OpenCv-Python-/tree/main/Libraries
download: dlib-19.22.99-cp39-cp39-win_amd64.whl
and download: dlib-19.22.99.win-amd64-py3.9.exe
install the .exe file on your pc, restart it(not necessary) and open the current directory of the downloaded .whl file where it is saved on your pc in your python/anaconda terminal/ cmd
for example:
C:\Users\USER->cd desktop "if you downloaded the file to your desktop" this command will move you to the current directory of the .whl file
then input: "pip install dlib-19.22.99-cp39-cp39-win_amd64.whl"
that should work
It worked after I installed all of the visual studio build things (all 80 gb)
Just for anyone coming to this in the future

Getting Error while installing dlib (Python)

I have already installed VS and CMake but still, I am unable to install dlib.
Following error triggers while executing the command on CMD (pip install dlib) I have tried two versions, dlib and dlib==19.18.0.
I have tried many different solutions but still stuck, also tried to uninstall everything including VS and reinstalling it but this didn't help me.
Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Windows\system32>pip install dlib==19.18.0
Collecting dlib==19.18.0
Using cached dlib-19.18.0.tar.gz (3.1 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\NOUMAN\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\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\NOUMAN\AppData\Local\Temp\pip-wheel-5k984utj'
cwd: C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\
Complete output (84 lines):
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.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\NOUMAN\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:3 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 22/07/2020 10:00:29 am.
Project "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "x64\Debug\".
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
Creating directory "x64\Debug\VCTargetsPath.tlog\".
InitializeBuildStatus:
Creating "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB6004: The specified task executable location "C:\Windows\system32\cmd.exe" is invalid. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
"C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB6004: The specified task executable location "C:\Windows\system32\cmd.exe" is invalid. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.65
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/NOUMAN/AppData/Local/Temp/pip-install-y57adt7m/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\NOUMAN\anaconda3\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
self.run_command('build')
File "C:\Users\NOUMAN\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\NOUMAN\anaconda3\lib\subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\NOUMAN\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: 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
ERROR: Command errored out with exit status 1:
command: 'C:\Users\NOUMAN\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\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\NOUMAN\AppData\Local\Temp\pip-record-fa__5h9h\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\NOUMAN\anaconda3\Include\dlib'
cwd: C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\
Complete output (86 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.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\NOUMAN\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:3 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 22/07/2020 10:00:33 am.
Project "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "x64\Debug\".
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
Creating directory "x64\Debug\VCTargetsPath.tlog\".
InitializeBuildStatus:
Creating "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB6004: The specified task executable location "C:\Windows\system32\cmd.exe" is invalid. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
"C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB6004: The specified task executable location "C:\Windows\system32\cmd.exe" is invalid. [C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\build\temp.win-amd64-3.7\Release\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.65
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Users/NOUMAN/AppData/Local/Temp/pip-install-y57adt7m/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\NOUMAN\anaconda3\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\NOUMAN\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\NOUMAN\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\NOUMAN\AppData\Local\Temp\pip-install-y57adt7m\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\NOUMAN\anaconda3\lib\subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\NOUMAN\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\NOUMAN\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\NOUMAN\\AppData\\Local\\Temp\\pip-install-y57adt7m\\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\NOUMAN\AppData\Local\Temp\pip-record-fa__5h9h\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\NOUMAN\anaconda3\Include\dlib' Check the logs for full command output.

Installing pythonnet with no internet access

I am trying to install pythonnet on a machine with no internet access. On a connected machine I downloaded pythonnet-master.zip from Github, and pythonnet-2.4.0.tar.gz from pypi.
When I try pip install pythonnet-2.4.0.tar.gz, I get the error The remote name could not be resolved: 'www.nuget.org.
I then used conda install nuget-3.2.0.10516-py34_0.tar.bz2 to take care of nuget. The installation was successful, but I still cannot install pythonnet.
My attempts using pythonnet-master.zip and conda install also failed. Any ideas would be helpful.
Here is the full error output:
(raman_env) C:\Users\Administrator\Desktop\eric\software>pip install pythonnet-2
.4.0.tar.gz
Processing c:\users\administrator\desktop\eric\software\pythonnet-2.4.0.tar.gz
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\envs\raman_env\python.exe' -u -c 'import s
ys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local
\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1
\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\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\ADMINI~1\AppData\Local\Temp\pip-wheel-vi5w5zft' --python-tag cp37
cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\
Complete output (44 lines):
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
The remote name could not be resolved: 'www.nuget.org'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
line 658, in <module>
zip_safe=False,
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\site-packages\setuptools\_
_init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\core.py", line 1
48, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
66, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
cmd_obj.run()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
line 610, in run
return bdist_wheel.bdist_wheel.run(self)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\site-packages\wheel\bdist_
wheel.py", line 192, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\cmd.py", line 31
3, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build.py
", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\cmd.py", line 31
3, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 340, in run
self.build_extensions()
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 449, in build_extensions
self._build_extensions_serial()
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
line 245, in build_extension
self._install_packages()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
line 424, in _install_packages
subprocess.check_call(cmd, shell=use_shell)
File "C:\ProgramData\Anaconda3\envs\raman_env\lib\subprocess.py", line 347,
in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'tools\nuget\nuget.exe update -self' re
turned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\envs\raman_env\python.exe' -u -c 'import
sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Loc
al\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI
~1\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\setup.py'"'"';f=getattr(tokeni
ze, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\
n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --recor
d 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-31isrm6o\install-record.txt'
--single-version-externally-managed --compile
cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\envs\ra
man_env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'
C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'
; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-req-build-8jks801
m\\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\ADMINI~1\AppData\Local\Temp\pip-rec
ord-31isrm6o\install-record.txt' --single-version-externally-managed --compile C
heck the logs for full command output.
The setup.py of pythonnet is trying to run nugget.exe update --self which fails in you system because of the missing internet connection. I can think of two possible solutions:
Instead of a source install, try to download the right whl file. On pypi, there are only ones for cp37 and below. If you are running pyhton 3.8, you can find the right wheel file here
Extract the tar.gz archive and comment line 424: subprocess.check_call(cmd, shell=use_shell). Then run python setup.py install. This will prevent setup from trying to update nugget during the installation process

Pip error: option --single-version-externally-managed not recognized

I try to install pythonnet and got an errer, how can I fix that??
p.s the Microsoft.CSharp.Core.targets does not exist from the beginning
so I copy form "https://referencesource.microsoft.com/#MSBuildFiles/C/ProgramFiles(x86)/MSBuild/14.0/bin_/amd64/Microsoft.CSharp.Core.targets,4b2d25f00a74b6f8" myself.
error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\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\User\AppData\Local\Temp\pip-wheel-7jl8gkpe'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\
Complete output (83 lines):
running bdist_wheel
running build
running build_ext
?????? https://www.nuget.org/api/v2/ ????
?????? NuGet.exe 4.1.0?
???? NuGet.exe ? 5.4.0?
?????
Cannot find the specified version of msbuild: '14'
MSBuild auto-detection: using msbuild version '16.0.462.64354' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'.
Restoring NuGet package NUnit.3.7.1.
Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
Restoring NuGet package UnmanagedExports.1.2.7.
Adding package 'NUnit.3.7.1' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
Added package 'NUnit.3.7.1' to folder 'C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\packages'
NuGet Config files used:
C:\Users\User\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Users\User\.nuget\packages\
https://api.nuget.org/v3/index.json
Installed:
3 package(s) to packages.config projects
Traceback (most recent call last):
File "tools\geninterop\geninterop.py", line 293, in <module>
sys.exit(main())
File "tools\geninterop\geninterop.py", line 273, in main
python_h = preprocess_python_headers()
File "tools\geninterop\geninterop.py", line 193, in preprocess_python_headers
for line in _check_output(cmd).splitlines():
File "tools\geninterop\geninterop.py", line 41, in _check_output
output = subprocess.check_output(*args, **kwargs)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] \u7cfb\u7d71\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a94\u6848\u3002
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\setup.py", line 623, in <module>
setup(
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\setup.py", line 610, in run
return bdist_wheel.bdist_wheel.run(self)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
self.run_command('build')
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "c:\users\User\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\setup.py", line 298, in build_extension
subprocess.check_call([sys.executable, geninterop, interop_file])
File "c:\users\User\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\User\\appdata\\local\\programs\\python\\python38-32\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtime\\interop38.cs']' returned non-zero exit status
1.
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\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-0d2o62h0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\User\appdata\local\programs\python\python38-32\Include\pythonnet'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-93okize6\pythonnet\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-93okize6\\pythonnet\\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-0d2o62h0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\User\appdata\local\programs\python\python38-32\Include\pythonnet' Check the logs for full command output.
I had this problem too. I was using the newest python to date, v3.9.5. From reading the Pyton.NET docs # http://pythonnet.github.io/, I found that "Python.NET is currently compatible and tested with Python releases 2.7 and 3.5-3.8". I downloaded and installed the latest 3.8 version of Python for Windows (3.8.10 to date). I updated my path to use Python 3.8 (# C:\Users\user\AppData\Local\Programs\Python\Python38 on my computer). After that I was able to install Python.NET from cmd with:
python -m pip install pythonnet

Categories