Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ROS Python3.5 Set Up
#!/usr/bin/env bash
# Create isolated ROS Workspace
cd ~
mkdir ros_py35
cd ros_py35
# Unset sourced workspace
# Go to ~/.bashrc and comment out lines from previous installation of ROS (Lunar)
# Get python3 helper libraries
sudo pip3 install rosdep
sudo pip3 install rosinstall_generator
#sudo pip3 install wstool
sudo pip3 install rosinstall
# Configure your catkin workspace
catkin config --init
catkin config -DCMAKE_BUILD_TYPE=Release
git clone https://github.com/tkruse/vcstools
cd vcstools
git checkout mock_server_tar_test
python setup.py develop
cd ..
git clone https://github.com/vcstools/wstool
cd wstool
python setup.py develop
wstool --help
# Pull bare-bone dependencies for ROS (Melodic) and use workspace tool to initialize
rosinstall_generator ros_comm --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall
wstool init -j8 src melodic-ros_comm.rosinstall
# If any installations failed, fix and continue using:
wstool update -j 4 -t src
# Set python version before catkin build
export ROS_PYTHON_VERSION=3
# Install some other dependencies
sudo apt install python3-empy
sudo apt install libgpgme11-dev
catkin build
# Note:
# You will probably see two build errors because of inappropriately set compile flags. They will try to compile without C++11 and fail.
# You can manually go to these CMakeLists.txt files and add "std=c++11" to the compile options and build again.
# Candidate trouble makers : src/ros_comm/rosbag & src/ros_comm/rosbag_storage
# Add other necessary ROS-Packages using rosinstall_generator
rosinstall_generator ros_comm sensor_msgs nav_msgs geometry_msgs --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall
wstool merge -t src melodic-ros_comm.rosinstall
wstool update -t src/
@benjaminabruzzo

This comment has been minimized.

Copy link

@benjaminabruzzo benjaminabruzzo commented Apr 1, 2019

Is this the totality of your configuration to run ROS with python 3.5? I've been trying to implement a similar configuration, but I've needed to install a significant number of additional libraries, and ROS still seems to be trying to use python2.7.

Edit: I'm trying to work with ROS Kinetic, which may be part of the issue.

@drmaj

This comment has been minimized.

Copy link

@drmaj drmaj commented Aug 23, 2019

Here are instructions for a full build of desktop-full with python3.6: https://www.miguelalonsojr.com/blog/robotics/ros/python3/2019/08/20/ros-melodic-python-3-build.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment