71304.0 / 02 November 2017

Anaconda and ROS in Ubuntu 16.04 setup mistake

I made a small mistake in my setup of Anaconda I believe that effected my install of ROS packages and effected using roslaunch.

I wanted to make a small blog post for my reference and anyone who happens to stumble upon it.

Basically when you edit your .bashrc you can set the PATH variable incorrectly.

Below is the variable as it should be, obviously you have to change the path to be your username.  If you put your path to the anaconda bin behind the \$PATH variable appending it will cause your anaconda python version to be searched in first.  This is probably obvious to some, but I made the mistake.

export PATH="$PATH:/home/$USER/anaconda3/bin"

If you made your install it is also useful to make sure your ROS install is also using Python 2 and not Python 3.  Also the reason "python" should be referred to as python 2 is because in the python documentation they tell developers to always refer to python as python 2 in the future and anything using python 3 should be referred to as python3 to avoid issues.

If for some reason you want to circumvent this you can install alternatives in Linux.

update-alternatives --install /usr/bin/python python /usr/bin/python2 1
update-alternatives --install /usr/bin/python python /usr/bin/python3 2

That adds those python binaries to the system for alternatives lists.  After you add them you can then set a default and easily alternate as well.  If you wish to assign it is easy.  I will also add this works for many different things on the system.

update-alternatives --config python