toinsson / pyrealsense

Cross-platform ctypes/Cython wrapper to the librealsense library (v1.x)
http://pyrealsense.readthedocs.io
Apache License 2.0
121 stars 46 forks source link

Error Installing pyrealsense for RealSense R200 #95

Open tangyipeng100 opened 1 month ago

tangyipeng100 commented 1 month ago

I need to use the RealSense R200, which requires the pyrealsense library. However, when I try to install pyrealsense, I encounter the following error:

(test) C:\Users\51745>pip install pyrealsense
Collecting pyrealsense
  Using cached pyrealsense-2.2.tar.gz (60 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\users\51745\.conda\envs\test\lib\site-packages (from pyrealsense) (1.24.4)
Requirement already satisfied: cython in c:\users\51745\.conda\envs\test\lib\site-packages (from pyrealsense) (3.0.11)
Collecting pycparser
  Downloading pycparser-2.22-py3-none-any.whl (117 kB)
     ---------------------------------------- 117.6/117.6 kB 1.1 MB/s eta 0:00:00
Collecting six
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: pyrealsense
  Building wheel for pyrealsense (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      rsutilwrapper.cpp
      C:\Users\51745\.conda\envs\test\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
      pyrealsense/rsutilwrapper.cpp(1278): fatal error C1083: Cannot open include file: 'rs.h': No such file or directory
      error: command 'D:\\install software\\vs2022\\VC\\Tools\\MSVC\\14.30.30705\\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: Failed building wheel for pyrealsense
  Running setup.py clean for pyrealsense
Failed to build pyrealsense
Installing collected packages: six, pycparser, pyrealsense
  Running setup.py install for pyrealsense ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyrealsense did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      C:\Users\51745\.conda\envs\test\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      rsutilwrapper.cpp
      C:\Users\51745\.conda\envs\test\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
      pyrealsense/rsutilwrapper.cpp(1278): fatal error C1083: Cannot open include file: 'rs.h': No such file or directory
      error: command 'D:\\install software\\vs2022\\VC\\Tools\\MSVC\\14.30.30705\\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.
╰─> pyrealsense

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

What could be the cause of this error, and how can I resolve it?

toinsson commented 1 month ago

Hello,

the line:

pyrealsense/rsutilwrapper.cpp(1278): fatal error C1083: Cannot open include file: 'rs.h': No such file or directory

is where I'd start.

and using the prerequisites in the readme:

Windows specifics: set the environment variable PYRS_INCLUDES to the rs.h directory location and the environment variable PYRS_LIBS to the librealsense binary location. You might also need to have stdint.h available in your path.

Hope that helps.