Mac ml-agents release 19(v0
Mac ml-agents release 19(v0.28.0)踩雷
主要参考这篇博客:
跟着这篇安装完,在激活虚拟环境的终端输入mlagents-learn检验,如果正常应输出如下:
后面超时报错不用管,因为还没在unity中启动训练环境。
但是在跟完这篇博客后我这里并未成功执行此命令,报了几个错,下面是报错和对应解决方式:
! python3.8!!!!!!python3.8!!!!!博客里pytorch的下载那个cpu/torch-1.9.0-cp38-none-macosx_11_0_arm64.whl
的38是指的py3.8,第一次用了3.9环境报了没能解决的错,重开了
1.protobuf要降级
-终端报错:
...
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 621, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
...
(ml-agents) acciomac@acciomacdeMacBook-Pro ml-agents-release_19 % pip install 'protobuf<=3.20.1' --force-reinstall
-解决方式:
来源:https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly
采用命令,强制降级:
pip install 'protobuf<=3.20.1' --force-reinstall
2.numpy的np.float被弃用导致
-终端报错:
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
-解决方式:
参考:https://blog.csdn.net/qq_45934285/article/details/131120167
可以改代码,但不方便,我直接降级了。
采用命令:
conda install numpy==1.23.5
3.没有six
Module
-终端报错:
File "/opt/anaconda3/envs/ml-agents/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py", line 8, in <module>
from six.moves import range
ModuleNotFoundError: No module named 'six'
-解决方式:
下就好了,采用命令:
pip install six