admin管理员组文章数量:1026356
I am trying to install mlagents. I got to the part in python but after creating a virtual enviorment with pyenv and setting the local version to 3.10, 3.9, and 3.8 it works on none of them. I upgraded pip, installed mlagents, then torch,torchvision, and torchaudio. Then I tested mlagents-learn --help and then because of a error installed protobuf 3.20.3. I then tested again to get the following error
(venv) D:\Unity\AI Ecosystem>mlagents-learn --help
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Unity\AI Ecosystem\venv\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
from mlagents import torch_utils
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
from mlagents.trainers.settings import TorchSettings
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 644, in <module>
class TrainerSettings(ExportableSettings):
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 667, in TrainerSettings
cattr.register_structure_hook(
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\converters.py", line 207, in register_structure_hook
self._structure_func.register_cls_list([(cl, func)])
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\dispatch.py", line 55, in register_cls_list
self._single_dispatch.register(cls, handler)
File "C:\Users\Ebrah\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
raise TypeError(
TypeError: Invalid first argument to `register()`. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class or union type.
I tried installing cattrs 1.5.0 but the error remains. As I said before I also tried in 3.11, 3.10, 3.9 and 3.8 and got the same error in all of them. My unity version is 2022.3.5f1 but I don't see how that would make a difference. My pyenv version is 3.1.1. I am on windows 11 and am using pyenv-win.
I am trying to install mlagents. I got to the part in python but after creating a virtual enviorment with pyenv and setting the local version to 3.10, 3.9, and 3.8 it works on none of them. I upgraded pip, installed mlagents, then torch,torchvision, and torchaudio. Then I tested mlagents-learn --help and then because of a error installed protobuf 3.20.3. I then tested again to get the following error
(venv) D:\Unity\AI Ecosystem>mlagents-learn --help
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Unity\AI Ecosystem\venv\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
from mlagents import torch_utils
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
from mlagents.trainers.settings import TorchSettings
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 644, in <module>
class TrainerSettings(ExportableSettings):
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 667, in TrainerSettings
cattr.register_structure_hook(
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\converters.py", line 207, in register_structure_hook
self._structure_func.register_cls_list([(cl, func)])
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\dispatch.py", line 55, in register_cls_list
self._single_dispatch.register(cls, handler)
File "C:\Users\Ebrah\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
raise TypeError(
TypeError: Invalid first argument to `register()`. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class or union type.
I tried installing cattrs 1.5.0 but the error remains. As I said before I also tried in 3.11, 3.10, 3.9 and 3.8 and got the same error in all of them. My unity version is 2022.3.5f1 but I don't see how that would make a difference. My pyenv version is 3.1.1. I am on windows 11 and am using pyenv-win.
Share Improve this question edited Dec 30, 2024 at 12:03 desertnaut 60.3k31 gold badges151 silver badges177 bronze badges asked Dec 30, 2024 at 6:36 JoemamaJoemama 153 bronze badges 1- github.com/Unity-Technologies/ml-agents/… – phd Commented Dec 30, 2024 at 11:41
1 Answer
Reset to default 2Try deleting your unity project and making a new one. Unity says to use conda so try that too. Use python 3.9.
I am trying to install mlagents. I got to the part in python but after creating a virtual enviorment with pyenv and setting the local version to 3.10, 3.9, and 3.8 it works on none of them. I upgraded pip, installed mlagents, then torch,torchvision, and torchaudio. Then I tested mlagents-learn --help and then because of a error installed protobuf 3.20.3. I then tested again to get the following error
(venv) D:\Unity\AI Ecosystem>mlagents-learn --help
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Unity\AI Ecosystem\venv\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
from mlagents import torch_utils
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
from mlagents.trainers.settings import TorchSettings
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 644, in <module>
class TrainerSettings(ExportableSettings):
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 667, in TrainerSettings
cattr.register_structure_hook(
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\converters.py", line 207, in register_structure_hook
self._structure_func.register_cls_list([(cl, func)])
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\dispatch.py", line 55, in register_cls_list
self._single_dispatch.register(cls, handler)
File "C:\Users\Ebrah\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
raise TypeError(
TypeError: Invalid first argument to `register()`. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class or union type.
I tried installing cattrs 1.5.0 but the error remains. As I said before I also tried in 3.11, 3.10, 3.9 and 3.8 and got the same error in all of them. My unity version is 2022.3.5f1 but I don't see how that would make a difference. My pyenv version is 3.1.1. I am on windows 11 and am using pyenv-win.
I am trying to install mlagents. I got to the part in python but after creating a virtual enviorment with pyenv and setting the local version to 3.10, 3.9, and 3.8 it works on none of them. I upgraded pip, installed mlagents, then torch,torchvision, and torchaudio. Then I tested mlagents-learn --help and then because of a error installed protobuf 3.20.3. I then tested again to get the following error
(venv) D:\Unity\AI Ecosystem>mlagents-learn --help
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Unity\AI Ecosystem\venv\Scripts\mlagents-learn.exe\__main__.py", line 4, in <module>
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\learn.py", line 2, in <module>
from mlagents import torch_utils
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\torch_utils\torch.py", line 6, in <module>
from mlagents.trainers.settings import TorchSettings
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 644, in <module>
class TrainerSettings(ExportableSettings):
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\mlagents\trainers\settings.py", line 667, in TrainerSettings
cattr.register_structure_hook(
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\converters.py", line 207, in register_structure_hook
self._structure_func.register_cls_list([(cl, func)])
File "D:\Unity\AI Ecosystem\venv\Lib\site-packages\cattr\dispatch.py", line 55, in register_cls_list
self._single_dispatch.register(cls, handler)
File "C:\Users\Ebrah\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
raise TypeError(
TypeError: Invalid first argument to `register()`. typing.Dict[mlagents.trainers.settings.RewardSignalType, mlagents.trainers.settings.RewardSignalSettings] is not a class or union type.
I tried installing cattrs 1.5.0 but the error remains. As I said before I also tried in 3.11, 3.10, 3.9 and 3.8 and got the same error in all of them. My unity version is 2022.3.5f1 but I don't see how that would make a difference. My pyenv version is 3.1.1. I am on windows 11 and am using pyenv-win.
Share Improve this question edited Dec 30, 2024 at 12:03 desertnaut 60.3k31 gold badges151 silver badges177 bronze badges asked Dec 30, 2024 at 6:36 JoemamaJoemama 153 bronze badges 1- github.com/Unity-Technologies/ml-agents/… – phd Commented Dec 30, 2024 at 11:41
1 Answer
Reset to default 2Try deleting your unity project and making a new one. Unity says to use conda so try that too. Use python 3.9.
本文标签:
版权声明:本文标题:unity game engine - mlagents-learn --help is giving errors (python=3.11, 3.10, 3.9, 3.8) - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1735932946a1360955.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论