3.6 KiB
Frequently Asked Questions
Installation problems
Tensorflow dependency
ML Agents requires TensorFlow; if you don't already have it installed, pip
will try to install it when you install
the ml-agents package.
If you see a message like this
ERROR: Could not find a version that satisfies the requirement tensorflow<2.0,>=1.7 (from mlagents) (from versions: none)
ERROR: No matching distribution found for tensorflow<2.0,>=1.7 (from mlagents)
it means that there is no version of TensorFlow for your python environment. Some known potential causes are:
- You're using 32-bit python instead of 64-bit. See the answer here for how to tell which you have installed.
- You're using python 3.8. Tensorflow plans to release packages for this as soon as possible; see this issue for more details.
- You have the
tensorflow-gpu
package installed. This is equivalent totensorflow
, howeverpip
doesn't recognize this. The best way to resolve this is to update totensorflow==1.15.0
which provides GPU support in the same package (see the release notes for more details.) - You're on another architecture (e.g. ARM) which requires vendor provided packages.
In all of these cases, the issue is a pip/python environment setup issue. Please search the tensorflow github issues for similar problems and solutions before creating a new issue.
Environment Permission Error
If you directly import your Unity environment without building it in the editor, you might need to give it additional permissions to execute it.
If you receive such a permission error on macOS, run:
chmod -R 755 *.app
or on Linux:
chmod -R 755 *.x86_64
On Windows, you can find instructions.
Environment Connection Timeout
If you are able to launch the environment from UnityEnvironment
but then
receive a timeout error like this:
UnityAgentsException: The Communicator was unable to connect. Please make sure the External process is ready to accept communication with Unity.
There may be a number of possible causes:
- Cause: There may be no agent in the scene
- Cause: On OSX, the firewall may be preventing communication with the environment. Solution: Add the built environment binary to the list of exceptions on the firewall by following instructions.
- Cause: An error happened in the Unity Environment preventing communication. Solution: Look into the log files generated by the Unity Environment to figure what error happened.
- Cause: You have assigned HTTP_PROXY and HTTPS_PROXY values in your environment variables. Solution: Remove these values and try again.
Communication port {} still in use
If you receive an exception "Couldn't launch new environment because communication port {} is still in use. "
, you can change the worker number in
the Python script when calling
UnityEnvironment(file_name=filename, worker_id=X)
Mean reward : nan
If you receive a message Mean reward : nan
when attempting to train a model
using PPO, this is due to the episodes of the Learning Environment not
terminating. In order to address this, set Max Steps
for the
Agents within the Scene Inspector to a value greater than 0. Alternatively, it
is possible to manually set done
conditions for episodes from within scripts
for custom episode-terminating events.