hill-a / stable-baselines

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
http://stable-baselines.readthedocs.io/
MIT License
4.14k stars 723 forks source link

No protocol specified [Bug] #1142

Closed lafmdp closed 2 years ago

lafmdp commented 2 years ago

When I wrap an env for myself and run "from stable_baselines.common.vec_env.dummy_vec_env import DummyVecEnv" for the second time, the process blocks and reports "no protocol specified". Does anyone have ideas about this problem?

Here is the example of my python code:


from stable_baselines import bench
from stable_baselines.common.vec_env.dummy_vec_env import DummyVecEnv
from stable_baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
from stable_baselines.common.vec_env.vec_normalize import VecNormalize

class myenv(gym.Env):
    xxxxx

def make_vec_env(*args):
    envs = [
        make_env(num_players)  # this line creates envs and puts them in a list
        for i in range(num_envs)
    ]

    if len(envs) > 1:
        envs = SubprocVecEnv(envs)
    else:
        envs = DummyVecEnv(envs)

    envs = VecNormalize(envs,  norm_reward=False, norm_obs=need_normalize, training=training)

    return envs

When I create the custom env for the first time after the computer restarts, the program is able to run normally. But when I shut down the progress and run it for the second time, a bug occurs. The traceback lists below. The process blocks after "No protocol specified" show.

Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21)
[GCC 7.3.0] on Linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from stable_baselines.common.vec_env.dummy_vec_env import DummyVecEnv
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

No protocol specified

System info: ubuntu 20.04 python 3.6.10

Miffyli commented 2 years ago

Please fill in the issue template.

lafmdp commented 2 years ago

There may be sth wrong with the tensorboard. When I stop running tensorboard in the background, this bug disappears.

Miffyli commented 2 years ago

This sounds like a tensorboard or custom environment issue, for which we do not offer tech support for the lack of time. I also recommend checking out stable-baselines3, which is more actively maintained.

If you have no further questions, feel free to close the issue.

lafmdp commented 2 years ago

Thanks. I have no further worry about this problem. Hope this issue will help people encountering the same problem later.