I am trying to install the capytaine package using pip (pip install capytaine
) (in VS Code).
Unfortunately I am getting multiple errors, although other packages such as numpy, matplotlib etc. are installed and run successfully. I have beginner to intermediate python and general programming skills, however I struggle solving delicate issues, such as dealing with errors I encountered here. Therefore, I am not sure whether the errors are caused by wheel, setup.py or some path related mistake.
I have already went through some other discussions, but couldn't find a useful resource for my problem, neither has installing C build tools recommended by VS Code helped.
I've got Python 3.9.13, wheel 0.37.1 and setuptools 65.3.0 on my computer. (Should I downgrade setuptools to below 60 version? how?)
I would really appreciate if you could assist me resolve the installation issues here.
I've cropped the irrelevant parts of the output after running pip install capytaine
to fit
the character requirements, hope it's not gibberish.
PS D:\TUHH\Master\Masterarbeit\Preliminary_tests\NemohAQWA_Check> pip install capytaine
Collecting capytaine
Using cached capytaine-1.4.tar.gz (124 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\users\dodob\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from capytaine) (1.23.2)
.
.
.
Building wheels for collected packages: capytaine
Building wheel for capytaine (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [213 lines of output]
C:\Users\dodob\AppData\Local\Temp\pip-install-46g3rmya\capytaine_cc3bdd35637b4ed48d97c88363dfe438\setup.py:9: DeprecationWarning:
`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python >= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools < 60.0` for those Python versions.
For more details, see:
https://numpy.org/devdocs/reference/distutils_status_migration.html
from numpy.distutils.core import Extension, setup
running bdist_wheel
.
.
.
-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include /Tcbuild\src.win-amd64-3.9\capytaine\green_functions\Delhommeau_f90module.c /Fobuild\temp.win-amd64-cpython-39\Release\build\src.win-amd64-3.9\capytaine\green_functions\Delhommeau_f90module.obj -O2 -fopenmp -cpp
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-cpp'
Delhommeau_f90module.c
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ibuild\src.win-amd64-3.9\build\src.win-amd64-3.9\capytaine\green_functions -IC:\Users\dodob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include -Ibuild\src.win-amd64-3.9\numpy\distutils\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.316"
.
.
.
INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\dodob\AppData\Local\Temp\pip-install-46g3rmya\capytaine_cc3bdd35637b4ed48d97c88363dfe438\build\temp.win-amd64-cpython-39\Release\ccompiler_opt_cache_ext.py
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for capytaine
Running setup.py clean for capytaine
Failed to build capytaine
Installing collected packages: capytaine
Running setup.py install for capytaine ... error
error: subprocess-exited-with-error
× Running setup.py install for capytaine did not run successfully.
│ exit code: 1
╰─> [200 lines of output]
C:\Users\dodob\AppData\Local\Temp\pip-install-46g3rmya\capytaine_cc3bdd35637b4ed48d97c88363dfe438\setup.py:9: DeprecationWarning:
`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python >= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools < 60.0` for those Python versions.
For more details, see:
https://numpy.org/devdocs/reference/distutils_status_migration.html
from numpy.distutils.core import Extension, setup
running install
C:\Users\dodob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
.
.
.
creating C:\Users\dodob\AppData\Local\Temp\tmpv6hwqlsf\Users\dodob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\distutils\checks
INFO: CCompilerOpt.cc_test_flags[1073] : testing flags (/WX)
WARN: CCompilerOpt.__init__[1240] : feature 'AVX512_KNL' is disabled, MSVC compiler doesn't support it
WARN: CCompilerOpt.__init__[1240] : feature 'AVX512_KNM' is disabled, MSVC compiler doesn't support it
INFO: CCompilerOpt.__init__[1782] : check requested baseline
.
.
.
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ibuild\src.win-amd64-3.9\build\src.win-amd64-3.9\capytaine\green_functions -IC:\Users\dodob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include -Ibuild\src.win-amd64-3.9\numpy\distutils\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include -IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include /Tcbuild\src.win-amd64-3.9\capytaine\green_functions\Delhommeau_f90module.c /Fobuild\temp.win-amd64-cpython-39\Release\build\src.win-amd64-3.9\capytaine\green_functions\Delhommeau_f90module.obj -O2 -fopenmp -cpp" failed with exit status 2
INFO:
########### EXT COMPILER OPTIMIZATION ###########
INFO: Platform :
Architecture: x64
Compiler : msvc
CPU baseline :
Requested : 'min'
Enabled : none
Flags : none
Extra checks: none
CPU dispatch :
Requested : 'max -xop -fma4'
Enabled : none
Generated : none
INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\dodob\AppData\Local\Temp\pip-install-46g3rmya\capytaine_cc3bdd35637b4ed48d97c88363dfe438\build\temp.win-amd64-cpython-39\Release\ccompiler_opt_cache_ext.py
[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.
╰─> capytaine
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
CodePudding user response:
This is very likely a conflict of package versions. Try running pip list
, copying all of your packages, creating a new file called requirements.txt
, putting all of your packages in there (without versions) and running pip install -r requirements.txt
. This will tell pip to solve the version conflict and you'll get a more readable error in the worst case scenario.
CodePudding user response:
One way is If you install a new version of python make sure you have added the path into the System environment variable of windows.
The second one is In VS code you need to add a Python Interpreter to run a pip command.
a. CTRL SHIFT P to open Command Palette.
b. Type & Select Python Interpreter in Command Palette.
The third way is to create a virtual environment and activate it in your project and run any types of pip command you want to install. For that see the link 1 (https://code.visualstudio.com/docs/python/environments) Link 2 (https://docs.python.org/3/tutorial/venv.html)