minerllabs / minerl

MineRL Competition for Sample Efficient Reinforcement Learning - Python Package
http://minerl.io/docs/
Other
711 stars 153 forks source link

installation error help #697

Open ImShoes opened 1 year ago

ImShoes commented 1 year ago

Trying to install and having some errors, I've never used bash before and I'm new to python so I'm having some trouble with figuring out what to do.

C:\Users\Ian Rothenbuhler>pip install git+https://github.com/minerllabs/minerl
Collecting git+https://github.com/minerllabs/minerl
  Cloning https://github.com/minerllabs/minerl to c:\users\ian rothenbuhler\appdata\local\temp\pip-req-build-coiujnox
  Running command git clone --filter=blob:none --quiet https://github.com/minerllabs/minerl 'C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-coiujnox'
  Resolved https://github.com/minerllabs/minerl to commit 123fadc3b426a7c5f3b22e9283df52037e0dd66f
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [59 lines of output]
      setup_mcp.sh: line 4: cd: too many arguments
      Cloning into 'MCP-Reborn'...
      error: chmod on /mnt/c/Users/Ian Rothenbuhler/AppData/Local/Temp/pip-req-build-coiujnox/scripts/MCP-Reborn/.git/config.lock failed: Operation not permitted
      fatal: could not set 'core.filemode' to 'false'
      setup_mcp.sh: line 7: cd: MCP-Reborn: No such file or directory
      fatal: detected dubious ownership in repository at '/mnt/c/Users/Ian Rothenbuhler/AppData/Local/Temp/pip-req-build-coiujnox'
      To add an exception for this directory, call:

          git config --global --add safe.directory '/mnt/c/Users/Ian Rothenbuhler/AppData/Local/Temp/pip-req-build-coiujnox'
      chmod: changing permissions of 'create_mcp_patch.sh': Operation not permitted
      chmod: changing permissions of 'cursors': Operation not permitted
      chmod: changing permissions of 'env_pics.py': Operation not permitted
      chmod: changing permissions of 'launch_instance_manager.py': Operation not permitted
      chmod: changing permissions of 'mcp_patch.diff': Operation not permitted
      chmod: changing permissions of 'patch_mcp.sh': Operation not permitted
      chmod: changing permissions of 'setup_intellij.sh': Operation not permitted
      chmod: changing permissions of 'setup_mcp.sh': Operation not permitted
      setup_mcp.sh: line 10: ./gradlew: No such file or directory
      patch_mcp.sh: line 5: cd: too many arguments
      patch: **** Can't open patch file /mnt/c/Users/Ian : No such file or directory
      cp: target './src/main/resources' is not a directory
      chmod: changing permissions of 'create_mcp_patch.sh': Operation not permitted
      chmod: changing permissions of 'cursors': Operation not permitted
      chmod: changing permissions of 'env_pics.py': Operation not permitted
      chmod: changing permissions of 'launch_instance_manager.py': Operation not permitted
      chmod: changing permissions of 'mcp_patch.diff': Operation not permitted
      chmod: changing permissions of 'patch_mcp.sh': Operation not permitted
      chmod: changing permissions of 'setup_intellij.sh': Operation not permitted
      chmod: changing permissions of 'setup_mcp.sh': Operation not permitted
      Traceback (most recent call last):
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-coiujnox\setup.py", line 154, in prep_mcp
          subprocess.check_call(['bash.exe', 'patch_mcp.sh'])
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['bash.exe', 'patch_mcp.sh']' returned non-zero exit status 1.

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-coiujnox\setup.py", line 214, in <module>
          prep_mcp()
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-coiujnox\setup.py", line 156, in prep_mcp
          raise RuntimeError(
      RuntimeError:
                      Running install scripts failed. Check error logs above for more information.

                      If errors are about `bash` command not found, You have at least two options to fix this:
                       1. Install Windows Subsystem for Linux (WSL. Tested on WSL 2). Note that installation with WSL
                          may seem especially slow/stuck, but it is not; it is just a bit slow.
                       2. Install bash along some other tools. E.g., git will come with bash: https://git-scm.com/downloads .
                          After installation, you may have to update environment variables to include a path which contains
                          'bash.exe'. For above git tools, this is [installation-dir]/bin.
                      After installation, you should have 'bash' command in your command line/powershell.

                      If errors are about "could not create work tree dir...", try cloning the MineRL repository
                      to a different location and try installation again.

      [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.
Miffyli commented 1 year ago

Hey! Have you installed WSL on your Windows system? I am not sure what bash installation the setup is trying to use but it seems like many of its commands is failing. WSL is the most robust way of doing things.

ImShoes commented 1 year ago

Yes I do have WSL and bash is working properly it seems, I can open terminal and type bash and it will start running.

Miffyli commented 1 year ago

hmm that is bizzare and not sure what to say :/. What happens if you call bash on the Windows side? It should launch the WSL and call bash in there. There might be some other installation of bash on your machine which gets called instead.

Beyond this I am at a loss of tips to give, as these are errors I have not seen before. Maybe checking the WSL distribution is a good idea; I have only tested this on WSL 2 with Ubuntu.

ImShoes commented 1 year ago

Yeah when I call bash in the windows terminal it launches WSL. If I call bash when already in WSL it doesn't do anything. I checked my distribution and am running WSL 2 with Ubuntu

ImShoes commented 1 year ago
C:\Users\Ian Rothenbuhler>pip install git+https://github.com/minerllabs/minerl
Collecting git+https://github.com/minerllabs/minerl
  Cloning https://github.com/minerllabs/minerl to c:\users\ian rothenbuhler\appdata\local\temp\pip-req-build-e4h27umh
  Running command git clone --filter=blob:none --quiet https://github.com/minerllabs/minerl 'C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-e4h27umh'
  Resolved https://github.com/minerllabs/minerl to commit 123fadc3b426a7c5f3b22e9283df52037e0dd66f
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      setup_mcp.sh: line 4: cd: too many arguments
      Cloning into 'MCP-Reborn'...
      Note: switching to '1.16.5-20210115'.

      You are in 'detached HEAD' state. You can look around, make experimental
      changes and commit them, and you can discard any commits you make in this
      state without impacting any branches by switching back to a branch.

      If you want to create a new branch to retain commits you create, you may
      do so (now or later) by using -c with the switch command. Example:

        git switch -c <new-branch-name>

      Or undo this operation with:

        git switch -

      Turn off this advice by setting config variable advice.detachedHead to false

      HEAD is now at 1e71be5 Update README.md

      FAILURE: Build failed with an exception.

      * Where:
      Build file '/mnt/c/Users/Ian Rothenbuhler/AppData/Local/Temp/pip-req-build-e4h27umh/scripts/MCP-Reborn/build.gradle' line: 14

      * What went wrong:
      A problem occurred evaluating root project 'mcp-reborn'.
      > Failed to apply plugin [id 'net.minecraftforge.gradle.forgedev.patcher']
         > Failed to validate certificate for https://libraries.minecraft.net/, Most likely cause is an outdated JDK. Try updating at https://adoptopenjdk.net/ To disable this check re-run with -Dnet.minecraftforge.gradle.test_certs=false

      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

      * Get more help at https://help.gradle.org

      BUILD FAILED in 1m 19s
      patch_mcp.sh: line 5: cd: too many arguments
      patch: **** Can't open patch file /mnt/c/Users/Ian : No such file or directory
      cp: target './src/main/resources' is not a directory
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-e4h27umh\setup.py", line 214, in <module>
          prep_mcp()
        File "C:\Users\Ian Rothenbuhler\AppData\Local\Temp\pip-req-build-e4h27umh\setup.py", line 184, in prep_mcp
          os.chdir(workdir)
      FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\Ian Rothenbuhler\\AppData\\Local\\Temp\\pip-req-build-e4h27umh\\minerl\\MCP-Reborn'
      [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.
Traceback (most recent call last):
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 7, in <module>
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main.py", line 70, in main
    return command.main(cmd_args)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\base_command.py", line 100, in main
    with self.main_context():
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 142, in __exit__
    next(self.gen)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\command_context.py", line 19, in main_context
    with self._main_context:
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 576, in __exit__
    raise exc_details[1]
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\utils\temp_dir.py", line 70, in tempdir_registry
    yield _tempdir_registry
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 561, in __exit__
    if cb(*exc_details):
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 142, in __exit__
    next(self.gen)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\utils\temp_dir.py", line 31, in global_tempdir_manager
    with ExitStack() as stack:
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 576, in __exit__
    raise exc_details[1]
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 561, in __exit__
    if cb(*exc_details):
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\utils\temp_dir.py", line 156, in __exit__
    self.cleanup()
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\utils\temp_dir.py", line 173, in cleanup
    rmtree(self._path)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 328, in wrapped_f
    return self(f, *args, **kw)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 408, in __call__
    do = self.iter(retry_state=retry_state)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 364, in iter
    raise retry_exc.reraise()
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 197, in reraise
    raise self.last_attempt.result()
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 451, in result
    return self.__get_result()
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 411, in __call__
    result = fn(*args, **kwargs)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\utils\misc.py", line 129, in rmtree
    shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 749, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 614, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 623, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\Users\Ian Rothenbuhler\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 621, in _rmtree_unsafe
    os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Ian Rothenbuhler\\AppData\\Local\\Temp\\pip-req-build-e4h27umh\\scripts'

I just updated Ubuntu and Bash and installed JDK to Bash and got this error instead. Something new, making progress.

Miffyli commented 1 year ago

hmm the first error-like messages in this log suggest the Java installation is off (I have only tested with oracle JDK and openjdk), or that the webpage is unreachable (complains something about the certificates). I would maybe try running it again now or then try using openjdk or oracle JDK.

bchen0 commented 1 year ago

@Miffyli @ImShoes Hi all, I wanted to ask if you had found any solution to this. I am running into the same issue posted in the first comment. I have WSL 2 with Ubuntu 22.04.2 LTS and am also trying to install this on Windows

Miffyli commented 1 year ago

@bchen0 I paste the full error log, please. The usual culprit is wrong version of java/javac (JDK 8 is required). You need to install this both on Windows and WSL side.

bchen0 commented 1 year ago

Hi @Miffyli - I've attached the full error log below. I've installed java / javac on both Windows and WSL. When I check via java -version and javac -version, I see that I have version 1.8.0_361 installed on windows and 1.8.0_362 installed on WSL 2. minerl_error.txt

Miffyli commented 1 year ago

The first few lines suggest there is something off in your Python installation or in your WSL installation, since it says it has no permissions to run things in the directory where code was copied into. I am not sure how to support here; you could try removing the directory (/mnt/c/Users/Brian/AppData/Local/Temp/pip-req-build-rhls_tnc/minerl), but you might need to try to reinstall Python and WSL.

bchen0 commented 1 year ago

Thanks, reinstalling WSL did the trick. Maybe it was an issue with having WSL 1 originally then upgrading rather than starting from scratch and installing WSL2. Or installing Ubuntu 22.04 LTS instead of Ubuntu. In any case, I think I'm all set - thanks!