Last active
February 26, 2020 15:27
-
-
Save byteofprash/6d4c2b3ada304984b10e01635797d854 to your computer and use it in GitHub Desktop.
Steps to install ROS with python3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Warning: don't try to run this as a script. It probably won't work. | |
# remove all things python (optional) | |
sudo apt-get remove python-* | |
# remove previous installations of ROS | |
sudo apt-get remove ros-* | |
sudo apt-get remove ros-melodic-* | |
sudo apt-get autoremove | |
# setup python3 dependencies | |
sudo apt update | |
sudo apt install -y python3 python3-dev python3-pip build-essential | |
sudo -H pip3 install -U rosdep rospkg rosinstall_generator rosinstall wstool vcstools catkin_tools catkin_pkg | |
# initializ catkin build environment | |
sudo rosdep init | |
rosdep update | |
cd ~ | |
mkdir ros_catkin_ws | |
cd ros_catkin_ws | |
# TODO: get rqt_rviz rviz_plugin_tutorials librviz_tutorial building w/python3 | |
catkin config --init -DCMAKE_BUILD_TYPE=Release -DSETUPTOOLS_DEB_LAYOUT=OFF --blacklist rqt_rviz rviz_plugin_tutorials librviz_tutorial --install | |
# setup ROS install | |
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall | |
wstool init -j8 src melodic-desktop-full.rosinstall | |
# if packages fail to download, run the following | |
wstool update -j4 -t src | |
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall | |
wstool update -t src | |
rosdep update | |
# setup environment and install dependencies | |
export ROS_PYTHON_VERSION=3 | |
#Call apt-get for each package | |
for pkg in "$@" | |
do | |
echo "Installing $pkg" | |
sudo apt-get -my install $pkg >> install.log | |
done | |
# and chmod it | |
chmod +x install_skip | |
# sed magic | |
sudo ./install_skip `rosdep check --from-paths src --ignore-src | grep python | sed -e "s/^apt\t//g" | sed -z "s/\n/ /g" | sed -e "s/python-/python3-/g"` | |
rosdep install --from-paths src --ignore-src -y --skip-keys="`rosdep check --from-paths src --ignore-src | grep python- | sed -e "s/^apt\t//g" | sed -z "s/\n/ /g"`" | |
find . -type f -exec sed -i 's/\/usr\/bin\/env[ ]*python/\/usr\/bin\/env python3/g' {} + | |
grep -nrw "." -e "\/usr\/bin\/python" | sed -i "s/\/usr\/bin\/\<python\>/\/usr\/bin\/python3/g" | |
sudo ln -sfn /usr/bin/python3.6 /usr/bin/python | |
catkin build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment