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

Some problems of test #3

Closed
Shenjwei opened this issue Nov 19, 2021 · 5 comments
Closed

Some problems of test #3

Shenjwei opened this issue Nov 19, 2021 · 5 comments

Comments

@Shenjwei
Copy link

I'm sorry to bother you again
I use the command
python test.py --save-path trial322/model_save --alg maddpg --alias 0 --scenario case322_3min_final --voltage-barrier-type l1 --test-mode single --test-day 730 --render
Then the program occur such error:

Traceback (most recent call last):
File "test.py", line 108, in
record = test.run(argv.test_day, 15, 1)
File "F:\MAPDN\utilities\tester.py", line 43, in run
self.env.render()
File "F:\MAPDN\environments\var_voltage_control\voltage_control_env.py", line 648, in render
self.init_render()
File "F:\MAPDN\environments\var_voltage_control\voltage_control_env.py", line 642, in init_render
from .rendering_voltage_control_env import Viewer
File "F:\MAPDN\environments\var_voltage_control\rendering_voltage_control_env.py", line 6, in
from gym import error
File "D:\anaconda3\envs\mapdn\lib\site-packages\gym_init
.py", line 13, in
from gym.envs import make, spec, register
File "D:\anaconda3\envs\mapdn\lib\site-packages\gym\envs_init
.py", line 10, in
load_env_plugins()
File "D:\anaconda3\envs\mapdn\lib\site-packages\gym\envs\registration.py", line 276, in load_env_plugins
fn = plugin.load()
File "D:\anaconda3\envs\mapdn\lib\site-packages\importlib_metadata_init
.py", line 194, in load
module = import_module(match.group('module'))
File "D:\anaconda3\envs\mapdn\lib\importlib_init_.py", line 127, in import_module
return _bootstrap.gcd_import(name[level:], package, level)
File "D:\anaconda3\envs\mapdn\lib\site-packages\ale_py\gym.py", line 5, in
from ale_py.roms.utils import rom_name_to_id, rom_id_to_name
File "D:\anaconda3\envs\mapdn\lib\site-packages\ale_py\roms_init
.py", line 94, in
_RESOLVED_ROMS = resolve_roms()
File "D:\anaconda3\envs\mapdn\lib\site-packages\ale_py\roms_init
.py", line 46, in resolve_roms
supported, unsupported = package.resolve()
File "D:\anaconda3\envs\mapdn\lib\site-packages\ale_py\roms\utils.py", line 60, in resolve
lambda file: file.suffix == ".bin", resources.files(self.package).iterdir()
File "D:\anaconda3\envs\mapdn\lib\site-packages\importlib_resources_common.py", line 22, in files
return from_package(get_package(package))
File "D:\anaconda3\envs\mapdn\lib\site-packages\importlib_resources_common.py", line 53, in get_package
resolved = resolve(package)
File "D:\anaconda3\envs\mapdn\lib\site-packages\importlib_resources_common.py", line 44, in resolve
return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand)
File "D:\anaconda3\envs\mapdn\lib\importlib_init
.py", line 127, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "D:\anaconda3\envs\mapdn\lib\site-packages\atari_py_init
.py", line 1, in
from .ale_python_interface import *
File "D:\anaconda3\envs\mapdn\lib\site-packages\atari_py\ale_python_interface.py", line 18, in
'ale_interface/ale_c.dll'))
File "D:\anaconda3\envs\mapdn\lib\ctypes_init
.py", line 442, in LoadLibrary
return self.dlltype(name)
File "D:\anaconda3\envs\mapdn\lib\ctypes_init
.py", line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126]

What should i do next,how should I use this module --rendering_voltage_control_env.py?

@hsvgbkhgbv
Copy link
Member

hsvgbkhgbv commented Nov 20, 2021

Hi,

Could you try annotating

from gym import error

and the related codes using error?

@Shenjwei
Copy link
Author

I try to install gym package as the annotating,but anothor error occurs.

Traceback (most recent call last):
File "test.py", line 93, in
checkpoint = torch.load(LOAD_PATH, map_location='cpu') if not args.cuda else torch.load(LOAD_PATH)
File "D:\anaconda3\envs\mapdn\lib\site-packages\torch\serialization.py", line 579, in load
with _open_file_like(f, 'rb') as opened_file:
File "D:\anaconda3\envs\mapdn\lib\site-packages\torch\serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "D:\anaconda3\envs\mapdn\lib\site-packages\torch\serialization.py", line 211, in init
super(_open_file, self).init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'l1/trial/model_save/var_voltage_control-case33_3min_final-distributed-maddpg-l1-0/model.pt'

I

@hsvgbkhgbv
Copy link
Member

This is due to the incorrect directory for --model-save. You can set it to the correct one and then it works.

@Shenjwei
Copy link
Author

I set it to the correct one .I install the gym package from anaconda search package ,but it doesn't work.
Then i use pip to install gym package.It occur such error.

Building wheel for box2d-py (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\anaconda3\envs\mapdn\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\sjw\AppData\Local\Temp\pip-install-o9maiff_\box2d-py_0878b2caa71447beb1849ade89abf29f\setup.py'"'"'; file='"'"'C:\Users\sjw\AppData\Local\Temp\pip-install-o9maiff_\box2d-py_0878b2caa71447beb1849ade89abf29f\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\sjw\AppData\Local\Temp\pip-wheel-vqgi8bbw'
cwd: C:\Users\sjw\AppData\Local\Temp\pip-install-o9maiff_\box2d-py_0878b2caa71447beb1849ade89abf29f
Complete output (16 lines):
Using setuptools (version 58.0.4).
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.7\Box2D
copying library\Box2D_init_.py -> build\lib.win-amd64-3.7\Box2D
creating build\lib.win-amd64-3.7\Box2D\b2
copying library\Box2D\b2_init_.py -> build\lib.win-amd64-3.7\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
error: command 'swig.exe' failed: No such file or directory

@hsvgbkhgbv
Copy link
Member

hsvgbkhgbv commented Nov 20, 2021

The best solution could be removing the from gym import error and the related codes for error.

Another solution is dropping windows and embracing Ubuntu.

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

2 participants