carla-simulator/ros-bridge

Build in Ubuntu 20.04 Python3.6 issue

mgmike opened this issue · 0 comments

Ubuntu 20.04
Carla 0.9.13
Ros2 Foxy

I am running colcon build and have gotten the following error

--- stderr: carla_ros_scenario_runner_types
/bin/sh: 1: /usr/bin/python3.6: not found
make[2]: *** [carla_ros_scenario_runner_types__py/CMakeFiles/carla_ros_scenario_runner_types__py.dir/build.make:150: rosidl_generator_py/carla_ros_scenario_runner_types/_carla_ros_scenario_runner_types_s.ep.rosidl_typesupport_fastrtps_c.c] Error 127
make[1]: *** [CMakeFiles/Makefile2:553: carla_ros_scenario_runner_types__py/CMakeFiles/carla_ros_scenario_runner_types__py.dir/all] Error 2
make: *** [Makefile:141: all] Error 2


I am still new to reading build scripts and CMake files, but it seems like something in the build process requires python3.6. I didn't expect this as Ubuntu uses python3.8 by default and I couldn't find any documentation that mentioned a required python version. I installed python3.6 via apt and got another error.

--- stderr: carla_msgs
ImportError in template '/opt/ros/foxy/share/rosidl_generator_py/cmake/../resource/_msg.py.em':

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.6 from "/usr/bin/python3.6",
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version "1.17.4" you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'

ImportError when expanding '_idl.py.em' into '/home/mike/carla-ros-bridge/build/carla_msgs/rosidl_generator_py/carla_msgs/msg/_carla_bounding_box.py':

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.6 from "/usr/bin/python3.6",
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version "1.17.4" you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'

Error processing idl file: /home/mike/carla-ros-bridge/build/carla_msgs/rosidl_adapter/carla_msgs/msg/CarlaBoundingBox.idl
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numpy/core/init.py", line 17, in
from . import multiarray
File "/usr/lib/python3/dist-packages/numpy/core/multiarray.py", line 14, in
from . import overrides
File "/usr/lib/python3/dist-packages/numpy/core/overrides.py", line 7, in
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/ros/foxy/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 40, in
sys.exit(main())
File "/opt/ros/foxy/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 36, in main
return generate_py(args.generator_arguments_file, args.typesupport_impls.split(';'))
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_generator_py/generate_py_impl.py", line 61, in generate_py
generate_files(generator_arguments_file, mapping)
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_cmake/init.py", line 96, in generate_files
raise(e)
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_cmake/init.py", line 91, in generate_files
post_process_callback=post_process_callback)
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_cmake/init.py", line 149, in expand_template
interpreter.string(template_content, template_path, locals=data)
File "/usr/lib/python3/dist-packages/em.py", line 2391, in string
self.safe(scanner, True, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/usr/lib/python3/dist-packages/em.py", line 1547, in run
self.subrun(info[0][1], interpreter, locals)
File "/usr/lib/python3/dist-packages/em.py", line 1631, in subrun
token.run(interpreter, locals)
File "/usr/lib/python3/dist-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2595, in execute
_exec(statements, self.globals, locals)
File "", line 5, in
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_cmake/init.py", line 198, in _expand_template
interpreter.string(content, str(template_path), kwargs)
File "/usr/lib/python3/dist-packages/em.py", line 2391, in string
self.safe(scanner, True, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/usr/lib/python3/dist-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/usr/lib/python3/dist-packages/em.py", line 2595, in execute
_exec(statements, self.globals, locals)
File "", line 3, in
File "/usr/lib/python3/dist-packages/numpy/init.py", line 142, in
from . import core
File "/usr/lib/python3/dist-packages/numpy/core/init.py", line 47, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.6 from "/usr/bin/python3.6",
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version "1.17.4" you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'

Exception ignored in: <bound method Interpreter.del of <empy pseudomodule/interpreter at 0x7faa91dd06a0>>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/em.py", line 2094, in del
File "/usr/lib/python3/dist-packages/em.py", line 2157, in shutdown
File "/usr/lib/python3/dist-packages/em.py", line 2646, in finalize
File "/usr/lib/python3/dist-packages/em.py", line 2200, in push
AttributeError: '_io.TextIOWrapper' object has no attribute 'push'
make[2]: *** [carla_msgs__py/CMakeFiles/carla_msgs__py.dir/build.make:206: rosidl_generator_py/carla_msgs/_carla_msgs_s.ep.rosidl_typesupport_fastrtps_c.c] Error 1
make[1]: *** [CMakeFiles/Makefile2:553: carla_msgs__py/CMakeFiles/carla_msgs__py.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

This error looks like I am missing requirements such as numpy, but I have numpy installed and it is the correct version 1.17.4.

It seems like I have two routes to solve this, either:

  • A) Install all the required packages for python3.6
    • The issue with this is that I already have them for python3.8 and I am not sure if they will just work for python3.6 or if I will have to install others.
  • B) Make the default python version python3.8 in the build.
    • My default python version in update-alternatives is 3.8 but I am pretty new to big python projects and builds like this and dont know how to debug and find where to change 3.6 to 3.8 in the scripts.
    • I have also tried to set the CARLA_ROOT and PYTHONPATH env variables to the python3.8.egg file in carla but I still gett the same error.

I am very lost here and would appreciate any help, thank you!