IntelRealSense / RealSenseID

Intel® RealSense™ ID SDK
https://intelrealsense.com/facial-authentication/
Apache License 2.0
98 stars 56 forks source link

Building python wrapper #114

Open openlayers-droid opened 3 years ago

openlayers-droid commented 3 years ago

hi, so I followed instructions on building python wrapper, but I couldn't find either rsid_py.pyd nor rsid.ddl after the cmake process. Kindly assist.

Many thanks

ryan185 commented 3 years ago

check in build folder inside lib

openlayers-droid commented 3 years ago

Many thanks @ryan185 . There were few things that had to be taken care of:

  1. not familiar how cmake works, i thought it would just create the python pyd file automatically. instead, i had to run the solution file inside Wrappere->python and build to generate the needed files.
  2. i create an environment with Python 3.8. The python code samples produced an error. Upgraded to python39 and samples work as intended.
  3. to be able to import rsid_py, other extra steps are needed such as creating init.py / adding the folder which hosts the pyd to PYTHONPATH.

i wasted a day figuring this out. So hope this helps someone.

ryan185 commented 3 years ago

Python files are working in windows the sample file?

openlayers-droid commented 3 years ago

@ryan185 yes they are working after the conducting the steps above.

ryan185 commented 3 years ago

File "C:\RealSenseID-master\samples\python\viewer.py", line 237, in main() File "C:\RealSenseID-master\samples\python\viewer.py", line 233, in main input_loop() File "C:\RealSenseID-master\samples\python\viewer.py", line 126, in input_loop cmd_exec.get(chr(keycode), lambda: None)() File "C:\RealSenseID-master\samples\python\viewer.py", line 89, in enroll_example with rsid_py.FaceAuthenticator(PORT) as f: RuntimeError: Error

openlayers-droid commented 3 years ago

This happened to me at first as well. it turns out to be Python version. i was using python 3.9. downgraded to python 3.8 and it worked.

sbekbulaeva commented 3 years ago

run the solution file inside Wrappere->python and build to generate the needed files.

@openlayers-droid I am having the same problem with rsid_py.pyd and rsid.ddl. They are not being generated after cmake. Could you elaborate on the "solution file" you mentioned?

I have run "cmake -DRSID_PY=ON -DRSID_PREVIEW=ON .. " inside ProjectDir/RealSenseID/wrappers/python, but then it complains that "RealSenseID/wrappers/3rdparty/pybind11/CMakeLists.txt does not exist."

RealSenseSupport commented 2 years ago

@sbekbulaeva The steps like this.

  1. mkdir build in the root of this project. (/build)
  2. run "cmake -DRSID_PY=ON -DRSID_PREVIEW=ON .. " in the build folder
  3. run make
rukshanfonseka commented 2 years ago

Has anyone been successful building the python wrappers in ubuntu/linux? I created an issue here https://github.com/IntelRealSense/RealSenseID/issues/147

rukshanfonseka commented 2 years ago

Many thanks @ryan185 . There were few things that had to be taken care of:

  1. not familiar how cmake works, i thought it would just create the python pyd file automatically. instead, i had to run the solution file inside Wrappere->python and build to generate the needed files.
  2. i create an environment with Python 3.8. The python code samples produced an error. Upgraded to python39 and samples work as intended.
  3. to be able to import rsid_py, other extra steps are needed such as creating init.py / adding the folder which hosts the pyd to PYTHONPATH.

i wasted a day figuring this out. So hope this helps someone.

Can you explain how you managed to overcome issue 3)? I am facing the same problem.

VolandSZ commented 2 years ago

@RealSenseSupport

  1. mkdir build in the root of this project. (/build)
  2. run "cmake -DRSID_PY=ON -DRSID_PREVIEW=ON .. " in the build folder
  3. run make

Still can not compile wrapper files for python. OS Windows 10 x64

1 . mkdir build in the root of this project. (/build) root of the project consists of these dirs (my path to project is "f:\Cmake_test\test3\"):

f:\Cmake_test\test3\3rdparty\
f:\Cmake_test\test3\cmake\
f:\Cmake_test\test3\docs\
f:\Cmake_test\test3\include\
f:\Cmake_test\test3\LicenseNotices\
f:\Cmake_test\test3\samples\
f:\Cmake_test\test3\scripts\
f:\Cmake_test\test3\src\
f:\Cmake_test\test3\tools\
f:\Cmake_test\test3\wrappers\

so i just need to make dir f:\Cmake_test\test3\build\ right?

2. run "cmake -DRSID_PY=ON -DRSID_PREVIEW=ON .. " in the build folder I need to run this command from inside folder f:\Cmake_test\test3\build\ ?

And in it means that it will generate files needed to MAKE Python wrapper in this folder according to "CMakeLists.txt" file located in project root folder f:\Cmake_test\test3\

But i get this error:

CMake Error at tools/rsid-viewer/CMakeLists.txt:4 (project):
  No CMAKE_CSharp_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "F:/Cmake_test/test3/build/CMakeFiles/CMakeOutput.log".
See also "F:/Cmake_test/test3/build/CMakeFiles/CMakeError.log".

Ok i dont really care about CSharp BUT on to the step 3 of your advice

3. run make Since i am on Windows i use MSBuild (17.2.1.25201)

Runing it in f:\Cmake_test\test3\build\ returns this error: MSBUILD : error MSB1003 - meaning that this folder doesnt have project files to build

And indeed it doesnt have anything like "sln" or "vcxproj" files.

Such files are located in f:\Cmake_test\test3\build\CMakeFiles\3.24.0-rc3\ and its subfolders but running MSBuild there doesnt give me rsid.dll and rsid_py*.pyd files.

MSBuild works fine. It can be seen in CMakeOutput.log - Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_c79d6.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework (for example)

So the main question - what am i doing wrong?