Encountering issues with the Animal-AI environment? Here are some solutions to common problems:
- Troubleshooting Installation Issues
- Mean Reward Displaying NaN
- Python API / Package Dependency Issues
- File Not Found Error
- Unity Environment Not Found
- Unity Environment Not Responding
- During Training, First Arena is Not Loaded
Encountering issues while installing the Animal-AI environment? Here are some solutions to common problems:
Permission errors after importing a Unity environment? Adjust file permissions with these commands:
macOS:
chmod -R 755 *.app
Linux:
chmod -R 755 *.x86_64
Windows users generally don't need additional permissions. If needed, refer to Microsoft Documentation.
Timeout errors when launching through UnityEnvironment
? Consider these fixes:
- No Agent in Scene: Ensure an agent is in the scene.
- Firewall Issues on macOS: Follow Apple's instructions to add exceptions.
- Errors in Unity Environment: Refer to Unity log files.
- Running in a Headless Environment: Use
--no-graphics
orno_graphics=True
if you intend on using this feature (not fully supported).
Encountering port conflicts? Try changing the worker number or port:
UnityEnvironment(file_name=filename, worker_id=X)
Or find an available port:
port = 5005 + random.randint(0, 1000)
Seeing Mean reward : nan
? Set the Max Steps
to a non-zero value or script custom termination conditions.
Encountering issues with the Python API or package dependencies? Here are some solutions to common problems:
Seeing ModuleNotFoundError: No module named 'animalai'
? Ensure the animalai
package is installed:
pip install animalai
or if you are using a virtual environment:
pip install animalai --user
or conda:
conda install -c conda-forge animalai
Please do not forget to activate your environment before installing the package.
You can verify the installation by running:
python -c "import animalai"
Currently, the Animal-AI environment only supports Python 3.6 to 3.9. We have tested using 3.6, 3.7 and 3.8, but we cannot guarantee that it will work with these versions for everyone. If you are using a different version of Python, please install Python 3.9 for the optimal experience.
Please verify that you are using the correct version of Python by running:
python --version
Seeing FileNotFoundError: [Errno 2] No such file or directory: 'AnimalAI/AnimalAI.app'
? Ensure the AnimalAI
folder is in the same directory as your Python script.
If you are using macOS, you may get this error: FileNotFoundError: [Errno 2] No such file or directory: 'env/AnimalAI'
. This error occurs when running the python play.py
command from the animal-ai/examples
folder. To fix this, simply rename the MACOS.app
folder you downloaded to Animal-AI
. This will allow the play.py
script to find the environment. Note that this error is likely to occur in older versions of Animal-AI.
Seeing UnityEnvironmentException: Couldn't launch the Unity environment
? Ensure the file_name
parameter is set to the correct path.
Seeing UnityActionException: The Unity environment took too long to respond
? Ensure the timeout_wait
parameter is set to a higher value. Alternatively, during training, try not to close the Unity environment window. This will prevent the environment from terminating the connection with the Python API, which will avoid a freeze or crash of the environment.
We are aware of this issue with the first arena (typically index 0) being skipped entirely during the initial training loop. However, this issue is resolved in the subsequent training loops. For a temporary fix, you can duplicate the first arena with the same parameters but change the index to 1. This will ensure that the first arena is loaded during the initial training loop in place of the first arena.
We are working on a fix for this issue. We apologize for any inconvenience this may cause.
Seeing NameError: name 't' is not defined
or NameError: name 'pass_mark' is not defined
? Ensure that the t
and pass_mark
are changed to timeLimit
and passMark
for any AAI builds from v4.1.0 and above. This change was made to ensure consistency in the naming conventions across the Animal-AI environment.
If you are using an older version of the Animal-AI environment, you can find the t
and pass_mark
variables in the config.yaml
file, which should be defined below the Arena index definition, such as:
!ArenaConfig
arenas:
0: !Arena
passMark/pass_mark: 50
timeLimit/t: 100
# rest of the arena configuration...