DARC
DARC copied to clipboard
gym.error.Error: Attempted to look up malformed environment ID: b'DARC-master'. (Currently all IDs must be of the form ^(?:[\w:-]+\/)?([\w:.-]+)-v(\d+)$.)
When I run this command, I get this error, what is the problem?Is there any solution?I have been configuring the environment for this project for a week, and it has not succeeded, can you tell me how to configure the project environment?
python main.py --env <environment_name> --save-model --policy DARC --dir ./logs/DARC/r1 --seed 1 --qweight 0.1 --reg 0.005
error: gym.error.Error: Attempted to look up malformed environment ID: b'DARC-master'. (Currently all IDs must be of the form ^(?:[\w:-]+/)?([\w:.-]+)-v(\d+)$.)
Hi, to the best of my knowledge, this error occurs when you use a self-defined environment instead of a standard built-in Gym environments. The following links seem to be relevant and you can check it out!
https://github.com/openai/gym/issues/1514
https://stackoverflow.com/questions/53602382/register-openai-gym-malformed-environment-failure
If you run the commands on a Gym environment and get similar errors, please let me know. For example,
python main.py --env Hopper-v2 --save-model --policy DARC --dir ./logs/DARC/r1 --seed 1 --qweight 0.1 --reg 0.005
Name Version Build Channel
_libgcc_mutex 0.1 main https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
_openmp_mutex 5.1 1_gnu https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
absl-py 2.1.0 pypi_0 pypi
alabaster 0.7.13 pypi_0 pypi
babel 2.14.0 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
box2d-py 2.3.8 pypi_0 pypi
ca-certificates 2024.2.2 hbcca054_0 conda-forge
certifi 2024.2.2 pyhd8ed1ab_0 conda-forge
cffi 1.15.1 pypi_0 pypi
charset-normalizer 3.3.2 pypi_0 pypi
cloog 0.18.0 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
cloudpickle 1.6.0 pypi_0 pypi
cython 0.29.37 pypi_0 pypi
decorator 5.1.1 pypi_0 pypi
docutils 0.19 pypi_0 pypi
exceptiongroup 1.2.0 pypi_0 pypi
expat 2.4.8 h27087fc_0 conda-forge
farama-notifications 0.0.4 pypi_0 pypi
fasteners 0.19 pypi_0 pypi
future 1.0.0 pypi_0 pypi
gcc 4.8.5 7 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
glew 2.1.0 h9c3ff4c_2 conda-forge
glfw 2.7.0 pypi_0 pypi
glfw3 3.2.1 0 menpo
gmp 6.1.0 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
gym 0.18.0 pypi_0 pypi
gym-notices 0.0.8 pypi_0 pypi
gymnasium 0.28.1 pypi_0 pypi
idna 3.6 pypi_0 pypi
imagehash 4.3.1 pypi_0 pypi
imageio 2.9.0 pypi_0 pypi
imagesize 1.4.1 pypi_0 pypi
importlib-metadata 6.7.0 pypi_0 pypi
iniconfig 2.0.0 pypi_0 pypi
ipdb 0.13.13 pypi_0 pypi
ipython 7.34.0 pypi_0 pypi
isl 0.12.2 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
jax-jumpy 1.0.0 pypi_0 pypi
jedi 0.19.1 pypi_0 pypi
jinja2 3.1.3 pypi_0 pypi
ld_impl_linux-64 2.38 h1181459_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libffi 3.3 he6710b0_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgcc-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libglu 9.0.0 he1b5a44_1001 conda-forge
libgomp 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libstdcxx-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libxcb 1.12 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
lockfile 0.12.2 pypi_0 pypi
markupsafe 2.1.5 pypi_0 pypi
matplotlib-inline 0.1.6 pypi_0 pypi
mesalib 18.3.1 h590aaf7_0 conda-forge
mpc 1.0.3 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
mpfr 3.1.5 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
mujoco-py 2.1.2.14 pypi_0 pypi
ncurses 6.4 h6a678d5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy 1.21.6 pypi_0 pypi
numpydoc 1.5.0 pypi_0 pypi
openssl 1.1.1o h166bdaf_0 conda-forge
packaging 23.2 pypi_0 pypi
parso 0.8.3 pypi_0 pypi
patchelf 0.17.2.1 pypi_0 pypi
pexpect 4.9.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 7.2.0 pypi_0 pypi
pip 22.3.1 py37h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pluggy 1.2.0 pypi_0 pypi
prompt-toolkit 3.0.43 pypi_0 pypi
protobuf 4.24.4 pypi_0 pypi
ptyprocess 0.7.0 pypi_0 pypi
pybullet 3.2.6 pypi_0 pypi
pybulletgym 0.1 dev_0
I installed the environment in the readme via pip,including “pip install gym==0.18.0". Can you elaborate on how to deploy the project environment?
It seems you have already prepared all the packages needed to run the codes.
First, please make sure that you can import mujoco_py without errors in python. Please also make sure that mujoco is installed and the path is added in the .bashrc
(also remember to source the .bashrc
file). Then, please make sure that you can successfully make Gym environments and can interact with the environment. For a quick test, you can run the following testing codes:
import gym
env = gym.make('Hopper-v2')
state = env.reset()
action = env.action_space.sample()
env.step(action)
If all these are ready and prepared, the DARC agent can be trained by calling:
python main.py --env Hopper-v2 --save-model --policy DARC --dir ./logs/DARC/r1 --seed 1 --qweight 0.1 --reg 0.005
Can you run DARC on Gym environments like Hopper-v2?
I've installed and imported mujoco correctly.
/home/jayking/图片/2024-03-23 11-34-51 的屏幕截图.png
when I run main.py file, it returns the following error.
Traceback (most recent call last):
File "/home/jayking/桌面/paper/2 (PWC)Efficient Continuous Control with Double Actors and Regularized Critics/DARC-master/main.py", line 158, in
When I run the following command in the pycharm terminal
python main.py --env DARC-master --save-model --policy DARC --dir ./logs/DARC/r1 --seed 1 --qweight 0.1 --reg 0.005
DARC-master is my virtual environment name.
It returns the following error.
gym.error.Error: Attempted to look up malformed environment ID: b'DARC-master'. (Currently all IDs must be of the form ^(?:[\w:-]+/)?([\w:.-]+)-v(\d+)$.)
import gym
env = gym.make('Hopper-v2')
state = env.reset()
action = env.action_space.sample()
env.step(action)
I tested as you provided the command and there were no errors.
It output
(array([ 1.25174789e+00, 9.83464941e-04, 8.57300138e-04, -5.43328104e-03,
-9.26288475e-03, 1.01797468e-02, -5.32635501e-02, 6.97706286e-01,
9.26560873e-01, -1.17996963e-01, -1.29647609e+00]), 1.0034917395753498, False, {})
Hi, when running this repo in pycharm, you ought not to specify the env_name as DARC-master, but the specified task name, e.g., Hopper-v2. Please try following:
python main.py --env Hopper-v2 --save-model --policy DARC --dir ./logs/DARC/r1 --seed 1 --qweight 0.1 --reg 0.005
Meanwhile, the referenced code seems to be line 152 in our repo instead of line 158 (it seems you add some other codes, please check your codes!), see https://github.com/dmksjfl/DARC/blob/112ddf7944bc57482ad8d9eb58a9affcc1037abe/main.py#L152C28-L152C34
For a quick check, please return back to the original version, This error occurs as the policy is not defined. If you use our original code and specify the policy as --policy DARC
, the policy should get defined.