baselines icon indicating copy to clipboard operation
baselines copied to clipboard

AttributeError: 'EnvSpec' object has no attribute '_entry_point'

Open PolarisYxh opened this issue 6 years ago • 10 comments

/home/yxh/anaconda3/envs/tensorenv/lib/python3.6/site-packages/baselines/baselines/run.py 2 places:env._entry_point.split(':')[0].split('.')[-1] change to env.entry_point.split(':')[0].split('.')[-1]

PolarisYxh avatar Aug 04 '19 07:08 PolarisYxh

You need to provide more information for us to be able to reproduce your error. How did you install the package? What is the exact code version you ran? What is the exact command you ran?

DanielTakeshi avatar Aug 05 '19 17:08 DanielTakeshi

I faced the same problem a few days ago. It seems to be an error coming from the gym package. As a temporary fix, until the issue is resolved, you could try to revert your gym to the commit "cc6ff414aefe669cc8d221a482ebe211816f60fe" URL to commit

asiddharth avatar Aug 06 '19 07:08 asiddharth

I found that if your gym is not the latest 0.14 version, there should be env._entry_point instead of env.entry_point . The reason is here--https://github.com/openai/gym/commit/dc91f434f83f3ad612ff353cbf2c1afc4788896b#diff-3dff15d44236dd4f0f823a6ddb7e8c9b . You could modify two 'env.entry_point' in baselines/run.py back into 'env._entry_point' to solve this problem. By the way, I guess update gym to the latest version may also help.

zapersea avatar Aug 06 '19 08:08 zapersea

I am getting the error too:

2019-10-16 15:23:50.846600: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: dlopen(libhdfs.dylib, 6): image not found
Traceback (most recent call last):
  File "/Users/ryanr/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/ryanr/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/ryanr/B.Eng/MCAST_Degree_4/Thesis/baselines/baselines/run.py", line 34, in <module>
    env_type = env._entry_point.split(':')[0].split('.')[-1]
AttributeError: 'EnvSpec' object has no attribute '_entry_point'

Not quite sure what the HadoopFileSystem load error is.

RyanRizzo96 avatar Oct 16 '19 13:10 RyanRizzo96

pip install --upgrade gym

kevincheng3 avatar Oct 24 '19 00:10 kevincheng3

Please post the versions of baselines and version of gym that you are using.

christopherhesse avatar Nov 08 '19 23:11 christopherhesse

On the tf2 branch, gym is locked into earlier gym version. I updated gym to 0.15.4 and received this error instead:

(baselines-tf2) umeboshi@bard:~/workspace/others/openai/baselines-tf2$ python -m baselines.run --alg=deepq --env=BreakoutNoFrameskip-v0 --num_timesteps=1e5 --save_path=breakout-dqn.pkl --load_path=breakout-dqn.pkl
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/freespace/home/umeboshi/workspace/others/openai/baselines-tf2/baselines/run.py", line 12, in <module>
    from baselines.common.cmd_util import common_arg_parser, parse_unknown_args, make_vec_env, make_env
  File "/freespace/home/umeboshi/workspace/others/openai/baselines-tf2/baselines/common/cmd_util.py", line 12, in <module>
    from gym.wrappers import FlattenDictWrapper
ImportError: cannot import name 'FlattenDictWrapper' from 'gym.wrappers' (/freespace/home/umeboshi/.virtualenvs/baselines-tf2/lib/python3.7/site-packages/gym/wrappers/__init__.py)

umeboshi2 avatar Dec 16 '19 19:12 umeboshi2

I corrected the above error by using #1051 as an exmple and replaced instances of FlattenDictWrapper with FlattenObservation.

umeboshi2 avatar Dec 16 '19 19:12 umeboshi2

Come on, why on earth openai gym doesn't follow any (semantic) versioning scheme and so many incompatible changes with minor releases? 0.15.4 -> 0.15.6 has changed and broke so many APIs including EnvSpec.tags, EnvSpec._entry_point, and some public APIs like FlattenDictWrapper, without any warning or deprecation. Dear OpenAI, please take it seriously.

wookayin avatar Feb 04 '20 13:02 wookayin

I found that install 0.14 of gym solved this issue:

pip install gym==0.14

jerryzhenleicai avatar Nov 08 '20 00:11 jerryzhenleicai