0

I am trying to install the carla package in pyCharm. I get this error:

Collecting carla


Using cached carla-0.9.5.tar.gz (3.9 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/g7/zcxwx2kd1271sjr_g1z45lqw0000gn/T/pip-install-2o7825mv/carla_f852b9e62105468aa17c77b2df74f144/setup.py", line 114, in <module>
          ext_modules=get_libcarla_extensions(),
        File "/private/var/folders/g7/zcxwx2kd1271sjr_g1z45lqw0000gn/T/pip-install-2o7825mv/carla_f852b9e62105468aa17c77b2df74f144/setup.py", line 31, in get_libcarla_extensions
          linux_distro = platform.dist()[0]  # pylint: disable=W1505
      AttributeError: module 'platform' has no attribute 'dist'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

I do not know what the problem is. I have the latest oio, wheel and setuptool (23.1.2, 0.40.0, 67.7.2)

I have macOS? could that be the problem? What can I do to find the source of the error?

Chuck
  • 43
  • 4
  • That's a bug [fixed 3 years ago](https://github.com/carla-simulator/carla/commit/13d9ac7de1af7d96d60b7302b996113019096e4d). You should install the most recent version. – Klaus D. May 04 '23 at 10:55

1 Answers1

0

The problem is, that carla does not have whl files for MacOS and 0.9.5 is the most recent version with sources attached to it. It happens to be incompatible with your python version though, as the setup.py contains code that does not work in python >=3.8, see here.

As Klaus D. has mentioned in comments, you should try to install a more recent version. For that you will have to install from github. Download https://github.com/carla-simulator/carla/tree/master/PythonAPI/carla and then run

python setup.py install
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
  • `platform.dist` is still in 3.7, is removed in 3.8: https://docs.python.org/3.7/library/platform.html#platform.dist – phd May 04 '23 at 14:07
  • @phd thanks for pointing that out. Looks like the 3.5 docs (when it was deprecated) are incorrect in that regard. – FlyingTeller May 04 '23 at 14:12
  • Most probably not incorrect but the Core Team changed there mind afterwards and extended the life of `platform.dist` one more release. – phd May 04 '23 at 14:14
  • `python setup.py install` fails on `import distro`. The package is in `requirements.txt` so 1st run `pip install -r requirements.txt`. This also fails on compiling `numpy` because `requirements.txt` incorrectly fixes `numpy` version. After fixing `requirements.txt` installation fails because said `distro` recognizes my host as "Debian GNU/Linux" while `setup.py` expects just "debian". In short the package installation is broken on too many levels. – phd May 04 '23 at 14:19