Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
16.59k stars 4.09k forks source link

Having issue installing ml-agents #6114

Open wangdog123 opened 1 month ago

wangdog123 commented 1 month ago

I followed the installation doc to try installing ml-agents release 21 with Anaconda.

But when I use python 3.10.x that the doc recommended, both installing pytorch and ml-agents python package gave a error called ImportError: Module use of python311.dll conflicts with this version of Python. I also tried install pytorch 1.13.x but gave the same error.

and when I use python 3.11.x, pytorch installed successfully, but when I try to install ml-agents, it installed some modules, but some modules gave the python version mismatch error image

How can I install ml-agents on anaconda successfully?

KimHyunBeom commented 1 month ago

https://forum.unity.com/threads/error-failed-building-wheel-for-numpy.1523527/ As suggested in the solution in the answer to that link, when creating an anaconda virtual environment, create the Python version as 3.9.18 and then set the recommended minimum Python version in each setup.py to python_requires=">=3.9.1,<=3.10.12"Adjust it to And if you enter the commands below sequentially, it will be installed properly. I solved the installation error of Release 21 in this way.

pip3 install torch -f https://download.pytorch.org/whl/torch_stable.html
pip3 install -e ./ml-agents-envs
pip3 install -e ./ml-agents
CoolModder commented 1 month ago

Also getting wheel building failed, but with:


Traceback (most recent call last):
        File "D:\<>\Unity\Idiot Makes AI\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\<>\Unity\Idiot Makes AI\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "D:\<>\Unity\Idiot Makes AI\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\build_meta.py", line 211, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\build_meta.py", line 197, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\build_meta.py", line 248, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 448, in <module>
          setup_package()
        File "setup.py", line 440, in setup_package
          setup(**metadata)
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\core.py", line 169, in setup
          return old_setup(**new_attr)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
          dist.run_commands()
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\build.py", line 61, in run
          old_build.run(self)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\build_src.py", line 144, in run
          self.build_sources()
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\build_src.py", line 155, in build_sources
          self.build_library_sources(*libname_info)
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\build_src.py", line 288, in build_library_sources
          sources = self.generate_sources(sources, (lib_name, build_info))
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\build_src.py", line 378, in generate_sources
          source = func(extension, build_dir)
        File "numpy\core\setup.py", line 661, in get_mathlib_info
          st = config_cmd.try_link('int main(void) { return 0;}')
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 243, in try_link
          self._link(body, headers, include_dirs,
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\config.py", line 163, in _link
          return self._wrap_method(old_config._link, lang,
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\config.py", line 98, in _wrap_method
          ret = mth(*((self,)+args))
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 137, in _link
          (src, obj) = self._compile(body, headers, include_dirs, lang)
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\config.py", line 106, in _compile
          src, obj = self._wrap_method(old_config._compile, lang,
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\command\config.py", line 98, in _wrap_method
          ret = mth(*((self,)+args))
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 132, in _compile
          self.compiler.compile([src], include_dirs=include_dirs)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 401, in compile
          self.spawn(args)
        File "C:\Users\<>\AppData\Local\Temp\pip-build-env-d4os1400\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 505, in spawn
          return super().spawn(cmd, env=env)
        File "C:\Users\<>\AppData\Local\Temp\pip-install-70_b3s5b\numpy_86fa118ebf5b4d7c80e362a984a01332\numpy\distutils\ccompiler.py", line 88, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
      TypeError: CCompiler_spawn() got an unexpected keyword argument 'env'
      [end of output]```
github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 30 days with no activity.