Help with building a Python3 virtual environment


I am still new to using ROS. I have a similar problem regarding this topic.

I am attempting to build a Python3 virtual environment to run a package that is coded in Python3, in my laptop’s ROS Melodic.

The package in question is located in this link: GitHub - osrf/autodock: ROS packages for automatic docking

My procedure is as below:

  1. I ran the command sudo apt-get install python-catkin-tools python3-dev python3-numpy.

  2. I ran the command sudo pip install virtualenv. However, my error message said that there was no pip. So, I ran the command sudo apt install python-pip, and then I ran the previous command.

  3. I continued to follow the instructions in the notebook until the activation of the python3_ws.

  4. I skipped the steps regarding installing dependencies until I ran the command “catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/home/user/python3_ws/py3venv/bin/python”. However, it resulted in the following error:

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonInterp: Found unsuitable version “1.4”, but required
is at least “2” (found /home/user/python3_ws/py3venv/bin/python)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindPythonInterp.cmake:152 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/opt/ros/melodic/share/catkin/cmake/python.cmake:4 (find_package)
/opt/ros/melodic/share/catkin/cmake/all.cmake:164 (include)
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/dan501mk2/python3_ws/build/CMakeFiles/CMakeOutput.log”.
Invoking “cmake” failed

I tried to follow the solutions that were available previously, such as using catkin build but to no avail. I would like to add that this isn’t my first attempt to build the virtual environment. I followed the instructions, got stuck at the exact same error as described, deleted the workspace and redo the instructions again. I deleted the package in question and redo the instructions for the virtual environment, hoping there would be some changes in the ROS behaviour, but the error still remains the same.

As far I understand the error, it appears that the virtual environment is attempting to search for the wrong Python Interpreter. However, I do not understand how it happened. Any tips?

I found the solution. My directory for the DPYTHON EXECUTABLE was wrong. I apologize for any inconvenience


This topic was automatically closed after 6 days. New replies are no longer allowed.