f1tenth / f1tenth_gym

This is the repository of the F1TENTH Gym environment.
MIT License
169 stars 104 forks source link

Installation Steps Fail for Docker and PIP #138

Open ctessler opened 3 months ago

ctessler commented 3 months ago

Describe the bug Neither set of instructions for installing the f1tenth_gym work correctly. The instructions were taken from https://github.com/f1tenth/f1tenth_gym. There appears to be a problem with f11-gym version 0.19.0, that's referenced from setup.py in the f1tenth_gym master branch.

I tried modifying setup.py from https://github.com/f1tenth/f1tenth_gym to use a more recent version of the gym, the lowest version that passes this step is 0.22.0. However, this causes additional errors, so the fix is something more involved than a version bump to the gym package.

Reproduction using docker Steps to reproduce:

  1. git clone https://github.com/f1tenth/f1tenth_gym.git
  2. cd f1tenth_gym
  3. docker build -t f1tenth_gym_container -t Dockerfile .
  4. Observe

    <<< SNIP >>> WARNING: Ignoring version 0.19.0 of gym since it has invalid metadata: Requested gym==0.19.0 from https://files.pythonhosted.org/packages/af/f5/958aa7f6f5b685896dbddf7436d06755bf23b12c65889b156566dd06c514/gym-0.19.0.tar.gz (from f110-gym==0.2.1) has invalid metadata: Expected end or semicolon (after version specifier) opencv-python>=3.

    
    Please use pip<24.1 if you need to use this version.
    INFO: pip is looking at multiple versions of f110-gym to determine which version is compatible with other requirements. This could take a while.
    ERROR: Could not find a version that satisfies the requirement gym==0.19.0 (from f110-gym) (from versions: 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.2.11, 0.2.12, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.8, 0.4.9, 0.4.10, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8.0.dev0, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5, 0.10.8, 0.10.9, 0.10.11, 0.11.0, 0.12.0, 0.12.1, 0.12.4, 0.12.5, 0.12.6, 0.13.0, 0.13.1, 0.14.0, 0.15.3, 0.15.4, 0.15.6, 0.15.7, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.18.0, 0.18.3, 0.19.0, 0.20.0, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.24.0, 0.24.1, 0.25.0, 0.25.1, 0.25.2, 0.26.0, 0.26.1, 0.26.2)
    ERROR: No matching distribution found for gym==0.19.0
    The command '/bin/sh -c cd /f1tenth_gym &&     pip3 install -e .' returned a non-zero code: 1`

Expected behavior A successful installation of a docker container for the gym.

Reproduction using PIP

  1. mkdir gymenv
  2. cd gymenv
  3. virtualenv .
  4. source bin/activate
  5. git clone https://github.com/f1tenth/f1tenth_gym.git
  6. cd f1tenth_gym
  7. Observe

Collecting gym==0.19.0 (from f110_gym==0.2.1) Using cached gym-0.19.0.tar.gz (1.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [3 lines of output] /tmp/pip-build-env-nomrz7fv/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py:268: UserWarning: Unknown distribution option: 'tests_require' warnings.warn(msg) error in gym setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Desktop (please complete the following information):

AhmadAmine998 commented 3 months ago

Thank you for raising this issue. This is a recent bug due to incompatibility between pip version >=24.0 and gym version 0.19.0. You can resolve this when using virtualenv by downgrading pip to 24.0 as follows:

Fix using PIP

  1. mkdir gymenv
  2. cd gymenv
  3. virtualenv .
  4. source bin/activate
  5. pip install --upgrade pip==24.0
  6. git clone https://github.com/f1tenth/f1tenth_gym.git
  7. cd f1tenth_gym
  8. pip install -e .

The same can be done for the Dockerfile by changing line 45 as follows:

Fix using Docker

  1. Modify line 45 of Dockerfile from RUN pip3 install --upgrade pip to RUN pip3 install --upgrade pip==24.0
  2. docker build -t f1tenth_gym_container -f Dockerfile .
  3. docker run --gpus all -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix f1tenth_gym_container

I will push this fix to the main branch tomorrow

ctessler commented 3 months ago

Thank you for the helpful response. Unfortunately, the suggested fix does not resolve the issue. I have attached the output of the PIP installation steps pip_output.txt.

ctessler commented 3 months ago

The installation instructions for Docker work, running an example is failing (but that's likely because of an nvidia-container problem).

tungkaG commented 2 months ago

Hello, i tried the installation today using pip 21.0 and python 3.8.19. I did the following steps: pip install pip==21.0 pip install opencv-python==3.4.2.17 # installing gym 0.19.0 before doing this throws an error

Then navigate to the f1tenth_gym and install the required packages cd f1tenth_gym pip install -e .

AhmadAmine998 commented 2 months ago

@tungkaG can you please include the output of the installation?