edbeeching / godot_rl_agents

An Open Source package that allows video game creators, AI researchers and hobbyists the opportunity to learn complex behaviors for their Non Player Characters or agents
MIT License
902 stars 63 forks source link

[Temporary solution] Numpy error on training in Windows: UserWarning: Failed to initialize NumPy: _ARRAY_API not found #191

Closed Ivan-267 closed 2 months ago

Ivan-267 commented 2 months ago

There may currently be an issue with installing Godot RL on Windows, if you get the following error when starting training with gdrl:

UserWarning: Failed to initialize NumPy: _ARRAY_API not found

and/or this error:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Until we can get this fixed, you can try going into the conda env / venv where gdrl is installed, and type:

pip install "numpy<2

If it still doesn't work, you could try downgrading torch, but this is likely not needed on reasonably newer PCs (the CPU I just tested this on is quite old):

pip install "torch<2"

edbeeching commented 2 months ago

Ah this is why the tests are broken on Windows. I will take a look.

Ivan-267 commented 2 months ago

Fixed in https://github.com/edbeeching/godot_rl_agents/pull/192