-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install pyrealsense2 .so and __init__.py #13079
Install pyrealsense2 .so and __init__.py #13079
Conversation
Can one of the admins verify this patch? |
else() # not BUILD_LEGACY_PYBACKEND | ||
|
||
install(TARGETS pyrealsense2 | ||
LIBRARY DESTINATION ${PYTHON_INSTALL_DIR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @eufrizz
I'm wondering whether all these references to PYTHON_INSTALL_DIR
should really be to CMAKECONFIG_PY_INSTALL_DIR
, like the other install destinations do?
Have you tried with a non-standard install location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, CMAKECONFIG_PY_INSTALL_DIR
is a different location where the cmake config files are placed, allowing consumers to use find_package(pyrealsense2)
in their projects. The location looks something like: /usr/local/lib/cmake/pyrealsense2/pyrealsense2Targets.cmake
.
This is not where the .so files should be installed. You'll notice a few lines above that PYTHON_INSTALL_DIR
is used when built with pybackend2, but since your commit 953bb06 this is not the default, and libraries are no longer installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PYTHON_INSTALL_DIR
variable is set here in /CMake/external_pybind11.cmake:
if( CMAKE_VERSION VERSION_LESS 3.12 ) |
The rsutils bindings are done in the same way:
install( |
As for non-standard install locations (i.e. setting CMAKE_INSTALL_PREFIX), it will ignore them and install in the Python dist-packages regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated it to now install ARCHIVE (I assume this is useful for building with SHARED_LIBS=false), as well as RUNTIME and EXPORT, as is done in the install a few lines above. There is already an EXPORT rule for pyrealsense2Targets below so I've left that out.
12a8048
to
0fc2d49
Compare
0fc2d49
to
cc3759b
Compare
@@ -168,6 +168,15 @@ install(TARGETS pybackend2 pyrealsense2 | |||
) | |||
|
|||
target_include_directories(pybackend2 PRIVATE ../../src) | |||
|
|||
else() # not BUILD_LEGACY_PYBACKEND |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User should be able to build and install both pyrealsense2 and pybackend2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They still can, the pybackend2 part has not changed, unless I'm mistaken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you places the new ‘install’ in an “else” section.
Why do we want to install pyrealsense only if we do not install pybackend?
Or I am missing something 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the "if" statement, a few lines above, you'll see that pyrealsense2 and pybackend2 are both installed. The issue I'm fixing is that if you don't install pybackend2, then pyrealsense2 is never installed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eufrizz, much appreciated!
Thanks! |
Hi @eufrizz! Great work. Is there any workaround for building pyrealsense with 2.55.1 build? I tried to set UPD: the error I am getting during making buld
|
@gfx73 just apply the changes to the CMakeLists in this PR to your repo and it should work. |
@eufrizz thank you for your reply! I know this would be a workaround. But I'm building docker image with ci. So applying a patch during build is kinda crutch. |
I was advised to come to this PR to discuss the problem with pybackend build. Please look at this. Thank you for your attention! |
@eufrizz So I downloaded the file from @eufrizz for CMakeLists.txt and compared it with the one I have, they are the same. I still have the same exact problem
So, I also found these in my home dir (I assume created by intel):
Which is also not the version 2.56??? why??? anyhow, I thought soft linking pyrealsense2.cpython-310-aarch64-linux-gnu.so.2.55.1 to pyrealsense2.so may resolve the problem but it doesn't. So could you please suggest a fix? I am curious why it shows version 2.55? I did checkout the commit hash for 2.56 and you can see it here:
Then proceeded to change line 46 of scripts/libuvc_installation.sh to
Anyhow, after running I also have added
and still same. Any help is really appreciated. |
I understand this is not a solution but the following worked
|
Thanks so much @monajalal for sharing what worked for you! |
Fix for python bindings, issue #13080 , where pyrealsense2 is not installed when built from source.
Added:
The first was added in an else statement because the installation is done when pybackend2 is used
At
make install
, you now see these extra lines:Other related issues:
#10635
#6449
#6964 (comment)
#12894
#3062
and more...