ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Catkin insists on using 3.4 and nosetests 3.4, when configured to use python 2.7

asked 2014-09-16 14:38:04 -0500

clauniel gravatar image

When I call catkin_make like this

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/

I see this in the output

-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Python nosetests: /usr/bin/nosetests-3.4
-- Using empy: /usr/lib/python3.4/site-packages/

Naturally my build process fails because the python 2 executable cannot interpret these versions. How do I force catkin to use the python 2.7 versions?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2014-09-27 14:58:32 -0500

marauder gravatar image

Creating a symboilc link from the 2.7 to 3.4 package helped me. I know this is not a perfect solution,but it works for now.

ln -s /usr/lib/python2.7/site-packages/ /usr/lib/python3.4/site-packages/

Hoping someone with a better knowledge could provide a more concrete solution

edit flag offensive delete link more



This is an option, but it also means you cannot use the 3.4 version for anything else anymore, right?

clauniel gravatar image clauniel  ( 2014-10-06 13:38:13 -0500 )edit

Yes, it does

marauder gravatar image marauder  ( 2014-10-12 23:19:50 -0500 )edit

answered 2014-10-06 14:01:46 -0500

Dirk Thomas gravatar image

updated 2014-10-06 14:02:14 -0500

Please try setting the CMake variable PYTHON_VERSION to 2.7 or just 2. Using catkin_make you want to pass -DPYTHON_VERSION=2.7.

This will also figure out the PYTHON_EXECUTABLE automatically.

edit flag offensive delete link more


The python executable is being detected as the 2.7 version . But the package is using the python 3 version no matter what the cmake variable is being set

marauder gravatar image marauder  ( 2014-10-12 23:21:09 -0500 )edit

answered 2015-07-09 02:43:53 -0500

In my experience CMake can insist on using cached PYTHON_EXECUTABLE and NOSETESTS variables even if you set PYTHON_VERSION to something different.

Try removing build and devel directories before rebuilding:

rm -r build devel && catkin_make -DPYTHON_VERSION=2.7

edit flag offensive delete link more

Question Tools



Asked: 2014-09-16 14:37:13 -0500

Seen: 799 times

Last updated: Jul 09 '15