Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility #2427

Closed
15 tasks done
dirk-thomas opened this issue Oct 23, 2013 · 17 comments
Closed
15 tasks done

Python 3 compatibility #2427

dirk-thomas opened this issue Oct 23, 2013 · 17 comments

Comments

@dirk-thomas
Copy link
Member Author

dirk-thomas commented Dec 4, 2013

Now getting the unit tests to pass again...

@jack-oquin
Copy link
Member

What package versions are required to run this, and on what operating system?

@dirk-thomas
Copy link
Member Author

Currently I am building everything on Saucy from source.

@jack-oquin
Copy link
Member

I made the mistake of installing Saucy on one of my systems recently, in hopes of doing Python3 migration for some the many packages I maintain. Working on Precise has been fruitless, so far.

But, there are no ROS Saucy packages available yet (AFAICT), not even ros-infrastructure.

Can you post a .rosinstall or other hints so I can check this code out on Saucy and try to test and convert my own modules? So far, this seemingly simple task has been amazingly difficult. A wiki page for building from source on Saucy would be great. I am surely not the only person needing that information.

@vrabaud
Copy link
Member

vrabaud commented Dec 5, 2013

Hi, I have done that before (but have NOT tested it with Saucy) while
waiting for the final ROS version. Keep the following in your
/etc/apt/sources.list
deb http://packages.ros.org/ros-shadow-fixed/ubuntu raring main
(yes, raring !)
It might totally fail because of dependencies but I'll cross my fingers for
you :)

On Thu, Dec 5, 2013 at 4:41 PM, jack-oquin notifications@github.com wrote:

I made the mistake of installing Saucy on one of my systems recently, in
hopes of doing Python3 migration for some the many packages I maintain.
Working on Precise has been fruitless, so far.

But, there are no ROS Saucy packages available yet (AFAICT), not even
ros-infrastructure.

Can you post a .rosinstall or other hints so I can check this code out on
Saucy and try to test and convert my own modules? So far, this seemingly
simple task has been amazingly difficult. A wiki page for building from
source on Saucy would be great. I am surely not the only person needing
that information.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2427#issuecomment-29908132
.

@dirk-thomas
Copy link
Member Author

@vrabaud You should definitely not use the raring repository for Saucy. Period.

@jack-oquin All Python packages have already been released for Saucy some weeks ago (the version numbers are listed above). Installing them (from the saucy repo) should work fine. All ROS packages need to be compiled from source. Some have the latest patches already committed to the latest branch (if checked above) then it is sufficient to checkout the source repo. For some others (if not yet checked) the latest patches are still in a pull request - in that case you will need to checkout the branch (probably coming from a forked repo) of the pull request.

Currently you should not yet expect anything to really run. E.g. even starting roscore does not yet work well. So it might be too early to work on converting custom packages (beside general Python 3 fixes in your code base).

@jack-oquin
Copy link
Member

Thanks, Dirk.

It would save me hours of effort if you have a .rosinstall file I could use.

@dirk-thomas
Copy link
Member Author

Well, I hope it would not take that long to checkout a dozen repos but I have created a gist with the repos: https://gist.github.com/dirk-thomas/7832421
It contains all default branches of the repos (which is either hydro-devel or groovy-devel) except the ones listed above which need my the forked versions of the repos

@jack-oquin
Copy link
Member

Thanks!

What takes time is figuring out exactly what repos to get and which branch in each one to use. It does not take very many wrong guesses before the subsequent {debug; try_something_else} cycle uses up an hour or two.

@dirk-thomas
Copy link
Member Author

I merged most of the huge ros_comm PR to the indigo-devel branch. If I find more time I will look into the remaining issues with genpy and some ros_comm tests.

@dirk-thomas
Copy link
Member Author

The "best" way to test Python 3 support on Trusty is:

  • create virtual environment and activate it
  • rm venv/bin/python and replace it with a dummy shell script which returns an error code 1
  • avoid bash to use system python executable (even if the venv is in the beginning of the PATH): alias python=venv/bin/python
    • ensure that when invoking python from a a different folder it fails
  • install python packages in venv using pip
  • build packages with python3 ./src/catkin/bin/catkin_make_isolated -DPYTHON_VERSION=3 --install

@jack-oquin
Copy link
Member

Need to mention catkin_install_python() here, along with detailed "how to test" instructions:

@dirk-thomas
Copy link
Member Author

I don't think that wiki page is the right place. It is completely unrelated to catkin and ROS but only describes differences in Python 2 and Python 3 code. And I think it should stay that way (beside linking other pages).

A separate page on how to use Python 3 should be created - but I don't have much spare time to write it in the near future. My previous comment was more of a brain dump when I ran into the alias issue.

@jack-oquin
Copy link
Member

It is discouraging that telling people how they should write Python code for ROS is something done in one's "spare time".

@dirk-thomas
Copy link
Member Author

We made a decision several months ago that we won't proceed with working on Python 3 support for Indigo.

I am using my free time to merge already existing pull requests in order to not loose all the work done back then (since they were already not mergable out-of-the-box anymore). Please excuse me for not spending more of my free time on writing additional tutorials and documentation.

@dirk-thomas
Copy link
Member Author

I will close this ticket since there is no specific work on this item. In the meantime a couple of platforms are using Python 3 by default and over time patches have been contributed to various parts of ROS. If further work is necessary please just create tickets / pull requests against the specific ROS package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants