Create Environment for Python3

Hello,

I’ve created an environment for Python3 following the instructions of this video (min 20:40):

However, in the very first instructions of the Unit 1 of the course there are two other commands that I do not understand:

Setup the Python3 ROS catkin_ws environment


source /home/user/.catkin_ws_python3/devel/setup.bash
catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/home/user/.py3venv/bin/python
source devel/setup.bash

Could you clarify me why are the above instructions for? On my own machine I do not have the folder .catkin_ws_python3

Thanks
Juan

Hi,

In RobotIgniteAcademy, this folder ( /home/user/.catkin_ws_python3 ) is preinstalled. Its a workspace that we have with all the ROS packages compiled for python3, like the Tf of image package.
By sourcing this and then compiling ( catkin_make with the python3 virtual envirnment ) we are forcing that ROS compiles our catkin_ws for Python3, instead of python2.

There are other ways of doing this, but this is one of them :wink:

Hope I answered your question.

Although I have followed the live class ‘How to use ROS with Python3’ step by setp,
after I have typed in ‘catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/home/zxj/python3_ws/py3venv/bin/python’.

I got this message:

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_workspace.cmake:95 (message):
This workspace contains non-catkin packages in it, and catkin cannot build
a non-homogeneous workspace without isolation. Try the
‘catkin_make_isolated’ command instead.
Call Stack (most recent call first):
CMakeLists.txt:67 (catkin_workspace)

– Configuring incomplete, errors occurred!
See also “/home/zxj/python3_ws/build/CMakeFiles/CMakeOutput.log”.
See also “/home/zxj/python3_ws/build/CMakeFiles/CMakeError.log”.
Invoking “cmake” failed

And CMakeError.log :slight_smile:collect2: error:
ld returned 1 exit status
CMakeFiles/cmTC_3d131.dir/build.make:97: recipe for target ‘cmTC_3d131’ failed
make[1]: *** [cmTC_3d131] Error 1
make[1]: Leaving directory ‘/home/zxj/python3_ws/build/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_3d131/fast’ failed
make: *** [cmTC_3d131/fast] Error 2

I am very confused about the result.
Would you like to tell me what’s wrong in that?
Thank you!

I also have same issue and wasn’t able to get it work. Please someone support.

Was this ever resolved? I am taking the Tensorflow 101 course and i am getting errors following the code because the scripts are trying to run using python2.