openai / maddpg

Code for the MADDPG algorithm from the paper "Multi-Agent Actor-Critic for Mixed Cooperative-Competitive Environments"

Home Page:https://arxiv.org/pdf/1706.02275.pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import Errors

murtazarang opened this issue · comments

Sorry for raising the same issue again. However, I have a strange issue here.

I can import the "maddpg" alone, however, when I run the script, I get the following errors copied below. The same issue is reproduced when I try to import maddpg.common.tf_util or the others in python using the terminal.

I am running OpenAI Gym > 0.10

I am pretty sure, that my PythonPath is set correctly, to the maddpg directory that has the init file in it.

Traceback (most recent call last):
File "train.py", line 9, in
import maddpg.common.tf_util as U
ImportError: No module named common.tf_util

Traceback (most recent call last):
File "train.py", line 10, in
from maddpg.trainer.maddpg import MADDPGAgentTrainer
ImportError: No module named trainer.maddpg

I had the same error and got around it by setting PythonPath to the maddpg directory which is the parent directory of the maddpg directory that you've mentioned.

For example:
export PYTHONPATH='./maddpg'

not:
export PYTHONPATH='./maddpg/maddpg'

when I use python 2,I have the same problem,but python 3 work correctly.the comamnd 'import maddpg' could work in python 2,but when I run train.py,there is also the error:
ImportError: No module named common.tf_util.e

@dylman123
I set my PYTHONPATH='/home/**/my/maddpg-master-new/maddpg',but it does not work.Could you please give me some suggestions,my python version is 2.7.

@awesome-xiaoy Hi, there is a known dependency to use Python 3.5.4

I have upgraded to Python 3.6, however the error I am now receiving is:

ModuleNotFoundError: No module named 'multiagent.multi_discrete'

Not sure how to fix this one...

Ok I managed to get rid of the above error by commenting out the line:

from multiagent.multi_discrete import MultiDiscrete

in maddpg/maddpg/common/distributions.py

Guys see
there is folder inside maddpg that is named maddpg itself while common is folder inside the folder so if maddpg.common is giving error it is not able to find common folder inside maddpg so all you need to to correct your pythonpath to include master directory which has maddpg as sub directory and common inside maddpg directory
hope that gives some better explanation..