0
$\begingroup$

Rosanswers logo

I'm trying to fix Jenkins devel job of the package z_laser_projector

I'm having some import errors when running tests ("1.3. run tests" Console Section)

ModuleNotFoundError: No module named 'rospkg'

The whole package is developed for python3 in ROS melodic but Jenkins is using python2. I would like to ask if there is any way to force Jenkins configuration in order to run catkin with python3, for example forcing env vars as ROS_PYTHON_VERSION. Or am I missing something on package.xml?

Check that the build succeeds by running tests on TravisCI


Originally posted by rluque on ROS Answers with karma: 20 on 2020-12-23

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

The whole package is developed for python3 in ROS melodic [..]

ROS Melodic is Python 2 based. All packages released through the ROS buildfarm will therefore only get to use Python 2.

but Jenkins is using python2. [..] is there any way to force Jenkins configuration in order to run catkin with python3, for example forcing env vars as ROS_PYTHON_VERSION.

This is not a limitation of the ROS buildfarm, but of ROS Melodic (see also REP 3: Melodic Morenia).

Or am I missing something on package.xml?

No. The reason this is not working is because you cannot release a Python 3 package into ROS Melodic.

Or at least, not without some tricks (such as catkin_virtualenv).

For native Python 3 support, you'll have to switch to ROS Noetic (and/r ROS 2).

Check that the build succeeds by running tests on TravisCI

Yes, probably because you invoke the build of your workspace like this:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_VERSION=3.6 --force-cmake

which forces the use of Python 3 in a ROS Melodic workspace (ie: a Python 2-based ROS distro).


Originally posted by gvdhoorn with karma: 86574 on 2020-12-23

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by rluque on 2021-01-11:
Thank you very much for your answer, it has been very helpful!

$\endgroup$
0
$\begingroup$

Rosanswers logo

Melodic is configured as a Python 2 distribution. The default source-build configuration also uses Python 2 and changing that for a single package wouldn't work. You would need to add a separate binary distribution of Melodic using Python 3.


Originally posted by nuclearsandwich with karma: 906 on 2020-12-23

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.