PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning
MIT License
6.83k stars 619 forks source link

Multiple issues with dependencies installation #114

Open kurtissfrost opened 10 months ago

kurtissfrost commented 10 months ago

I installed python and rebooted.

I check to make sure python installed correctly using python --version and it said I had version 3.12.0 installed.

I ran pip install -r requirements.txt and got this error:

'PS Q:\AI Plays Red\PokemonRedExperiments-master\baselines> pip install -r requirements.txt Defaulting to user installation because normal site-packages is not writeable Collecting mediapy@ git+https://github.com/PWhiddy/mediapy.git@45101800d4f6adeffe814cad93de1db67c1bd614 (from -r requirements.txt (line 41)) Cloning https://github.com/PWhiddy/mediapy.git (to revision 45101800d4f6adeffe814cad93de1db67c1bd614) to c:\users\emera\appdata\local\temp\pip-install-xq07omcc\mediapy_3c88f4daa9c2461e983d2469c0816bcd ERROR: Error [WinError 2] The system cannot find the file specified while executing command git version ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?'

when I run python run_pretrained_interactive.py, I get this error:

PS Q:\AI Plays Red\PokemonRedExperiments-master\baselines> python run_pretrained_interactive.py Traceback (most recent call last): File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\run_pretrained_interactive.py", line 4, in <module> from red_gym_env import RedGymEnv File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\red_gym_env.py", line 10, in <module> from einops import rearrange ModuleNotFoundError: No module named 'einops'

EDIT BUT NOT REALLY: I managed to get the above issues resolved but now I am running into a different error when I try doing pip install -r requirements.txt

When I ran it this last time, it started running like normal but then avast threw up like 5 red flags and stopped the install. So I shut it off and now I am getting this error:

``Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [12 lines of output]

× 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.``

And when I run python run_pretrained_interactive.py I get this error:

Traceback (most recent call last): File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\run_pretrained_interactive.py", line 4, in <module> from red_gym_env import RedGymEnv File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\red_gym_env.py", line 11, in <module> import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib'

Then this:

Q:\AI Plays Red\PokemonRedExperiments-master\baselines>python run_pretrained_interactive.py Traceback (most recent call last): File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\run_pretrained_interactive.py", line 4, in <module> from red_gym_env import RedGymEnv File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\red_gym_env.py", line 12, in <module> from skimage.transform import resize ModuleNotFoundError: No module named 'skimage'

``Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install skimage Defaulting to user installation because normal site-packages is not writeable Collecting skimage Downloading skimage-0.0.tar.gz (757 bytes) 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]

  *** Please install the `scikit-image` package (instead of `skimage`) ***

  [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.``

I am really confused as to what I did wrong. Not only that, I'm confused on how to fix it. I don't know a whole lot about python so I've just been having to google everything as it comes up. Sorry if this post is a mess. I've been working on this for hours and I still haven't been able to figure it out.

cloudbosspower commented 10 months ago

No, I had issues with the 3.12 with this. (At least I had) In my experience, if you have windows, I had to install Python 3.11.5, both the 32 and the 64 bit (if you do not do that, later in the file you will get and error). Remember that both the python need to enable the path. Have you installed also Visual Studio with the packages?

LockdownMadness commented 10 months ago

I had the same issue when not running the Conda Environment on my Mac. I tried installing all the dependencies manually and re running multiple times with a new dependency needed. In the end I couldn't get any further. I ran it through the condo environment and it downloads everything you need and didn't have an issue with dependencies. Hopefully this will work for you then 👍🏻

kurtissfrost commented 10 months ago

No, I had issues with the 3.12 with this. (At least I had) In my experience, if you have windows, I had to install Python 3.11.5, both the 32 and the 64 bit (if you do not do that, later in the file you will get and error). Remember that both the python need to enable the path. Have you installed also Visual Studio with the packages?

I had the same issue when not running the Conda Environment on my Mac. I tried installing all the dependencies manually and re running multiple times with a new dependency needed. In the end I couldn't get any further. I ran it through the condo environment and it downloads everything you need and didn't have an issue with dependencies. Hopefully this will work for you then 👍🏻

bit-delta commented 10 months ago

I'll try that and see if that works and I have VS Code but I haven't installed VS Studio. Do I need it?

Yes. Get Visual Studio Community. When you run the installer, choose to install "Desktop Development with C++". That should give you everything you need. The download will be a few gigs.

``conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Assuming you have installed Anaconda, you need to add it to your path. Looks like you are on Windows, so edit the system Path. You'll need to add your condabin path to the system Path variable. With default install options, your condabin is probably at "C:\Users\\Anaconda3\condabin".

When that is done, open up your terminal, and run conda init. If that runs successfully, you should be good to go. You'll see your command prompt pre-pended with (base). When you create and activate the pokey environment, it will change to (pokey).

kurtissfrost commented 10 months ago

I feel like I'm close to figuring it out but, I'm still having a few errors that are keeping it from running.

polyorchid commented 10 months ago
  • ERROR: Could not find a version that satisfies the requirement jaxlib==0.4.14 (from versions: 0.4.17, 0.4.18, 0.4.19) ERROR: No matching distribution found for jaxlib==0.4.14

Had a similar issue getting setup and eventually installed the dependencies listed in Requirements.txt manually. I have the lastest version of jaxlib at 0.4.19 and it is working fine with that.

kurtissfrost commented 10 months ago

Had a similar issue getting setup and eventually installed the dependencies listed in Requirements.txt manually. I have the lastest version of jaxlib at 0.4.19 and it is working fine with that.

Well, that was working for a minute until I got the "stable-baslines3" and I got an error:

**Getting requirements to build wheel 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: 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.**

polyorchid commented 10 months ago

**Getting requirements to build wheel 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]

pip install "stable_baselines3[extra,tests,docs] @ git+https://github.com/DLR-RM/stable-baselines3"

Could try that instead and pull it straight from the git.

kurtissfrost commented 10 months ago

**Getting requirements to build wheel 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]

pip install "stable_baselines3[extra,tests,docs] @ git+https://github.com/DLR-RM/stable-baselines3"

Could try that instead and pull it straight from the git.

So I went trhough and manually installed all of the prerequsites and all of them worked but a few:

PyWavelets:

