I am attempting to set up OpenAI’s Spinning Up on my macOS, following the provided instructions precisely. However, when I run the installation test, it seems to run into issues.
This is the command I execute for verifying the setup:
Traceback (most recent call last):
File "/Users/Leon/spinningup/spinup/utils/run_entrypoint.py", line 10, in <module>
thunk = pickle.loads(zlib.decompress(base64.b64decode(args.encoded_thunk)))
File "/Users/Leon/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 800, in _make_skel_func
closure = _reconstruct_closure(closures) if closures else None
File "/Users/Leon/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 792, in _reconstruct_closure
return tuple([_make_cell(v) for v in values])
TypeError: 'int' object is not iterable
What could be the issue? Any suggestions on how to resolve this would be greatly appreciated.
this error’s super annoying - happens constantly with mujoco environments. install gym 0.15.4 instead of the newer versions. they break spinningup’s serialization.
also, use tensorflow 1.15, not 2.x. spinningup wasn’t designed for tf2.
quick test: switch to cartpole or another basic environment first. that’ll tell you if it’s mujoco causing the problem.
This happens when your conda environment has mismatched dependency versions. I hit the same problem after upgrading anaconda with an older Spinning Up install still hanging around. Cloudpickle serialization changed between versions and broke how Spinning Up handles function arguments. Don’t bother downgrading individual packages - just create a fresh conda environment with Python 3.6 and install Spinning Up from scratch. Install gym[mujoco] first, then run your test command. Mixing newer anaconda with older RL frameworks always creates these serialization headaches that are a pain to debug one piece at a time.
I faced a similar cloudpickle error when setting up Spinning Up last year. Typically, this is due to a version mismatch between cloudpickle and your Python environment. I resolved it by downgrading cloudpickle to version 1.2.2 using the command: pip install cloudpickle==1.2.2. The updates in newer versions affect how serialization is handled, which can disrupt Spinning Up’s function closures. Additionally, ensure that your MuJoCo installation is correct, as Walker2d-v2 requires it. Once you downgrade cloudpickle, the test should run without issues, so don’t forget to restart Python afterward.
Had the exact same error working through OpenAI’s tutorials a few months ago. The problem’s with how your arguments get passed to serialization. That ‘int’ object isn’t iterable error means the hidden layer config isn’t parsing right. Wrap your hidden layer dimensions in quotes: --hid “[32,32]” instead of --hid [32,32]. The shell’s interpreting the brackets wrong and breaking argument parsing. Also check you’re using the same Python version you had when installing Spinning Up - switching interpreters after installation breaks cloudpickle deserialization. Spent hours debugging dependencies before realizing it was just argument escaping.