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

conda env create -f environment.yml #50

Open
AasherH opened this issue Nov 15, 2023 · 11 comments
Open

conda env create -f environment.yml #50

AasherH opened this issue Nov 15, 2023 · 11 comments

Comments

@AasherH
Copy link

AasherH commented Nov 15, 2023

I cannot get the "conda env create -f environment.yml" command to work on my machine. I keep receiving the following errors:

Using cached gym-0.18.0.tar.gz (1.6 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'

Pip subprocess error:
Running command git clone --filter=blob:none --quiet https://github.com/JannerM/doodad.git /tmp/pip-req-build-926mvkq8
Running command git checkout -b janner --track origin/janner
Switched to a new branch 'janner'
Branch 'janner' set up to track remote branch 'janner' from 'origin'.
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
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]

I have tried manually installing every dependency instead of using the .yml file but still have run into issues. Anyone have any fixes?

@jannerm
Copy link
Owner

jannerm commented Nov 16, 2023

What version of pip do you have?

@AasherH
Copy link
Author

AasherH commented Nov 16, 2023

I am using pip 23.0.1. and Ubuntu 22.04. I also will note that when manually installing the dependencies in the .yml file, the main issues were compatibility between mujoco and gym. For example, commenting out the gym=0.18.0 installation in the .yml file, I get the following errors:

Pip subprocess error:
Running command git clone --filter=blob:none --quiet https://github.com/JannerM/doodad.git /tmp/pip-req-build-z1m78mwk
Running command git checkout -b janner --track origin/janner
Switched to a new branch 'janner'
Branch 'janner' set up to track remote branch 'janner' from 'origin'.
Running command git clone --filter=blob:none --quiet https://github.com/aravindr93/mjrl /tmp/pip-install-xnyhflty/mjrl_e6e2358e931041e19fd0e94ac3e67343
error: subprocess-exited-with-error

