title: pip install pythonnet errored out with exit status 1 on Windows 10 (Python 3.10.1)
body: <p>According to the official Python.NET documention I'm supposed to install it using <code>pip install pythonnet</code>, this gives me an error however. I have upgraded the following packages trying to fix it:</p>
  <ul>
  <li>pip</li>
  <li>setuptools</li>
  <li>wheel</li>
  </ul>
  <p>This however didn't fix it and it's throwing some errors.</p>
  <pre><code>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\kiron\appdata\local\programs\python\python310\lib\site-packages (from pythonnet) (2.21)
  Building wheels for collected packages: pythonnet
    Building wheel for pythonnet (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\kiron\appdata\local\programs\python\python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\kiron\AppData\Local\Temp\pip-wheel-teu689ee'
         cwd: C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\
    Complete output (91 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\Community\MSBuild\Current\bin'.
    Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
    Restoring NuGet package NUnit.3.12.0.
    Adding package 'NUnit.3.12.0' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Adding package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Added package 'NUnit.ConsoleRunner.3.11.1' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Restoring NuGet package System.ValueTuple.4.5.0.
    Adding package 'System.ValueTuple.4.5.0' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Added package 'NUnit.3.12.0' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Restoring NuGet package UnmanagedExports.1.2.7.
    Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Added package 'System.ValueTuple.4.5.0' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
    Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\packages'
  
    NuGet Config files used:
        C:\Users\kiron\AppData\Roaming\NuGet\NuGet.Config
        C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
  
    Feeds used:
        C:\Users\kiron\.nuget\packages\
        https://api.nuget.org/v3/index.json
        https://packages.stride3d.net/nuget
        C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
  
    Installed:
        4 package(s) to packages.config projects
    Traceback (most recent call last):
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\tools\geninterop\geninterop.py&quot;, line 396, in &lt;module&gt;
        sys.exit(main())
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\tools\geninterop\geninterop.py&quot;, line 357, in main
        python_h = preprocess_python_headers()
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\tools\geninterop\geninterop.py&quot;, line 238, in preprocess_python_headers
        for line in _check_output(cmd).splitlines():
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\tools\geninterop\geninterop.py&quot;, line 46, in _check_output
        output = subprocess.check_output(*args, **kwargs)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\subprocess.py&quot;, line 420, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\subprocess.py&quot;, line 501, in run
        with Popen(*popenargs, **kwargs) as process:
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\subprocess.py&quot;, line 966, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\subprocess.py&quot;, line 1435, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    Traceback (most recent call last):
      File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\setup.py&quot;, line 630, in &lt;module&gt;
        setup(
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\__init__.py&quot;, line 155, in setup
        return distutils.core.setup(**attrs)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\core.py&quot;, line 148, in setup
        return run_commands(dist)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\core.py&quot;, line 163, in run_commands
        dist.run_commands()
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\dist.py&quot;, line 967, in run_commands
        self.run_command(cmd)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\dist.py&quot;, line 986, in run_command
        cmd_obj.run()
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\setup.py&quot;, line 612, in run
        return bdist_wheel.bdist_wheel.run(self)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\wheel\bdist_wheel.py&quot;, line 299, in run
        self.run_command('build')
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\cmd.py&quot;, line 313, in run_command
        self.distribution.run_command(command)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\dist.py&quot;, line 986, in run_command
        cmd_obj.run()
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\command\build.py&quot;, line 135, in run
        self.run_command(cmd_name)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\cmd.py&quot;, line 313, in run_command
        self.distribution.run_command(command)
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\dist.py&quot;, line 986, in run_command
        cmd_obj.run()
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\command\build_ext.py&quot;, line 339, in run
        self.build_extensions()
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\command\build_ext.py&quot;, line 448, in build_extensions
        self._build_extensions_serial()
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\site-packages\setuptools\_distutils\command\build_ext.py&quot;, line 473, in _build_extensions_serial
        self.build_extension(ext)
      File &quot;C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\setup.py&quot;, line 302, in build_extension
        subprocess.check_call([sys.executable, geninterop, interop_file])
      File &quot;c:\users\kiron\appdata\local\programs\python\python310\lib\subprocess.py&quot;, line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['c:\\users\\kiron\\appdata\\local\\programs\\python\\python310\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtime\\interop310.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\kiron\appdata\local\programs\python\python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\kiron\AppData\Local\Temp\pip-record-xe4ba95q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\kiron\appdata\local\programs\python\python310\Include\pythonnet'
           cwd: C:\Users\kiron\AppData\Local\Temp\pip-install-aqpb12ju\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\
      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\kiron\appdata\local\programs\python\python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\kiron\\AppData\\Local\\Temp\\pip-install-aqpb12ju\\pythonnet_af0b8f5732a345fbb5e2d512446e9f59\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\kiron\AppData\Local\Temp\pip-record-xe4ba95q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\kiron\appdata\local\programs\python\python310\Include\pythonnet' Check the logs for full command output.
  </code></pre>
  <p>Now, I do see that it has something to do with my VS2019 installation, but I cannot tell what the issue is. Should I perhaps do a fresh reinstall of VS2019? And if so, what workloads and individual components should I install?</p>
  <h1>EDIT 1</h1>
  <p>I have just done a fresh reinstall of VS2019, with the following workloads, their installation detailsand the following individual components:
  <a href="https://i.stack.imgur.com/mqCQv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mqCQv.png" alt="installed workloads part 1" /></a>
  <a href="https://i.stack.imgur.com/OMULQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OMULQ.png" alt="installed workloads part 2" /></a></p>
  <p><a href="https://i.stack.imgur.com/DrwrL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DrwrL.png" alt="individual components .NET" /></a>
  <a href="https://i.stack.imgur.com/r4F7R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r4F7R.png" alt="individual components Cloud, database and server" /></a>
  <a href="https://i.stack.imgur.com/yunzT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yunzT.png" alt="individual components Code tools" /></a>
  <a href="https://i.stack.imgur.com/eKYLF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eKYLF.png" alt="individual components Compilers, build tools and runtimes part 1" /></a>
  <a href="https://i.stack.imgur.com/C3oCQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3oCQ.png" alt="individual components Compilers, build tools and runtimes part 2" /></a>
  <a href="https://i.stack.imgur.com/w3jFt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w3jFt.png" alt="individual components Compilers, build tools and runtimes part 2" /></a>
  <a href="https://i.stack.imgur.com/dIipv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dIipv.png" alt="individual components Debugging and testing and Development activities" /></a>
  <a href="https://i.stack.imgur.com/A67X1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A67X1.png" alt="individual components Games and Graphics and SDKs, libraries and frameworks part 1" /></a>
  <a href="https://i.stack.imgur.com/kmIy4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kmIy4.png" alt="individual components SDKs, libraries and frameworks part 2" /></a></p>
  <p>I'm still getting the same error in pip.</p>