Closed bitpoke-YT closed 1 year ago
I have the same issue. Attempting to follow the documentation setting up the "release_20" docs. Initially it was complaining about Visual Studio C++ 14.0 and also about Building wheel for numpy (pyproject.toml) ... error error: subprocess-exited-with-error
× Building wheel for numpy (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [279 lines of output] setup.py:63: RuntimeWarning: NumPy 1.21.2 may not yet support Python 3.10.
I solved that problem with Visual Studio C++ 14., but the other issue with NumPy persists.
Initially I have tried to use venv and have tried to set-up vens with different versions of python via "<path_to_python(version)_executable>" -m "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install --no-cache-dir numpy-1.22.4 I have tried different versions of python 3.8.0 (found I need at least 3.8.13) 3.9.0 (same problem just with a lower version of numpy) 3.10.7 (where I started) 3.11.2 (figured why not try latest, but same)
Then after having python sorted I went through all of the tries below, for each version of python. So imagine iterating through below commands multiple times. Having slow as internet you can imagine what that was like.
then I attempted to install numpy via wheels, and tried different ones including mkl. Here one example "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install "D:\downloads\unsorted downloads\numpy-1.22.4+mkl-cp310-cp310-win_amd64.whl"
Since the abvoe also failed, tried: "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install --upgrade pip followed by "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install torch~=1.7.1 -f https://download.pytorch.org/whl/torch_stable.html -> of course that failed, ERROR: Could not find a version that satisfies the requirement torch~=1.7.1 (from versions: 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117) ERROR: No matching distribution found for torch~=1.7.1 -> so I changed it to: "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install torch~=1.11.0 -f https://download.pytorch.org/whl/torch_stable.html
but then the next command still failed with numpy installation, as above "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install mlagents_envs==0.30.0
figured I give editing the setup.py file a try and modified the numpy dependencies as below: install_requires=[ "cloudpickle", "grpcio>=1.11.0",
"Pillow>=4.2.1",
"protobuf>=3.6",
"pyyaml>=3.1.0",
"gym>=0.21.0",
"pettingzoo==1.15.0",
"numpy==1.22.4",
#"numpy==1.21.2",
"filelock>=3.4.0",
],
For some reason it looked really good in the beginning, as it pulled the right version of numpy, but then it reverted back to 1.14.1 and failed again, despite the line being invalidated. Used this command to do it: "C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe" -m pip install --no-cache-dir --force-reinstall mlagents_envs==0.30.0
I have wasted my entire Sunday afternoon trying to get this to work....
Not sure what else I could try....
Switch to Python 3.9. And recreate the venv, etc. Above versions seem to fail in many scenarios.
Switch to Python 3.9. And recreate the venv, etc. Above versions seem to fail in many scenarios.
I have the same problems as the two people above, could you explain what would be the command prompts to do that please?
Switch to Python 3.9. And recreate the venv, etc. Above versions seem to fail in many scenarios.
I have the same problems as the two people above, could you explain what would be the command prompts to do that please?
Just uninstall newer Python and install 3.9. Repeat the ml-agents python part installation process as usual. If you want multiple python versions, you can try to use pyenv or similar.
I have tried it with 3.9 as stated above. Repeated same steps and it still did fail. However I noticed it was using cache for numpy when executing: "C:\Users\Admin\AppData\Local\Programs\Python\Python39\python.exe" -m pip install mlagents_envs==0.30.0 I probably should clean the pip cache, but not sure how to do that. Later tonight I will completely nuke my python install and only install 3.9 as suggested and try again. However, seeing my entire Sunday go to waste I'm cautious to spend more time experimenting. Need firm solution.
I have tried it with 3.9 as stated above. Repeated same steps and it still did fail. However I noticed it was using cache for numpy when executing: "C:\Users\Admin\AppData\Local\Programs\Python\Python39\python.exe" -m pip install mlagents_envs==0.30.0 I probably should clean the pip cache, but not sure how to do that. Later tonight I will completely nuke my python install and only install 3.9 as suggested and try again. However, seeing my entire Sunday go to waste I'm cautious to spend more time experimenting. Need firm solution.
I had same issue. The numpy version that is used in ml-agents just doesn't work with newer Python. So you need to nuke your higher python version and install 3.9.x, OR switch with pyenv (or similar), but make sure it worked by opening new cmd and writing python --version
. Then delete your venv, you created for ml-agents previously and create new one (which will now use 3.9.x python and fixate it). Then activate and install all stuff as usual.
I think this is also related https://github.com/Unity-Technologies/ml-agents/issues/5826#issuecomment-1403248637 , there is an alternative solution, but that seems even more complicated 🗡️
i was using python version 3.9 and tried with 3.8 same error.
I have tried what @trsh suggested on my work computer and completely uninstalled all python products
Then only installed python 3.9.13, recreated the venv and followed the installation procedure outlined in the documentation. No alarms, no errors, only a warning due to use of deprecated setup.py which will be dropped in future release, because the way packages install will change or something. Then the other warning was pip version update available, which I opted to ignore as well.
So I can confirm clean environment, the setup procedure should work as described.
What I have not tested yet are the examples in the unity project file, to see if they get a connection to the ml-agent. That will have to be tested and verified next, but at least there are no more errors during the setup procedure.
i was using python version 3.9 and tried with 3.8 same error.
Your problem seems to bee different. But I would still try a CLEAN (read 1 above) install of python 3.9.x (latest of 3.9) and your ml-agents venv.
I.e. its not enough to reinstall Python and bang around same venv, that was created with higher version. At least that's what I observed.
I have tried what @trsh suggested on my work computer and completely uninstalled all python products
- Anaconda
- Pycharm
- Spyder
- Python 3.10.x
- Python launcher
Then only installed python 3.9.13, recreated the venv and followed the installation procedure outlined in the documentation. No alarms, no errors, only a warning due to use of deprecated setup.py which will be dropped in future release, because the way packages install will change or something. Then the other warning was pip version update available, which I opted to ignore as well.
So I can confirm clean environment, the setup procedure should work as described.
What I have not tested yet are the examples in the unity project file, to see if they get a connection to the ml-agent. That will have to be tested and verified next, but at least there are no more errors during the setup procedure.
How do I make sure I have gotten removed them all and how do I install 3.9.13 because the python website does not have an installer for that version
It worked after I installed python again.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
When i run mlagents-learn --help i get this output Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Scripts\mlagents-learn.exe__main.py", line 4, in
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\mlagents\trainers\learn.py", line 2, in
from mlagents import torch_utils
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\mlagents\torch_utils\ init__.py", line 1, in
from mlagents.torch_utils.torch import torch as torch # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in
from mlagents.trainers.settings import TorchSettings
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\mlagents\trainers\settings.py", line 625, in
class TrainerSettings(ExportableSettings):
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\mlagents\trainers\settings.py", line 648, in TrainerSettings
cattr.register_structure_hook(
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cattrs\converters.py", line 280, in register_structure_hook
self._structure_func.register_cls_list([(cl, func)])
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cattrs\dispatch.py", line 57, in register_cls_list
self._single_dispatch.register(cls, handler)
File "C:\Users\mrmwg\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
raise TypeError(
TypeError: Invalid first argument to
register()
. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class or union type.