etiennedub / pyk4a

Python 3 wrapper for Azure-Kinect-Sensor-SDK
MIT License
287 stars 81 forks source link

Error installing the py4ak lib #173

Closed AbdelRahmanNasser20 closed 2 years ago

AbdelRahmanNasser20 commented 2 years ago

When I try to pip install the py4ak lib using the following command:

pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib"

I get the following error:

PS C:\Users\Abdel Nasser\Documents\azure-kinect> pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib"
>> 
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
Collecting pyk4a
  Using cached pyk4a-1.4.0.tar.gz (23 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\users\abdel nasser\desktop\python\python38\lib\site-packages (from pyk4a) (1.23.0)
Requirement already satisfied: python_version>="3.4" in c:\users\abdel nasser\desktop\python\python38\lib\site-packages (from pyk4a) (0.0.2)
Skipping wheel build for pyk4a, due to binaries being disabled for it.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
Installing collected packages: pyk4a
  Running setup.py install for pyk4a ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyk4a did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Automatically detected kinect SDK. Adding include dir: C:\Program Files\Azure Kinect SDK v1.4.1\sdk\include and library dir C:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\AMD64\release\lib.
      c:\users\abdel nasser\desktop\python\python38\lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running build_ext
      building 'k4a_module' extension
      creating build
      creating build\temp.win-amd64-cpython-38
      creating build\temp.win-amd64-cpython-38\Release
      creating build\temp.win-amd64-cpython-38\Release\pyk4a
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" "-Ic:\users\abdel nasser\desktop\python\python38\lib\site-packages\numpy\core\include" "-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" "-Ic:\users\abdel nasser\desktop\python\python38\include" "-Ic:\users\abdel nasser\desktop\python\python38\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\include" /EHsc /Tppyk4a/pyk4a.cpp /Fobuild\temp.win-amd64-cpython-38\Release\pyk4a/pyk4a.obj
      pyk4a.cpp
      c:\users\abdel nasser\desktop\python\python38\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.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [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.
╰─> pyk4a

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)

I have the following path added

I have added the following path to my environment variables. C:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\bin

Image of C++ build tools that are installed

I am not at all sure how to deal with this:

c:\users\abdel nasser\desktop\python\python38\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.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] Any help will be greatly appreciated.

lpasselin commented 2 years ago

Not finding io.h is a first for me. I am not an expert with windows. Let's hope an other user can help you with this.

In the meantime, you could try installing using the bundle. pip install pyk4a-bundle

chrismeunier commented 2 years ago

Strangely enough I get this same error right now when I had no installation problems in the past. I see two main differences between my current configuration and before: I upgraded Windows 10 to 11 and I'm using the Visual Studio C++ build tools 2022 instead of 2019. I see you are using the 2022 build tools @AbdelRahmanNasser20, are you on Win11 as well ?

@lpasselin I also tried the pip install pyk4a-bundle and it worked flawlessly! But I don't understand the difference with the base module... could you elaborate a little bit? Are there any downsides compared to the normal install?

Also adding the C++ build tools as a prerequisite in the readme would be nice. The installation returns an error if they are missing, still it's easy to understand and fix (if you know what you need to do). This is not really related to the error described above but still fits the issue title so I don't see myself opening another one for that :)

AbdelRahmanNasser20 commented 2 years ago

yes I am also on win11 and just like you pip install pyk4a-bundle worked flawlessly.

lpasselin commented 2 years ago

pyk4a-bundle is precompiled