Skip to content
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

Python3 compatibility #158

Closed
hgaiser opened this issue Jan 24, 2017 · 3 comments
Closed

Python3 compatibility #158

hgaiser opened this issue Jan 24, 2017 · 3 comments

Comments

@hgaiser
Copy link
Contributor

hgaiser commented Jan 24, 2017

Hey,

As is my understanding, ROS packages should aim to be python2 and python3 compatible. Currently on my system cv_bridge is linking against libboost_python.so though, which causes an issue for me since I am using a python3 interpreter and libboost_python.so is for python2 bindings (libboost_python3.so is for python3 bindings). The issue seems to come from this line, which should be find_package(Boost REQUIRED python3) in my case.

However simply changing this to python3 will break python2 compatibility. Perhaps some option should be added to the CMakeLists.txt for choosing python3/python2.

Best regards,
Hans

@vrabaud
Copy link
Contributor

vrabaud commented Jan 29, 2017

So, I solved it by checking which version of Python is installed. Now, as you mentioned, there should probably something at the level of CMake: what if you have Python2 installed and want to build for Python 3 ? (not sure we want to support that),

vrabaud added a commit that referenced this issue Jan 29, 2017
@hgaiser
Copy link
Contributor Author

hgaiser commented Jan 30, 2017

Yes I agree it would be better to have a boolean to determine if you want to compile with Python 2 or 3. I'm thinking it'd be better if it was a catkin flag, which is passed down to cmake. That way there'd be a ROS-wide flag of determining to compile with Python 2/3.

@hdamron17
Copy link

Would it be possible to compile the version dependent part for both python 2 and 3 then use six to determine at runtime which to import?

luca-della-vedova pushed a commit to luca-della-vedova/vision_opencv that referenced this issue Sep 2, 2020
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants