Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错 python -m metagym.quadrotor.env hovering_control #56

Open
qa6300525 opened this issue May 6, 2022 · 4 comments
Open

报错 python -m metagym.quadrotor.env hovering_control #56

qa6300525 opened this issue May 6, 2022 · 4 comments

Comments

@qa6300525
Copy link

qa6300525 commented May 6, 2022

python -m metagym.quadrotor.env hovering_control

/Users/chengmaoyu/anaconda3/envs/rl-3.9/lib/python3.9/runpy.py:127: RuntimeWarning: 'metagym.quadrotor.env' found in sys.modules after import of package 'metagym.quadrotor', but prior to execution of 'metagym.quadrotor.env'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
Traceback (most recent call last):
File "/Users/chengmaoyu/anaconda3/envs/rl-3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/chengmaoyu/anaconda3/envs/rl-3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/chengmaoyu/code/test/rl/MetaGym/metagym/quadrotor/env.py", line 317, in
env.render()
File "/Users/chengmaoyu/code/test/rl/MetaGym/metagym/quadrotor/env.py", line 172, in render
raise RuntimeError('[Error] Cannot connect to display screen.')
RuntimeError: [Error] Cannot connect to display screen.

版本信息
gym 0.23.1
gym-notices 0.0.6
metagym 0.1.0
numpy 1.22.3

@qa6300525
Copy link
Author

我已经解决了,原因是
MetaGym/metagym/quadrotor/env.py:25 文件中
try:
from metagym.quadrotor.render import RenderWindow
except Exception as e:
print(e) # 本来没有这句
NO_DISPLAY = True

导致如果引用出错不会打印原因,我手动将原因打印出来,发现是包缺失,安装之后就能够跑了。

@tammy-bingbing
Copy link

#请问是缺少那些包呢?我遇到跟您一模一样的问题。

@WorldEditors
Copy link
Collaborator

可否贴出具体问题描述?从上面报错看,需要确认机器上面是否有显示设备或者GUI。如果没有,建议把enable_render关掉

@tammy-bingbing
Copy link

可否贴出具体问题描述?从上面报错看,需要确认机器上面是否有显示设备或者GUI。如果没有,建议把enable_render关掉

您好。使用的是windows。我想在命令行看一下的"Quadrotor", task="hovering_control"的渲染效果。问题在最后,请问如何解决
命令行输入如下:

from rlschool import make_env
env = make_env("Quadrotor", task="hovering_control")
env.reset()
array([ 0.3764959 , 1.1376995 , 0.6062036 , 0. , 0. ,
0. , 0. , 0. , -9.8 , -3.2034495 ,
-2.0571785 , 0.82844687, -0. , 0. , 0. ,
5. ], dtype=float32)
env.render()
Traceback (most recent call last):
File "", line 1, in
File "D:\ProgramData\Anaconda3\envs\RFlearning\lib\site-packages\rlschool\quadrotor\env.py", line 166, in render
raise RuntimeError('[Error] Cannot connect to display screen.')
RuntimeError: [Error] Cannot connect to display screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants