ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic gazebo
    • re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder and run catking_make ... again). Not sure if that has changed anything, though. Do not forget to source.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • make sure that python command uses python2.7
    • create your virtual environment using python -m virtualenv -p python2.7 YOURVENV
    • activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy
    • sudo apt-get install python-rospkg
    • install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it)
    • run roslaunch YOURLAUNCHFILE.launch.

In short: - Uninstall concurring packages from the base and install them in the venv again. - Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error. - Use sudo apt-get over pip install when possible (since apt install causes no version conflicts). - If you use pip install, make clear which python you use with python -m pip install so that python2.7 is definitely used.

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic gazebo
    • re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder and run catking_make ... again). Not sure if that has changed anything, though. Do not forget to source.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • make sure that python command uses python2.7
    • create your virtual environment using python -m virtualenv -p python2.7 YOURVENV
    • activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy
    • sudo apt-get install python-rospkg
    • install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it)
    • run roslaunch YOURLAUNCHFILE.launch.

In short: - short:

  • Uninstall concurring packages from the base and install them in the venv again. - again.

  • Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error. - error.

  • Use sudo apt-get over pip install when possible (since apt install causes no version conflicts). - conflicts).

  • If you use pip install, make clear which python you use with python -m pip install so that python2.7 is definitely used.

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • uninstall Uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic gazebo
    • re-install melodic.
    • Re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder and run catking_make ... again). Not sure if that has changed anything, though. Do not forget to source.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • make Make sure that python command uses python2.7
    • create python2.7.
    • Create your virtual environment using python -m virtualenv -p python2.7 YOURVENV
    • activate .
    • Activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy (apt-get installs globally, but elsewise, I got errors when launching)
    • sudo apt-get install python-rospkg
    • install (same as with scipy, but better keep to an install inside your venv using pip)
    • Install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it)
    • run it).
    • Run roslaunch YOURLAUNCHFILE.launch.

In short:

  • Uninstall concurring packages from the base and install them in the venv again.

  • Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error.

  • Use sudo apt-get over pip install when over sudo apt-get if possible (since apt (apt install causes no version conflicts).conflicts and sometimes could help me going on, on the other hand apt-get does not care about the venv but installs globally, which is not the best approach in bigger projects. It is a bit ambiguous, see for example also comments at https://stackoverflow.com/questions/47506800/install-packages-into-virtual-environment-with-apt-get: sometimes apt-get can solve it for whatever reason...).

  • If you use pip install, make clear which python you use with python -m pip install so that python2.7 is definitely used.(that is somehow best practice, check python -V = 2.7 if that is needed.

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • Uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic.
    • Re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder and run folder; source ros; compile with catking_make ... again). again; source compilation). Not sure if that has changed anything, though. Do not forget to source.in this rospkg case, though.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • Make sure that python command uses python2.7.
    • Create your virtual environment using python -m virtualenv -p python2.7 YOURVENV.
    • Activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy (apt-get installs globally, but elsewise, I got errors when launching)
    • sudo apt-get install python-rospkg (same as with scipy, but better keep to an install inside your venv using pip)
    • Install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it).
    • Run roslaunch YOURLAUNCHFILE.launch.

In short:

  • Uninstall from the base any possibly concurring packages from the base that are only needed in your venv (especially those which have not been installed with sudo apt) and install them in the venv again.that are not part of the default base.

  • Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error.

  • Use pip install over sudo apt-get if possible (apt install causes no version conflicts and sometimes could help me going on, on the other hand apt-get does not care about the venv but installs globally, which is not the best approach in bigger projects. It is a bit ambiguous, see for example also comments at https://stackoverflow.com/questions/47506800/install-packages-into-virtual-environment-with-apt-get: sometimes apt-get can solve it for whatever reason...).

  • If you use pip install, make clear which python you use with python -m pip install (that is somehow best practice, check python -V = 2.7 if that is needed.

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • Uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic.
    • Re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder; source ros; compile with catking_make catkin_make ... again; source compilation). Not sure if that has changed anything, in this rospkg case, though.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • Make sure that python command uses python2.7.
    • Create your virtual environment using python -m virtualenv -p python2.7 YOURVENV.
    • Activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy (apt-get installs globally, but elsewise, I got errors when launching)
    • sudo apt-get install python-rospkg (same as with scipy, but better keep to an install inside your venv using pip)
    • Install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it).it). In case that there are issues with the old python2.7, take the latest possible version of a package when using pip2 / python -m pip, e.g. I had to install opencv-python==4.2.0.32 because the later opencv was not supported, see Python 2.7 installing opencv via pip (virtual environment).
    • Run roslaunch YOURLAUNCHFILE.launch.

In short:

  • Uninstall from the base any possibly concurring packages that are only needed in your venv (especially those which have not been installed with sudo apt) and that are not part of the default base.

  • Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error.

  • Use pip install over sudo apt-get if possible (apt install causes no version conflicts and sometimes could help me going on, on the other hand apt-get does not care about the venv but installs globally, which is not the best approach in bigger projects. It is a bit ambiguous, see for example also comments at https://stackoverflow.com/questions/47506800/install-packages-into-virtual-environment-with-apt-get: sometimes apt-get can solve it for whatever reason...).

  • If you use pip install, make clear which python you use with python -m pip install (that is somehow best practice, check python -V = 2.7 if that is needed.

I solved that error by the following steps, I do not know which one is essential and which one can be left out.

  • In the base environment:
    • Uninstall any Python packages (scipy, pyyaml, rospkg, ...) that I have accidentally installed outside my virtual environment (Python3.6, Python3.7, Python2.7) and that are only meant for the Python2.7 virtual env that I use for melodic.
    • Re-install catkin workspace (remove build, devel, and CMake_Lists.txt in /src from your project folder; source ros; compile with catkin_make ... again; source compilation). Not sure if that has changed anything, in this rospkg case, though.
    • sudo apt-get install virtualenv
    • sudo apt-get install python-pip
    • Make sure that python command uses python2.7.
    • Create your virtual environment using python -m virtualenv -p python2.7 YOURVENV.
    • Activate YOURVENV with source YOURVENV/bin/activate.
  • In YOURVENV:
    • sudo apt-get install python-scipy (apt-get installs globally, but elsewise, I got errors when launching)
    • sudo apt-get install python-rospkg (same as with scipy, but better keep to an install inside your venv using pip)
    • Install other needed packages using python -m pip install ... (or sudo apt-get install ..., but I did not use it). In case that there are issues with the old python2.7, take the latest possible version of a package when using that is avaialbe for pip2 / python -m pip, e.g. . I had to install opencv-python==4.2.0.32 because the later opencv was not supported, see Python 2.7 installing opencv via pip (virtual environment).
    • Run roslaunch YOURLAUNCHFILE.launch.

In short:

  • Uninstall from the base any possibly concurring packages that are only needed in your venv (especially those which have not been installed with sudo apt) and that are not part of the default base.

  • Re-installing the catkin workspace is not that much work in the end, that is why I would generally recommend it when in doubts about the cause of an error.

  • Use pip install over sudo apt-get if possible (apt install causes no version conflicts and sometimes could help me going on, on the other hand apt-get does not care about the venv but installs globally, which is not the best approach in bigger projects. It is a bit ambiguous, see for example also comments at https://stackoverflow.com/questions/47506800/install-packages-into-virtual-environment-with-apt-get: sometimes apt-get can solve it for whatever reason...).

  • If you use pip install, make clear which python you use with python -m pip install (that is somehow best practice, check python -V = 2.7 if that is needed.