Ml-agents: cannot import name 'UnityEnvironment' from 'mlagents.envs'

Created on 1 Oct 2019  路  12Comments  路  Source: Unity-Technologies/ml-agents

I just updated to Beta 0.10.0 and I noticed that the file __init__.py in mlagents/envs was empty. I recevied error cannot import name 'UnityEnvironment' from 'mlagents.envs' when running from mlagents.envs import UnityEnvironment. Is that a bug or mlagents changed the import way?

bug

Most helpful comment

Got it, I think I know what's going on. We'll look at the issue in more depth, but for now you should be able to import it by using from mlagents.envs.environment import UnityEnvironment.

All 12 comments

have the same issues, 'cause __init__.py in envs and trainers are empty.

a lot of problems about file references, i.e. no .py file named tensorflow_to_barracuda in trainers folder.

Hi @BlueFisher, @StepNeverStop, which install method are you using? Are you installing from pip or from source? We haven't changed the imports from 0.9.2 in 0.10.0.

I got the same error installing via pip.

Hi @JMFox, which platform are you on (Windows, Linux, Mac), and which Python version? I've tried a fresh pip install on Mac with Python 3.6.5 and haven't been able to replicate

I installed it using Anaconda on Windows, Python 3.6.1. I followed the installation guide in the repo. The error appears when I ran the getting_started notebook in Jupyter. I ran some of the demos in Unity and things seemed to work fine.

Got it, I think I know what's going on. We'll look at the issue in more depth, but for now you should be able to import it by using from mlagents.envs.environment import UnityEnvironment.

That worked. Thanks @ervteng

@ervteng That worked for now. Thanks.

Ah, we removed some of the import *'s in this PR: https://github.com/Unity-Technologies/ml-agents/pull/2584/files#diff-829b0b865c5a9e2ea85ed647b3012702L1

moving from
from mlagents.envs import UnityEnvironment
to
from mlagents.envs.environment import UnityEnvironment
worked for me, on Windows, using Python 3.6.9
Thx (Might want to fiw the notebooks "geting-started")

use from mlagents_envs.environment import UnityEnvironment

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkTension picture MarkTension  路  3Comments

MrGitGo picture MrGitGo  路  4Comments

green4you picture green4you  路  4Comments

GuntherFox picture GuntherFox  路  3Comments

Procuste34 picture Procuste34  路  3Comments