MineDojo / MineDojo

Building Open-Ended Embodied Agents with Internet-Scale Knowledge
MIT License
1.83k stars 161 forks source link

Problem pip installing #69

Open finegan-dollak opened 1 year ago

finegan-dollak commented 1 year ago

I struggled somewhat to install on a Mac with an M1 using the direct install method from https://docs.minedojo.org/sections/getting_started/install.html. This post includes the steps I tried and a workaround that eventually succeeded but is rather awkward; a more straightforward solution could make installation easier for others.

After following the instructions to set up JAVA_HOME and create the conda environment, I attempted pip install minedojo, which failed with the following error:

Collecting minedojo
  Downloading minedojo-0.1-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 12.0 MB/s eta 0:00:00
Collecting pyyaml (from minedojo)
  Downloading PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl (173 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.0/174.0 kB 23.1 MB/s eta 0:00:00
Collecting jinja2 (from minedojo)
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting gym==0.21.0 (from minedojo)
  Downloading gym-0.21.0.tar.gz (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 44.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  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]

  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.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I switched to following the instructions to install the latest main branch:

git clone https://github.com/MineDojo/MineDojo && cd MineDojo
pip install -e .

and encountered the same problem.

After some digging, I found that the issue arises from using gym==0.21 (see details here). Using the fix documented there allowed me to install gym==0.21, but it also caused new errors with pip install -e because it prevented installation of lxml.

I tried a clean conda environment, replaced gym==0.21 with gym in requirements.txt. This was enough to successfully run pip install -e ., but using a newer version of gym causes an assertion error when I tried to run validate_install.py, so I had to move back to gym 0.21. To do this, I ran

pip install setuptools==65.5.0 pip==21
pip install gym==0.21

which worked because I had already installed all the other packages. I can now run validate_install.py successfully. I'm not sure if a user would be able to make pip install minedojo work directly.

My system info: macOS Ventura 13.4 on Apple M1 Pro Python 3.9.16

MegalithOfficial commented 1 year ago

it doesnt work on me

ThisIsJeron commented 1 year ago

note: your pip and pip3 may be different instances. I substituted

pip install setuptools==65.5.0 pip==21
pip install gym==0.21

with

pip3 install setuptools==65.5.0 pip==21
pip3 install gym==0.21

and that worked for me

astelmach01 commented 1 year ago

I got rid of the gym==0.21 to just gym

fangyuan-ksgk commented 1 year ago

it works for me

pip install setuptools==65.5.0 pip==21 pip install gym==0.21 pip install minedojo

BTW, this only allows the pip install minedojo to come through, but import minedojo still gives error, which is fixed by changing file: /minedojo/tasks/init.py, line 29 according to https://docs.python.org/3/library/importlib.resources.html#importlib.resources.path

importlib_resources.as_file(importlib_resources.files("minedojo.tasks.description_files").joinpath(fname))

fentpusher commented 5 months ago

it works for me

pip install setuptools==65.5.0 pip==21 pip install gym==0.21 pip install minedojo

BTW, this only allows the pip install minedojo to come through, but import minedojo still gives error, which is fixed by changing file: /minedojo/tasks/init.py, line 29 according to https://docs.python.org/3/library/importlib.resources.html#importlib.resources.path

importlib_resources.as_file(importlib_resources.files("minedojo.tasks.description_files").joinpath(fname))

cannot find a 'tasks' folder in minedojo , but i did find init.py and there were a lot of them