Closed ohernpaul closed 10 months ago
getting this aswell. im using python -m pip install ./ml-agents-envs python -m pip install ./ml-agents though.
fixed it by downgrading to python 3.9.13
fixed it by downgrading to python 3.9.13
Are you trying to install Release 21? Aka ml-agents==1.0.0?
Because I attempted on python 3.9.13 but am still getting this error.
(mlagents_python_3_9_13) D:\MProjects\AIsland\ml-agents-master>pip install ./ml-agents
Processing d:\mprojects\aisland\ml-agents-master\ml-agents
Preparing metadata (setup.py) ... done
Collecting grpcio<=1.48.2,>=1.11.0 (from mlagents==1.0.0)
Downloading grpcio-1.48.2-cp39-cp39-win_amd64.whl (3.6 MB)
---------------------------------------- 3.6/3.6 MB 15.3 MB/s eta 0:00:00
Collecting h5py>=2.9.0 (from mlagents==1.0.0)
Downloading h5py-3.10.0-cp39-cp39-win_amd64.whl.metadata (2.5 kB)
INFO: pip is looking at multiple versions of mlagents to determine which version is compatible with other requirements. This could take a while.
ERROR: Ignored the following versions that require a different python version: 0.10.0.dev0 Requires-Python >=3.5,<3.8; 0.6.0 Requires-Python >=3.5,<=3.7; 0.6.1 Requires-Python >=3.5,<=3.7; 0.6.2 Requires-Python >=3.5,<=3.7; 0.8.0 Requires-Python >=3.5,<3.8; 0.8.1 Requires-Python >=3.5,<3.8; 0.8.2 Requires-Python >=3.5,<3.8; 0.9.0 Requires-Python >=3.5,<3.8; 0.9.1 Requires-Python >=3.5,<3.8; 0.9.2 Requires-Python >=3.5,<3.8; 0.9.3 Requires-Python >=3.5,<3.8; 1.0.0 Requires-Python >=3.10.1,<=3.10.12
ERROR: Could not find a version that satisfies the requirement mlagents_envs==1.0.0 (from mlagents) (from versions: 0.10.0.dev1, 0.10.0, 0.10.1, 0.11.0.dev0, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.17.0, 0.18.0, 0.18.1, 0.19.0, 0.20.0, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.24.0, 0.24.1, 0.25.0, 0.25.1, 0.26.0, 0.27.0, 0.28.0, 0.29.0, 0.30.0)
ERROR: No matching distribution found for mlagents_envs==1.0.0
1.0.0 Requires-Python >=3.10.1,<=3.10.12
oh yeah. i cloned release_20 instead. as far as i know thats how you install that early of a numpy version though. weird that 21 requires a different py version
I faced this question too. i tried py3.11 but not success yet
i install numpy=1.26 but it install numpy=1.21 again
You have already found a solution, I did it. it may not be perfect and there may be some inconsistencies, but I got it. Maybe in the future it won't work, but for now it does. I used:
(read all the way to the end and then try it)
Anyway, I did all this on python 3.9.13, this method works in both anaconda and venv (it's about the same, but I said anyway to make people more comfortable). After creating the environment you can upgrade pip (currently it works with or without upgrading) but I've always upgraded it so here's the pip upgrade code (if you need it):
python -m pip install --upgrade pip
And now you can start installing PyTorch with this command (this command is taken from the documentation):
pip3 install torch~=1.13.1 -f https://download.pytorch.org/whl/torch_stable.html
It doesn't work the usual way, so it's better to use this one. Then we need to install Protobuf version 3.20.3 (I've seen it in the video, I haven't tried other versions, but it works with this version):
pip install protobuf==3.20.3
And now you can install ML Agents itself, this is done with the command:
pip install mlagents
Yes, I just installed mlagents from Pypi, because mlagents from the repository doesn't allow installation if python version is lower than python 3.10, and it doesn't install on python 3.10. The commands that install PyTorch, ProtoBuf and ML Agents can be installed scattered and will still work (if you install everything). And tadam, now in theory it should work, you can check it by running the command:
mlagents-learn -h
If you see the list of commands, you have done everything correctly and everything works. I tried several variants, several download combinations and came to this. I hope I have helped someone with this.
Translated with www.DeepL.com/Translator (free version) 😀 (Sorry if you see any spelling or logical errors.)
Just a heads up for anyone that's still stuck on this. The numpy version was incorrect and has been updated on the develop branch - I was told by a Unity employee and confirmed with this link on the ml-agents commit history.
https://github.com/Unity-Technologies/ml-agents/commit/f3dc8f615044c9226c7e7ed308e0aadc1def3b4d
thank you very much and i will try it soon
---Original--- From: @.> Date: Thu, Nov 16, 2023 23:55 PM To: @.>; Cc: @.**@.>; Subject: Re: [Unity-Technologies/ml-agents] ERROR: Failed building wheel fornumpy when installing ml-agents==1.0.0 (Issue #6008)
Just a heads up for anyone that's still stuck on this. The numpy version was incorrect and has been updated on the develop branch - I was told by a Unity employee and confirmed with this link on the ml-agents commit history.
f3dc8f6
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Workaround:
Changed
"numpy==1.21.2",
to
"numpy==1.23.3",
in the file path-to-ml-agents\ml-agents-envs\setup.py
numpy 1.21.2 is not compatible with python 3.10.12 (I dont see a cp310 for win64 bit: https://pypi.org/project/numpy/1.21.2/#files)
numpy 1.23.3 works fine with python 3.10.12
note: with numpy 1.24, I got a float error with numpy which led to this:
NumPy 1.20 (release notes) deprecated numpy.float, numpy.int, and similar aliases, causing them to issue a deprecation warning NumPy 1.24 (release notes) removed these aliases altogether, causing an error when they are used.
final pip list
Package Version
----------------------- ------------
absl-py 2.0.0
attrs 23.1.0
cachetools 5.3.2
cattrs 1.5.0
certifi 2023.7.22
charset-normalizer 3.3.2
cloudpickle 3.0.0
colorama 0.4.6
filelock 3.13.1
fsspec 2023.10.0
google-auth 2.23.4
google-auth-oauthlib 1.1.0
grpcio 1.48.2
gym 0.26.2
gym-notices 0.0.8
h5py 3.10.0
huggingface-hub 0.19.4
idna 3.4
Markdown 3.5.1
MarkupSafe 2.1.3
mlagents 1.0.0
mlagents-envs 1.0.0
numpy 1.23.3
oauthlib 3.2.2
onnx 1.12.0
packaging 23.2
PettingZoo 1.15.0
Pillow 10.1.0
pip 23.3.1
protobuf 3.19.6
pyasn1 0.5.0
pyasn1-modules 0.3.0
pypiwin32 223
pywin32 306
PyYAML 6.0.1
requests 2.31.0
requests-oauthlib 1.3.1
rsa 4.9
setuptools 65.5.0
six 1.16.0
tensorboard 2.15.1
tensorboard-data-server 0.7.2
torch 1.13.1+cu117
tqdm 4.66.1
typing_extensions 4.8.0
urllib3 2.1.0
Werkzeug 3.0.1
confirmation:
>mlagents-learn --help
usage: mlagents-learn.exe [-h] [--env ENV_PATH] [--resume] [--deterministic] [--force] [--run-id RUN_ID] [--initialize-from RUN_ID] [--seed SEED] [--inference] [--base-port BASE_PORT] [--num-envs NUM_ENVS]
[--num-areas NUM_AREAS] [--debug] [--env-args ...] [--max-lifetime-restarts MAX_LIFETIME_RESTARTS] [--restarts-rate-limit-n RESTARTS_RATE_LIMIT_N]
[--restarts-rate-limit-period-s RESTARTS_RATE_LIMIT_PERIOD_S] [--torch] [--tensorflow] [--results-dir RESULTS_DIR] [--timeout-wait TIMEOUT_WAIT] [--width WIDTH] [--height HEIGHT]
[--quality-level QUALITY_LEVEL] [--time-scale TIME_SCALE] [--target-frame-rate TARGET_FRAME_RATE] [--capture-frame-rate CAPTURE_FRAME_RATE] [--no-graphics] [--torch-device DEVICE]
[trainer_config_path]
positional arguments:
trainer_config_path
options:
-h, --help show this help message and exit
--env ENV_PATH Path to the Unity executable to train (default: None)
--resume Whether to resume training from a checkpoint. Specify a --run-id to use this option. If set, the training code loads an already trained model to initialize the neural network before
resuming training. This option is only valid when the models exist, and have the same behavior names as the current agents in your scene. (default: False)
--deterministic Whether to select actions deterministically in policy. `dist.mean` for continuous action space, and `dist.argmax` for deterministic action space (default: False)
--force Whether to force-overwrite this run-id's existing summary and model data. (Without this flag, attempting to train a model with a run-id that has been used before will throw an
error. (default: False)
--run-id RUN_ID The identifier for the training run. This identifier is used to name the subdirectories in which the trained model and summary statistics are saved as well as the saved model
itself. If you use TensorBoard to view the training statistics, always set a unique run-id for each training run. (The statistics for all runs with the same id are combined as if
they were produced by a the same session.) (default: ppo)
--initialize-from RUN_ID
Specify a previously saved run ID from which to initialize the model from. This can be used, for instance, to fine-tune an existing model on a new environment. Note that the
previously saved models must have the same behavior parameters as your current environment. (default: None)
--seed SEED A number to use as a seed for the random number generator used by the training code (default: -1)
--inference Whether to run in Python inference mode (i.e. no training). Use with --resume to load a model trained with an existing run ID. (default: False)
--base-port BASE_PORT
The starting port for environment communication. Each concurrent Unity environment instance will get assigned a port sequentially, starting from the base-port. Each instance will
use the port (base_port + worker_id), where the worker_id is sequential IDs given to each instance from 0 to (num_envs - 1). Note that when training using the Editor rather than an
executable, the base port will be ignored. (default: 5005)
--num-envs NUM_ENVS The number of concurrent Unity environment instances to collect experiences from when training (default: 1)
--num-areas NUM_AREAS
The number of parallel training areas in each Unity environment instance. (default: 1)
--debug Whether to enable debug-level logging for some parts of the code (default: False)
--env-args ... Arguments passed to the Unity executable. Be aware that the standalone build will also process these as Unity Command Line Arguments. You should choose different argument names if
you want to create environment-specific arguments. All arguments after this flag will be passed to the executable. (default: None)
--max-lifetime-restarts MAX_LIFETIME_RESTARTS
The max number of times a single Unity executable can crash over its lifetime before ml-agents exits. Can be set to -1 if no limit is desired. (default: 10)
--restarts-rate-limit-n RESTARTS_RATE_LIMIT_N
The maximum number of times a single Unity executable can crash over a period of time (period set in restarts-rate-limit-period-s). Can be set to -1 to not use rate limiting with
restarts. (default: 1)
--restarts-rate-limit-period-s RESTARTS_RATE_LIMIT_PERIOD_S
The period of time --restarts-rate-limit-n applies to. (default: 60)
--torch (Removed) Use the PyTorch framework. (default: False)
--tensorflow (Removed) Use the TensorFlow framework. (default: False)
--results-dir RESULTS_DIR
Results base directory (default: results)
--timeout-wait TIMEOUT_WAIT
The period of time to wait on a Unity environment to startup for training. (default: 60)
Engine Configuration:
--width WIDTH The width of the executable window of the environment(s) in pixels (ignored for editor training). (default: 84)
--height HEIGHT The height of the executable window of the environment(s) in pixels (ignored for editor training) (default: 84)
--quality-level QUALITY_LEVEL
The quality level of the environment(s). Equivalent to calling QualitySettings.SetQualityLevel in Unity. (default: 5)
--time-scale TIME_SCALE
The time scale of the Unity environment(s). Equivalent to setting Time.timeScale in Unity. (default: 20)
--target-frame-rate TARGET_FRAME_RATE
The target frame rate of the Unity environment(s). Equivalent to setting Application.targetFrameRate in Unity. (default: -1)
--capture-frame-rate CAPTURE_FRAME_RATE
The capture frame rate of the Unity environment(s). Equivalent to setting Time.captureFramerate in Unity. (default: 60)
--no-graphics Whether to run the Unity executable in no-graphics mode (i.e. without initializing the graphics driver. Use this only if your agents don't use visual observations. (default: False)
Torch Configuration:
--torch-device DEVICE
Settings for the default torch.device used in training, for example, "cpu", "cuda", or "cuda:0" (default: None)
This should be fixed on develop.
Hi, yes it is fixed in develop. I just tried it. Please update: ml-agents/docs/Installation.md
In the guide and documentation, it states that 1.0.0 Requires-Python >=3.10.1,<=3.10.12. Given any Anaconda environment between this range, I am failing to build wheel for numpy. The version that ml-agents 1.0 is trying to use is numpy 1.13.3 and fails with this error.
The steps I am taking are:
I have even tried installing numpy 1.21.2 which is the version for python 3.10 and it still fails.
To make sure my Anaconda setup is correct, I went through a re-install of my previous environment for ML-Agents==0.28.0 and that worked perfectly fine the first time using python 3.7.16.