Open fighting-zz opened 2 years ago
I am facing same issue on windows 10. Please let me know if you found any solution.
Same issue
I am facing same issue on windows 10. Please let me know if you found any solution.
sorry, i have not find any solutions.
Same issue try it on ubuntu
I am facing same issue on windows 10. Please let me know if you found any solution.
try it on ubuntu
Yes, I using docker to try on ubuntu and succeed, but it is so wired why facing problem on Windows? According to error message, I guess there are some bug exist when using multiprocess on Windows(?
i searched this issue on internet and i have not find a specific solution. But the general meaning is like that win10 does not support multiprocess.
Yes, I using docker to try on ubuntu and succeed, but it is so wired why facing problem on Windows? According to error message, I guess there are some bug exist when using multiprocess on Windows(?
i am also confused about this issue.
Hey, I'm facing the same issue on a mac, any solution?
same issue on windows
By converting all absl flags into arguments, I was able to get the run_ppo2.py file to train in Windows 10:
from future import absolute_import, division, print_function import multiprocessing import os from absl import app, flags from baselines import logger from baselines.bench import monitor from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv from baselines.ppo2 import ppo2 import gfootball.env as football_env from gfootball.examples import models
FLAGS = flags.FLAGS
def create_single_football_env(iprocess, level, state, reward_experiment, render, dump_full_episodes, dump_scores): env = football_env.create_environment( env_name=level, stacked=('stacked' in state), rewards=reward_experiment, logdir=logger.get_dir(), write_goal_dumps=dump_scores and (iprocess == 0), write_full_episode_dumps=dump_full_episodes and (iprocess == 0), render=render and (iprocess == 0), dump_frequency=50 if render and iprocess == 0 else 0) env = monitor.Monitor(env, logger.get_dir() and os.path.join(logger.get_dir(), str(iprocess))) return env
def train(level, state, reward_experiment, policy, num_timesteps, num_envs, nsteps, noptepochs, nminibatches, save_interval, seed, lr, ent_coef, gamma, cliprange, max_grad_norm, render, dump_full_episodes, dump_scores, load_path): vec_env = SubprocVecEnv([ (lambda _i=i: create_single_football_env(_i, level, state, reward_experiment, render, dump_full_episodes, dump_scores)) for i in range(num_envs) ], context=None)
import tensorflow.compat.v1 as tf
ncpu = multiprocessing.cpu_count()
config = tf.ConfigProto(allow_soft_placement=True,
intra_op_parallelism_threads=ncpu,
inter_op_parallelism_threads=ncpu)
config.gpu_options.allow_growth = True
tf.Session(config=config).__enter__()
ppo2.learn(network=policy,
total_timesteps=num_timesteps,
env=vec_env,
seed=seed,
nsteps=nsteps,
nminibatches=nminibatches,
noptepochs=noptepochs,
max_grad_norm=max_grad_norm,
gamma=gamma,
ent_coef=ent_coef,
lr=lr,
log_interval=1,
save_interval=save_interval,
cliprange=cliprange,
load_path=load_path)
if name == 'main': app.run(lambda _: train( FLAGS.level, FLAGS.state, FLAGS.reward_experiment, FLAGS.policy, FLAGS.num_timesteps, FLAGS.num_envs, FLAGS.nsteps, FLAGS.noptepochs, FLAGS.nminibatches, FLAGS.save_interval, FLAGS.seed, FLAGS.lr, FLAGS.ent_coef, FLAGS.gamma, FLAGS.cliprange, FLAGS.max_grad_norm, FLAGS.render, FLAGS.dump_full_episodes, FLAGS.dump_scores, FLAGS.load_path ))
(football-env) c:\dev\football>python -m gfootball.examples.run_ppo2 --level=academy_empty_goal_close Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "c:\dev\football\gfootball\examples\run_ppo2.py", line 121, in
app.run(train)
File "c:\dev\football\football-env\lib\site-packages\absl\app.py", line 308, in run
_run_main(main, args)
File "c:\dev\football\football-env\lib\site-packages\absl\app.py", line 254, in _run_main
sys.exit(main(argv))
File "c:\dev\football\gfootball\examples\run_ppo2.py", line 90, in train
], context=None)
File "c:\dev\football\football-env\lib\site-packages\baselines\common\vec_env\subproc_vec_env.py", line 57, in init
p.start()
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
File "c:\dev\football\football-env\lib\site-packages\baselines\common\vec_env\vec_env.py", line 195, in getstate
return cloudpickle.dumps(self.x)
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 1125, in dumps
cp.dump(obj)
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 482, in dump
return Pickler.dump(self, obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 437, in dump
self.save(obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 556, in save_function
return self.save_function_tuple(obj)
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 758, in save_function_tuple
save(state)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\dill_dill.py", line 1251, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 859, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 885, in _batch_setitems
save(v)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\dill_dill.py", line 1251, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 859, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 890, in _batch_setitems
save(v)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 556, in save_function
return self.save_function_tuple(obj)
File "c:\dev\football\football-env\lib\site-packages\cloudpickle\cloudpickle.py", line 758, in save_function_tuple
save(state)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\dill_dill.py", line 1251, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 859, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 885, in _batch_setitems
save(v)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 504, in save
f(self, obj) # Call unbound method with explicit self
File "c:\dev\football\football-env\lib\site-packages\dill_dill.py", line 1251, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 859, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 885, in _batch_setitems
save(v)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pickle.py", line 524, in save
rv = reduce(self.proto)
File "c:\dev\football\football-env\lib\site-packages\absl\flags_flagvalues.py", line 657, in getstate
raise TypeError("can't pickle FlagValues")
TypeError: can't pickle FlagValues
Exception ignored in: <function SubprocVecEnv.del at 0x00000244623A1828>
Traceback (most recent call last):
File "c:\dev\football\football-env\lib\site-packages\baselines\common\vec_env\subproc_vec_env.py", line 107, in del
File "c:\dev\football\football-env\lib\site-packages\baselines\common\vec_env\vec_env.py", line 98, in close
File "c:\dev\football\football-env\lib\site-packages\baselines\common\vec_env\subproc_vec_env.py", line 93, in close_extras
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 139, in join
AssertionError: can only join a started process
(football-env) c:\dev\football>Traceback (most recent call last): File "", line 1, in
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
pip list: Package Version
absl-py 1.2.0 astunparse 1.6.3 baselines 0.1.5 cachetools 5.2.0 certifi 2022.6.15 charset-normalizer 2.1.0 click 8.1.3 cloudpickle 1.2.2 colorama 0.4.5 dill 0.3.5.1 dm-sonnet 2.0.0 dm-tree 0.1.7 flatbuffers 1.12 future 0.18.2 gast 0.4.0 gfootball 2.10.3 google-auth 2.9.1 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 grpcio 1.47.0 gym 0.13.1 h5py 3.7.0 idna 3.3 importlib-metadata 4.12.0 joblib 1.1.0 keras 2.9.0 Keras-Preprocessing 1.1.2 libclang 14.0.1 Markdown 3.4.1 numpy 1.21.6 oauthlib 3.2.0 opencv-python 4.6.0.66 opt-einsum 3.3.0 packaging 21.3 pip 22.2 progressbar2 4.0.0 protobuf 3.19.4 psutil 5.9.1 pyasn1 0.4.8 pyasn1-modules 0.2.8 pygame 2.1.2 pyglet 1.3.2 pyparsing 3.0.9 python-utils 3.3.3 requests 2.28.1 requests-oauthlib 1.3.1 rsa 4.9 scipy 1.7.3 setuptools 63.2.0 six 1.16.0 tabulate 0.8.10 tensorboard 2.9.1 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 tensorflow-cpu 2.9.1 tensorflow-estimator 2.9.0 tensorflow-io-gcs-filesystem 0.26.0 termcolor 1.1.0 tqdm 4.64.0 typing_extensions 4.3.0 urllib3 1.26.10 Werkzeug 2.1.2 wheel 0.37.1 wrapt 1.14.1 zipp 3.8.1