Ml-agents: No module named 'mlagents.envs.communicator_objects'

Created on 13 Apr 2019  路  11Comments  路  Source: Unity-Technologies/ml-agents

Just tried to install latest 0.8 version of mlagents along with mlagents_env but we're running into this error when trying to from mlagents.envs import UnityEnvironment

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-86f1eadf4684> in <module>
----> 1 from mlagents.envs import UnityEnvironment

~/Documents/venvs/lib/python3.6/site-packages/mlagents/envs/__init__.py in <module>
      1 from .brain import *
----> 2 from .environment import *
      3 from .exception import *

~/Documents/venvs/lib/python3.6/site-packages/mlagents/envs/environment.py in <module>
     11 from .exception import UnityEnvironmentException, UnityActionException, UnityTimeOutException
     12 
---> 13 from .communicator_objects import UnityRLInput, UnityRLOutput, AgentActionProto, \
     14     EnvironmentParametersProto, UnityRLInitializationInput, UnityRLInitializationOutput, \
     15     UnityInput, UnityOutput, CustomResetParameters, CustomAction

ModuleNotFoundError: No module named 'mlagents.envs.communicator_objects'
bug

Most helpful comment

I had the same issue. I copied the communicators_objects folder from Github ml-agents/ml-agents-envs/mlagents/envs/ into the Anaconda3\envs\YOUR ENVIRONMENT NAME\Lib\site-packages\mlagents\envs
Now it is working! The problem seems to be that the communicator_objects folder is not installed with the pip command

All 11 comments

Hi @cbchouinard -- could you share the steps you took to update the package?

Hi @harperj, I created a new venv and pip installed

python3 -m venv someenv
pip3 install mlagents mlagents_envs

Also tried in another new venv:

git clone https://github.com/Unity-Technologies/ml-agents.git
cd ml-agents-envs
pip3 install -e ./
cd ..
cd ml-agents
pip3 install -e ./

With the same error on import both through python terminal or within Jupyter notebook. Running on Linux Ubuntu.

I had the same issue. I copied the communicators_objects folder from Github ml-agents/ml-agents-envs/mlagents/envs/ into the Anaconda3\envs\YOUR ENVIRONMENT NAME\Lib\site-packages\mlagents\envs
Now it is working! The problem seems to be that the communicator_objects folder is not installed with the pip command

I had to do the same with the PPO and bc folders. Only after that did the command work.

do you copy the folder or do you take the elements out of the folder and put them into envs. I tried this and it seemed to work at first (so that MLagents-learn works) , but then later it seems to have problems when I try to run the 3D balls.

@mattinjersey You have to move ml-agents/mlagents/trainers and ml-agents-envs/mlagents/envs into anaconda3/envs/py3.6/lib/python3.6/site-packages/mlagents/trainers/ and anaconda3/envs/py3.6/lib/python3.6/site-packages/mlagents/envs/ respectively to make it work. For some reason pip is not properly putting these subdirectories where they belong.

Folks, we just bumped a hot fix to deal with this. Please try it out.

I updated my system last night and have encountered the same problem

@eshvk great it's now working with 0.8.1! Thanks!

Thanks for reaching out to us. Hopefully you were able to resolve your issue. We are closing this due to inactivity, but if you need additional assistance, feel free to reopen the issue.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlindmark picture dlindmark  路  3Comments

Sohojoe picture Sohojoe  路  3Comments

Rodnyy picture Rodnyy  路  3Comments

MarkTension picture MarkTension  路  3Comments

MarcPilgaard picture MarcPilgaard  路  3Comments