Ros2 rolling mixes python versions
Hi, I just upgraded Ubuntu from 20.04 to 22.04 and installed ros2 rolling. When building ros messages I get an error that a python module is missing. When I print sys.path in the failing script it shows:
['/opt/ros/rolling/lib/rosidl_generator_py', '/opt/ros/rolling/lib/python3.10/site-packages', '/opt/ros/rolling/local/lib/python3.10/dist-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/someuser/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
And sys.version shows that python3.6 is used. When I run the same commands in a python console I get 3.10 and all paths are set correctly. Does anyone know how to make ros use the correct python version?
did you solve this problem? i got same problem
I can't remember what I did exactly but I think there might be two solutions. Either remove the old python version from your system or create a virtualenv and make it use a specific version via the -p command argument.
Thank you :)