Future-Power-Networks / MAPDN

This repository is for an open-source environment for multi-agent active voltage control on power distribution networks (MAPDN).
MIT License
200 stars 54 forks source link

Some problems of test #3

Closed Shenjwei closed 2 years ago

Shenjwei commented 2 years ago

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 commented 2 years ago

Hi,

Could you try annotating

from gym import error

and the related codes using error?

Shenjwei commented 2 years ago

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 commented 2 years ago

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

Shenjwei commented 2 years ago

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-py0878b2caa71447beb1849ade89abf29f\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'"'"'))' bdistwheel -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 commented 2 years ago

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.