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

I can't build my ROS packages with Python3 virtual environment.

asked 2020-02-15 03:58:17 -0600

kane_choigo gravatar image

Hello, I'm using ROS kinetic with Ubuntu 16.04.

Actually I'm trying to create the environment for Reinforcement Learning, and I'd like to use openai_ros and gym module.

These modules are not compatible with Python 2 which is basic of ROS packages, as far as I know, unfortunately, so I created virtual python3 workspace with virtualenv.

To make full use of these, I also installed the necessary packages and compiled with,

$ catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/home/user/python3_ws/py3venv/bin/python

But the error has occurred,

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):Could NOT find PythonInterp: Found unsuitable version "1.4", but required  is at least "2" (found /home/user/python3_ws/py3venv/bin/python)

Just so you know, the python file of /home/user/python3_ws/py3venv/bin/python is not readable at least.

I really do not have any ideas about how to resolve it, because I've never seen this kinds of errors.

If anyone who can troubleshoot this, would you please give me a helpful advice?

Thanks in advance :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-15 04:46:39 -0600

gvdhoorn gravatar image

Please see whether one of the answers to #q237613 help. I believe my answer there should have sufficient detail.

As an alternative: use rospypi/simple to install just the required bits of rospy et al, without building a full ROS Kinetic with Python 3. You should be able to install that directly into your virtualenv with OpenAI and Gym.

If all you want to do is exchange a few messages over some topics, you would most likely not need a full ROS Kinetic, but rospy should be enough.

edit flag offensive delete link more

Comments

Thanks for your quick reply. I referred to your answer and I also noticed this comment:

this only builds a bare-bones ROS Kinetic with Python 3. No Open CV or other 'complex' packages/nodes. For many use-cases this is already quite sufficient though. As such, this is not an answer to the general problem of how to build all of ROS 1 with Python 3 support.

I already have Open CV and other packages in Python 2.7 env of local PC, I just want to make use of openai_ros and gym module without errors. Can I launch ROS packages of python2.7 with those of python 3 and make them interact with ROS topic at the same time?

kane_choigo gravatar image kane_choigo  ( 2020-02-15 19:12:42 -0600 )edit

Your guide worked for me, I suddenly got another question. I think I also need to make use of Keras, but I wonder I can install the ordinary Keras module as which I installed on a real local PC. What I want to say is, is there a specific Keras version for a virtual environment?

And one more, can I also install the PyTorch module in that virtual environment?

kane_choigo gravatar image kane_choigo  ( 2020-02-16 04:38:22 -0600 )edit

This is all not ROS specific. A Python virtualenv is a Python virtualenv, whether you use ROS with it or not.

The only thing important for using it with ROS is the ability to install (at least) rospy into it. With the experimental PyPi index I linked you to, you should be able to do that.

After this, you can treat the virtualenv like any other virtualenv.

As such, I would recommend you ask your questions -- or find the answers -- elsewhere, as they are simply about "Python 3 + virtualenv + some package/library", for which you'd have the entirety of the internet to find information about.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-16 04:58:01 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2020-02-15 03:58:17 -0600

Seen: 1,679 times

Last updated: Feb 15 '20