Error Code C:\Users\emera>pip install PyWavelets Defaulting to user installation because normal site-packages is not writeable Collecting PyWavelets Using cached PyWavelets-1.4.1.tar.gz (4.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 ╰─> [33 lines of output] Traceback (most recent call last): File "C:\Users\emera\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in main() File "C:\Users\emera\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emera\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel backend = _build_backend() ^^^^^^^^^^^^^^^^ File "C:\Users\emera\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend obj = import_module(mod_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\importlib\__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1304, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1325, in _find_and_load_unlocked File "", line 929, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\emera\AppData\Local\Temp\pip-build-env-sf0zhkvr\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in import setuptools.version File "C:\Users\emera\AppData\Local\Temp\pip-build-env-sf0zhkvr\overlay\Lib\site-packages\setuptools\version.py", line 1, in import pkg_resources File "C:\Users\emera\AppData\Local\Temp\pip-build-env-sf0zhkvr\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2191, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? [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.

stable-baselines3 ERROR: Could not find a version that satisfies the requirement torch>=1.13 (from stable-baselines3[docs,extra,tests]) (from versions: none) ERROR: No matching distribution found for torch>=1.13

Torch: ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch

Other than those 3, all dependencies have been installed successfully.

bit-delta commented 10 months ago

Hmm. Are you sure that you're running the pip command from the shell where (pokey) is active?

kurtissfrost commented 10 months ago

Hmm. Are you sure that you're running the pip command from the shell where (pokey) is active?

Derp. I think that was my problem. I was just installing them in "C:\users\emera"

cd /d <path to baselines folder> then I ran pip install torch and it worked.

then when I ran pip install "stable_baselines3[extra,tests,docs] @ git+https://github.com/DLR-RM/stable-baselines3" it looked like it was going to work and then I got error:

Error `` ERROR: Failed building wheel for pytype`` `` ERROR: Could not build wheels for pytype, which is required to install pyproject.toml-based projects``

So I ran pip install pytype and got:

ERROR: Could not find a version that satisfies the requirement pytyppe (from versions: none) ERROR: No matching distribution found for pytyppe

EDIT So I went back to C:\users\emera and ran pip install pytype and it was looking like it was working and I got:

ERROR: Failed building wheel for pytype ERROR: Could not build wheels for pytype, which is required to install pyproject.toml-based projects

bit-delta commented 10 months ago

It's not so much about the directory you're in, although I would cd into baselines so the requirements.txt list is there. The main thing I'd want to double check is that your command prompt has (pokey) next to it, meaning in your session you're still using the conda environment you created. Since it has been a day or so, you've probably opened/closed terminal sessions and lost the session with the conda environment.

For the sake of making sure we have a good start, I would suggest restart your PC (because it's Windows 😄) cd into your baselines directory conda activate pokey pip install -r requirements.txt

kurtissfrost commented 10 months ago

It's not so much about the directory you're in, although I would cd into baselines so the requirements.txt list is there. The main thing I'd want to double check is that your command prompt has (pokey) next to it, meaning in your session you're still using the conda environment you created. Since it has been a day or so, you've probably opened/closed terminal sessions and lost the session with the conda environment.

For the sake of making sure we have a good start, I would suggest restart your PC (because it's Windows 😄) cd into your baselines directory conda activate pokey pip install -r requirements.txt

C:\Users\emera>cd /d "Q:\AI Plays Red\PokemonRedExperiments-master\baselines" pip install -r requirements.txt

Install runs as normal then Avast flags 4 different requirements. (pybind11-config.EXE is the one it shows but it went off 3 other tines)

The install is running in the background still then I get this error:

ERROR: Could not find a version that satisfies the requirement jaxlib==0.4.14 (from versions: 0.4.17, 0.4.18, 0.4.19) ERROR: No matching distribution found for jaxlib==0.4.14

While in the conda environment, if I try and run pip install jaxlib I get this message:

Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install jaxlib Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: jaxlib in c:\users\emera\appdata\roaming\python\python312\site-packages (0.4.19) Requirement already satisfied: scipy>=1.9 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (1.11.3) Requirement already satisfied: numpy>=1.22 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (1.26.1) Requirement already satisfied: ml-dtypes>=0.2.0 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (0.3.1)

bit-delta commented 10 months ago

Ah, I would try repeating the steps with Avast disabled. Live dangerously 😎

kurtissfrost commented 10 months ago

Ah, I would try repeating the steps with Avast disabled. Live dangerously 😎

When I did that, it ran up until this:

ERROR: Could not find a version that satisfies the requirement jaxlib==0.4.14 (from versions: 0.4.17, 0.4.18, 0.4.19) ERROR: No matching distribution found for jaxlib==0.4.14

bit-delta commented 10 months ago

I suppose you could try using one of those versions presented in the error message. Just go for the latest and see how it turns out when you execute run_pretrained_interactive.py.

cd into your baselines directory conda activate pokey pip install jaxlib

kurtissfrost commented 10 months ago
Message Requirement already satisfied: jaxlib in c:\users\emera\appdata\roaming\python\python312\site-packages (0.4.19) Requirement already satisfied: scipy>=1.9 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (1.11.3) Requirement already satisfied: numpy>=1.22 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (1.26.1) Requirement already satisfied: ml-dtypes>=0.2.0 in c:\users\emera\appdata\roaming\python\python312\site-packages (from jaxlib) (0.3.1)

(pokey) Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install jaxlib==0.4.14

Error: ERROR: Could not find a version that satisfies the requirement jaxlib==0.4.14 (from versions: 0.4.17, 0.4.18, 0.4.19) ERROR: No matching distribution found for jaxlib==0.4.14

I am so stumped as to why this isn't working :/

bit-delta commented 10 months ago

Looks to me like your (pokey) Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install jaxlib worked. The messages you received are only saying that certain requirements were already installed. I'm not sure why version 0.4.14 won't work for you, but you should have the latest now. Did you try run_pretrained_interactive.py?

kurtissfrost commented 10 months ago

Q:\AI Plays Red\PokemonRedExperiments-master\baselines>conda activate pokey

Errorpython run_pretrained_interactive.py UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.4 Traceback (most recent call last): File "Q:\AI Plays Red\PokemonRedExperiments-master\baselines\run_pretrained_interactive.py", line 5, in from stable_baselines3 import A2C, PPO ModuleNotFoundError: No module named 'stable_baselines3'

(pokey) Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install "stable_baselines3[extra,tests,docs] @ git+https://github.com/DLR-RM/stable-baselines3"

Error: Collecting stable_baselines3[docs,extra,tests]@ git+https://github.com/DLR-RM/stable-baselines3 Cloning https://github.com/DLR-RM/stable-baselines3 to c:\users\emera\appdata\local\temp\pip-install-j_tf8r85\stable-baselines3_32f1871978c443f2b71b99e624cebc79 Running command git clone --filter=blob:none --quiet https://github.com/DLR-RM/stable-baselines3 'C:\Users\emera\AppData\Local\Temp\pip-install-j_tf8r85\stable-baselines3_32f1871978c443f2b71b99e624cebc79' Resolved https://github.com/DLR-RM/stable-baselines3 to commit 69afefc91d408d352b4224ae5244ad2c32bb7634 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: gymnasium<0.30,>=0.28.1 in c:\users\emera\appdata\roaming\python\python312\site-packages (from stable_baselines3[docs,extra,tests]@ git+https://github.com/DLR-RM/stable-baselines3) (0.29.1) Requirement already satisfied: numpy>=1.20 in c:\users\emera\appdata\roaming\python\python312\site-packages (from stable_baselines3[docs,extra,tests]@ git+https://github.com/DLR-RM/stable-baselines3) (1.26.1) INFO: pip is looking at multiple versions of stable-baselines3[docs,extra,tests] to determine which version is compatible with other requirements. This could take a while. ERROR: Could not find a version that satisfies the requirement torch>=1.13 (from stable-baselines3[docs,extra,tests]) (from versions: none) ERROR: No matching distribution found for torch>=1.13

(pokey) Q:\AI Plays Red\PokemonRedExperiments-master\baselines>pip install torch==1.13

Error: ERROR: Could not find a version that satisfies the requirement torch==1.13 (from versions: none) ERROR: No matching distribution found for torch==1.13

pip install torch

Error: ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch
bit-delta commented 10 months ago

Hmm... I've been going off of the assumption that you have python 3.12.0 installed from your first post, but now I'm realizing that maybe that's not the version in your conda environment. Can you double check the python version of (pokey)?

It also wouldn't hurt to pip install --upgrade pip

Since you mentioned that you have Avast, you should also take a look at this stackoverflow post. You may need to whitelist your conda environment and your python executable. The "no matching distribution found" error occurring so frequently -- when your Python version is (probably) recent enough, and we know that PyPI has all of these packages -- gives me that antivirus vibe.

Finally, you will want to re-run the install of requirements.txt. If you still encounter an issue with installing any of these packages, try running pip install for one of the packages with the -v (verbose) flag to get more insight into what's going on. You can stack verbose up to three times like -v, -vv, or -vvv to get more details. Try and parse out what the logs are telling you, and feel free to upload the output here to get extra eyes on it.

PWhiddy commented 5 months ago

For anyone looking at this thread in the future, most of these issues are related to setup on windows and you can refer to this setup guide:

https://github.com/PWhiddy/PokemonRedExperiments/blob/master/windows-setup-guide.md