× Building wheel for mujoco-py (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [95 lines of output]
running bdist_wheel
running build
performance hint: mujoco_py/cymj.pyx:67:5: Exception check on 'c_warning_callback' will always require the GIL to be acquired.
Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
2. Use an 'int' return type on the function to allow an error code to be returned.
performance hint: mujoco_py/cymj.pyx:104:5: Exception check on 'c_error_callback' will always require the GIL to be acquired.
Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
2. Use an 'int' return type on the function to allow an error code to be returned.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      See c_warning_callback, which is the C wrapper to the user defined function
      '''
      global py_warning_callback
      global mju_user_warning
      py_warning_callback = warn
      mju_user_warning = c_warning_callback
                         ^
  ------------------------------------------------------------
  
  mujoco_py/cymj.pyx:92:23: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      See c_warning_callback, which is the C wrapper to the user defined function
      '''
      global py_error_callback
      global mju_user_error
      py_error_callback = err_callback
      mju_user_error = c_error_callback
                       ^
  ------------------------------------------------------------
  
  mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
  Removing old mujoco_py cext /tmp/pip-install-xnyhflty/mujoco-py_ad196a9625654fe7992f3cbc753dd639/mujoco_py/generated/cymj_2.0.2.13_38_linuxcpuextensionbuilder_38.so

@kensukenk
Copy link

I have the same issues on ubuntu 20.04

@kensukenk
Copy link

I was able to resolve the issue with gym from https://stackoverflow.com/questions/76129688/why-is-pip-install-gym-failing-with-python-setup-py-egg-info-did-not-run-succ

I also ran into the second issue with mujoco-py but this issue went away after installing mujoco-py==2.0.2.5.

@yibo2222
Copy link

I was able to resolve the issue with gym from https://stackoverflow.com/questions/76129688/why-is-pip-install-gym-failing-with-python-setup-py-egg-info-did-not-run-succ

I also ran into the second issue with mujoco-py but this issue went away after installing mujoco-py==2.0.2.5.

Can I see your environment.yml file? I tried your fix for the second issue, but my pip installation fails when I try create the environment

@Lycanthropy-Tori
Copy link

I am using pip 23.0.1. and Ubuntu 22.04. I also will note that when manually installing the dependencies in the .yml file, the main issues were compatibility between mujoco and gym. For example, commenting out the gym=0.18.0 installation in the .yml file, I get the following errors:

Pip subprocess error: Running command git clone --filter=blob:none --quiet https://github.com/JannerM/doodad.git /tmp/pip-req-build-z1m78mwk Running command git checkout -b janner --track origin/janner Switched to a new branch 'janner' Branch 'janner' set up to track remote branch 'janner' from 'origin'. Running command git clone --filter=blob:none --quiet https://github.com/aravindr93/mjrl /tmp/pip-install-xnyhflty/mjrl_e6e2358e931041e19fd0e94ac3e67343 error: subprocess-exited-with-error

× Building wheel for mujoco-py (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [95 lines of output] running bdist_wheel running build performance hint: mujoco_py/cymj.pyx:67:5: Exception check on 'c_warning_callback' will always require the GIL to be acquired. Possible solutions: 1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions. 2. Use an 'int' return type on the function to allow an error code to be returned. performance hint: mujoco_py/cymj.pyx:104:5: Exception check on 'c_error_callback' will always require the GIL to be acquired. Possible solutions: 1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions. 2. Use an 'int' return type on the function to allow an error code to be returned.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      See c_warning_callback, which is the C wrapper to the user defined function
      '''
      global py_warning_callback
      global mju_user_warning
      py_warning_callback = warn
      mju_user_warning = c_warning_callback
                         ^
  ------------------------------------------------------------
  
  mujoco_py/cymj.pyx:92:23: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      See c_warning_callback, which is the C wrapper to the user defined function
      '''
      global py_error_callback
      global mju_user_error
      py_error_callback = err_callback
      mju_user_error = c_error_callback
                       ^
  ------------------------------------------------------------
  
  mujoco_py/cymj.pyx:127:21: Cannot assign type 'void (const char *) except * nogil' to 'void (*)(const char *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'void (const char *) except * nogil'.
  Removing old mujoco_py cext /tmp/pip-install-xnyhflty/mujoco-py_ad196a9625654fe7992f3cbc753dd639/mujoco_py/generated/cymj_2.0.2.13_38_linuxcpuextensionbuilder_38.so

I have met same problem. Have you solved it right now?

@staycoolish
Copy link

If you install mujoco-py-2.0.2.8, the environment will be created, but then you won't be able to use it due to compatibility issues. I tried to use the planning prompt - before which I downloaded the weights following the tutorial page - and it didn't work. Here is the latest environment file I have:

name: diffuser
channels:
- defaults
- conda-forge
dependencies:
- python=3.8
- setuptools == 63.2.0
- wheel == 0.38.4
- pip == 22.2.2
- patchelf 
- Cmake
- pip:
    - -f https://download.pytorch.org/whl/torch_stable.html
    - numpy
    - gym==0.18.0
    - mujoco-py==2.0.2.13
    - matplotlib==3.3.4
    - torch==1.9.1+cu111
    - typed-argument-parser
    - git+https://github.com/Farama-Foundation/d4rl@f2a05c0d66722499bf8031b094d9af3aea7c372b#egg=d4rl
    - scikit-image==0.17.2
    - scikit-video==1.1.11
    - gitpython
    - einops
    - ffmpeg
    - ffprobe
    - pillow==7.2.0
    - tqdm
    - pandas
    - wandb
    - flax >= 0.3.5
    - jax <= 0.2.21
    - ray==2.0.0
    - crcmod # for fast gsutil rsync on large files
    - google-api-python-client
    - cryptography
    - git+https://github.com/JannerM/doodad.git@janner
    - gdown>=4.6.0

It gives the wheel for mujoco-py error in Ubuntu 20.4.6. I opened another issue and shared a working environment.yml file there ( #58 ), the one from Diffusion Policy paper, but they seem to use free-mujoco-py, among with different packages.

@NishanthARao
Copy link

NishanthARao commented May 12, 2024

Here's what worked for me (Ubuntu 22.04):

  1. Downgraded Python 3.12 to Python 3.8 by using conda install python=3.8
  2. Install specific versions of setuptools and wheel: pip3 install setuptools==65.5.0 "wheel<0.40.0"
  3. Install cython<3 using pip3 install "cython<3"
  4. Replace mujoco-py==2.0.2.13 with mujoco-py==2.0.2.5

My environment.yml file looks like this:

name: diffuser
channels:
- defaults
- conda-forge
dependencies:
- python=3.8
- pip
- patchelf
- pip:
    - -f https://download.pytorch.org/whl/torch_stable.html
    - setuptools==65.5.0
    - wheel<0.40.0
    - mujoco-py==2.0.2.5
    - numpy
    - gym==0.18.0
    - matplotlib==3.3.4
    - torch==1.9.1+cu111
    - typed-argument-parser
    - git+https://github.com/Farama-Foundation/d4rl@f2a05c0d66722499bf8031b094d9af3aea7c372b#egg=d4rl
    - scikit-image==0.17.2
    - scikit-video==1.1.11
    - gitpython
    - einops
    - ffmpeg
    - ffprobe
    - pillow
    - tqdm
    - pandas
    - wandb
    - flax >= 0.3.5
    - jax <= 0.2.21
    - ray==2.0.0
    - crcmod # for fast gsutil rsync on large files
    - google-api-python-client
    - cryptography
    - git+https://github.com/JannerM/doodad.git@janner
    - gdown>=4.6.0

Other minor fixes I had to make:

  1. Convert np.int to np.int64 in file buffer.py
  2. Fix errors pertaining to LibGLEW.so and LibGL.so - This link helped a lot!

https://github.com/yuqingd/sim2real2sim_rad/blob/master/README.md#debugging-common-installation-errors

@staycoolish
Copy link

After @NishanthARao 's version, which I couldn't build on Ubuntu 20.04, I tried using mujoco-py 2.0.2.5, and it worked. Here is the environment file:

name: diffuser
channels:
- defaults
- conda-forge
dependencies:
- python=3.8
- setuptools == 63.2.0
- wheel == 0.38.4
- pip == 22.2.2
- patchelf == 0.15.0.0
- Cmake
- cython == 0.29.36
- pip:
    - -f https://download.pytorch.org/whl/torch_stable.html
    - numpy
    - gym==0.18.0
    - mujoco-py==2.0.2.5
    - matplotlib==3.3.4
    - torch==1.9.1+cu111
    - typed-argument-parser
    - git+https://github.com/Farama-Foundation/d4rl@f2a05c0d66722499bf8031b094d9af3aea7c372b#egg=d4rl
    - scikit-image==0.17.2
    - scikit-video==1.1.11
    - gitpython
    - einops
    - ffmpeg
    - ffprobe
    - pillow==7.2.0
    - tqdm
    - pandas
    - wandb
    - flax >= 0.3.5
    - jax <= 0.2.21
    - ray==2.0.0
    - crcmod # for fast gsutil rsync on large files
    - google-api-python-client
    - cryptography
    - git+https://github.com/JannerM/doodad.git@janner
    - gdown>=4.6.0

I only had to change np.int to np.int64 in file buffer.py (diffuser/datasets/).

@richie-live
Copy link

  • pip=24.0 # to install gym==0.18.0

@yqkqknct
Copy link

yqkqknct commented Sep 29, 2024

This environment.yml works for me (Ubuntu 22.04)

name: diffuser
channels:
- defaults
- conda-forge
dependencies:
- python=3.8
- pip=24.0
- patchelf=0.17.2
- setuptools=63.2.0
- wheel=0.38.4
- cython=0.29.36
- pip:
    - -f https://download.pytorch.org/whl/torch_stable.html
    - numpy
    - gym==0.18.0
    - mujoco-py==2.0.2.8
    - matplotlib==3.3.4
    - torch==1.9.1+cu111
    - typed-argument-parser
    - git+https://github.com/Farama-Foundation/d4rl@f2a05c0d66722499bf8031b094d9af3aea7c372b#egg=d4rl
    - scikit-image==0.17.2
    - scikit-video==1.1.11
    - gitpython
    - einops
    - ffmpeg
    - ffprobe
    - pillow
    - tqdm
    - pandas
    - wandb
    - flax >= 0.3.5
    - jax <= 0.2.21
    - ray==2.0.0
    - crcmod # for fast gsutil rsync on large files
    - google-api-python-client
    - cryptography
    - git+https://github.com/JannerM/doodad.git@janner
    - gdown>=4.6.0

Moreover, change diffuser/dataset/buffer.py's np.int to int to avoid error due to numpy deprecation on np.int syntax.

Summary about the configuration setup:

Also note here for completeness, mujoco-py does not contain the main mujoco program, so you have to install the main mujoco program first, before running the conda env create. The installation guide is https://github.com/openai/mujoco-py?tab=readme-ov-file#install-mujoco. Some handy code snippets:

sudo apt install zip -y

cd ~
wget https://www.roboti.us/download/mujoco200_linux.zip
wget https://www.roboti.us/file/mjkey.txt
unzip mujoco200_linux.zip

mkdir ~/.mujoco
mv mjkey.txt ~/.mujoco/mjkey.txt
mv mujoco200_linux ~/.mujoco/mujoco200

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mujoco200/bin

Before running the python script, you may need to export PYTHONPATH=$PYTHONPATH:DIFFUSER_PATH (replace DIFFUSER_PATH to where your diffuser path)

Another notable thing is that to run the python script in the repo, make that OpenGL Mesa is installed (as described in openai/mujoco).

sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3

If you don’t have sudo privilege, but the host already has libGL.so installed (check by ldconfig -p | grep libGL), you can also try to (reference: ethz-asl/reinmav-gym#35 (comment))

conda install -c conda-forge mesalib glew glfw
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH

The purpose of the second line is to make the conda installed OpenGL related libraries linkable during compiling.

Please click an emoji if this helps you!

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

9 participants