ROS build with Python3

This is tutorial for building ros kinetic with python3 from source

delete ros if you didn’t have ros installed pass this step

sudo apt-get purge ros-*
sudo apt-get autoremove

make the ros work space

mkdir ros

create python3 environment:

cd ros
# swith to python3 as default
sudo rm -rf /usr/bin/python
sudo ln -s /usr/bin/python3.5 /usr/bin/python
sudo apt install python3-pip

install dependencies:

~$ sudo apt-get install python3-rosdep python3-rosinstall-generator python3-wstool python3-rosinstall build-essential python3-sip-dev
~$ sudo pip3 install catkin_pkg

Download packages

~$ rosinstall_generator desktop --rosdistro kinetic --deps --tar > kinetic-desktop.rosinstall
~$ wstool init -j8 src kinetic-desktop.rosinstall

configure the depencies

~$ rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
~$ sudo apt-get install libtbb-dev python3-pyqt5
~$ sudo pip3 install empy numpy defusedxml netifaces
# do this if you can't find python3 in ubuntu 16.04
~$ sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py35.so /usr/lib/x86_64-linux-gnu/libboost_python3.so

build the work space (note that this will take a long time)

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

That’s it

Written on August 21, 2016