enajx/HebbianMetaLearning

Multiprocessing Error

rkalahasty opened this issue · 1 comments

Hi, I am currently trying to run train_hebb.py to reproduce the CarRacing-V0 results.
After training, it reports the error:

Traceback (most recent call last):
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\site-packages\gym\envs\classic_control\rendering.py", line 185, in __del__
  File "train_hebb.py", line 51, in <module>
    main(sys.argv)
  File "train_hebb.py", line 45, in main
    self.close()
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\site-packages\gym\envs\classic_control\rendering.py", line 99, in close
    es.run(args.generations, print_step=args.print_every, path=args.folder)
  File "C:\Users\17033\isef2022\HebbianMetaLearning\evolution_strategy_hebb.py", line 338, in run
    rewards = self._get_rewards_coevolved(pool, population, population_coevolved)                       # Compute population fitness:  Step 6
  File "C:\Users\17033\isef2022\HebbianMetaLearning\evolution_strategy_hebb.py", line 268, in _get_rewards_coevolved
    if self.isopen and sys.meta_path:
AttributeError: 'Viewer' object has no attribute 'isopen'
    rewards  = pool.map(worker_process_hebb_coevo, worker_args)
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\multiprocessing\pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\multiprocessing\pool.py", line 771, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x000001B99E91F580>'. Reason: 'Value
Error('ctypes objects containing pointers cannot be pickled')'

I also get another error, that repeats multiple times.

Traceback (most recent call last):
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\site-packages\gym\envs\classic_control\rendering.py", line 185, in __del__
    self.close()
  File "C:\Users\17033\anaconda3\envs\metaplasticity\lib\site-packages\gym\envs\classic_control\rendering.py", line 99, in close
    if self.isopen and sys.meta_path:
AttributeError: 'Viewer' object has no attribute 'isopen'
Exception ignored in: <function Viewer.__del__ at 0x000002D4C87F5AF0>

Although, I am not sure if the two errors are related in anyway. I suspect that the errors are due to my package versions.

Package             Version
------------------- ---------
arviz               0.11.2
Bottleneck          1.3.5
Box2D               2.3.10
box2d-py            2.3.5
certifi             2022.9.24
cffi                1.15.1
cftime              1.5.1.1
cloudpickle         2.2.0
cycler              0.11.0
Cython              0.29.32
fonttools           4.25.0
glfw                2.5.5
gym                 0.21.0
imageio             2.22.2
importlib-metadata  5.0.0
importlib-resources 5.10.0
kiwisolver          1.4.2
llvmlite            0.39.1
lockfile            0.12.2
lz4                 4.0.2
matplotlib          3.5.2
mkl-fft             1.3.1
mkl-random          1.2.2
mkl-service         2.4.0
munkres             1.1.4
netCDF4             1.5.7
numba               0.56.3
numexpr             2.8.3
numpy               1.23.4
opencv-python       4.6.0.66
packaging           21.3
pandas              1.4.4
Pillow              9.2.0
pip                 22.2.2
pybullet            3.2.5
pycparser           2.21
pyglet              1.5.27
pyparsing           3.0.9
pystan              2.19.1.1
python-dateutil     2.8.2
pytz                2022.1
scipy               1.9.1
setuptools          65.4.0
six                 1.16.0
torch               1.12.1
typing_extensions   4.3.0
wheel               0.37.1
wincertstore        0.2
xarray              0.20.1
zipp                3.10.0

Here are my package versions.

enajx commented

Here's a dependecy list that runs without errors on my side with python 3.9

Package            Version
------------------ --------
box2d-py           2.3.8
cloudpickle        2.2.0
gym                0.21.0
gym-notices        0.0.8
importlib-metadata 5.0.0
llvmlite           0.39.1
numba              0.56.3
numpy              1.23.4
opencv-python      4.6.0.66
pip                22.1.1
pybullet           3.2.5
pygame             2.1.2
pyglet             1.5.27
setuptools         62.3.2
swig               4.0.2
torch              1.12.1
typing_extensions  4.4.0
zipp               3.9.0

I'm closing the issue since I can't reproduce it, feel free to reopen it if issue is not solve with this packages dependency.