Skip to content

JSON Serializable error #2328

@bara-bba

Description

@bara-bba

Hi everyone!

I installed garage on my new pc but in doing so I encountered this error. My environment hasn't changed at all so I think it is due to a version incompatibility of packages.

pip list looks like this:

Package                      Version
---------------------------- ---------------
absl-py                      1.0.0
aiosignal                    1.2.0
akro                         0.0.8
argon2-cffi                  21.3.0
argon2-cffi-bindings         21.2.0
astunparse                   1.6.3
attrs                        21.4.0
bleach                       4.1.0
cachetools                   5.2.0
certifi                      2022.5.18.1
charset-normalizer           2.0.12
click                        8.1.3
cloudpickle                  2.1.0
cma                          2.7.0
cycler                       0.11.0
debugpy                      1.5.1
decorator                    5.1.1
defusedxml                   0.7.1
Deprecated                   1.2.13
distlib                      0.3.4
dm-env                       1.5
dm-tree                      0.1.7
dowel                        0.0.3
filelock                     3.7.1
flatbuffers                  1.12
fonttools                    4.33.3
frozenlist                   1.3.0
future                       0.18.2
garage                       2021.3.0
gast                         0.4.0
glfw                         2.5.3
google-auth                  2.6.6
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.43.0
gym                          0.24.0
gym-notices                  0.0.6
h5py                         3.7.0
idna                         3.3
imageio                      2.19.3
importlib-metadata           4.11.4
importlib-resources          5.7.1
ipython-genutils             0.2.0
jsonschema                   4.5.1
jupyter-core                 4.9.2
jupyterlab-pygments          0.1.2
keras                        2.9.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.2
labmaze                      1.0.5
libclang                     14.0.1
lxml                         4.7.1
Markdown                     3.3.7
matplotlib                   3.5.2
mistune                      0.8.4
mkl-fft                      1.3.1
mkl-random                   1.2.2
mkl-service                  2.4.0
msgpack                      1.0.3
mujoco                       2.1.2
nbclient                     0.5.11
nest-asyncio                 1.5.4
networkx                     2.8.2
notebook                     6.4.8
numpy                        1.22.3
oauthlib                     3.2.0
opt-einsum                   3.3.0
packaging                    21.3
pandocfilters                1.5.0
pathlib                      1.0.1
pathlib2                     2.3.6
Pillow                       9.0.1
pip                          22.1.2
platformdirs                 2.5.2
prometheus-client            0.13.1
protobuf                     3.19.4
psutil                       5.9.1
ptyprocess                   0.7.0
pyasn1                       0.4.8
pyasn1-modules               0.2.8
PyOpenGL                     3.1.5
pyparsing                    3.0.9
pyrsistent                   0.18.1
python-dateutil              2.8.2
PyWavelets                   1.3.0
PyYAML                       6.0
pyzmq                        22.3.0
ray                          1.12.1
redis                        4.1.1
requests                     2.27.1
requests-oauthlib            1.3.1
rlkit                        0.2.1.dev0
rsa                          4.8
scikit-image                 0.19.2
scipy                        1.8.1
Send2Trash                   1.8.0
setproctitle                 1.2.3
setuptools                   61.2.0
six                          1.16.0
tabulate                     0.8.9
tensorboard                  2.9.0
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorboardX                 2.5
tensorflow                   2.9.1
tensorflow-estimator         2.9.0
tensorflow-io-gcs-filesystem 0.26.0
tensorflow-probability       0.16.0
termcolor                    1.1.0
terminado                    0.13.1
testpath                     0.6.0
tifffile                     2022.5.4
torch                        1.7.1
torchaudio                   0.7.0a0+a853dff
torchvision                  0.8.0a0
tqdm                         4.62.3
typing_extensions            4.1.1
urllib3                      1.26.9
virtualenv                   20.14.1
webencodings                 0.5.1
Werkzeug                     2.1.2
wheel                        0.37.1
wrapt                        1.14.1
zipp                         3.8.0

And this is the error:

/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/flatbuffers/compat.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Only `cma.purecma` has been imported. Install `numpy` ("pip install numpy") if you want to import the entire `cma` package.

/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py:551: UserWarning: Archiving a launch repo larger than 8MiB. This may be slow. Set archive_launch_repo=False in wrap_experiment to disable this behavior.
  warnings.warn('Archiving a launch repo larger than 8MiB. This may be '
2022-06-01 09:21:47 | [garage_sac] Logging to /home/bara/PycharmProjects/garage/data/local/experiment/garage_sac_2
/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/tensorflow_probability/python/__init__.py:57: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if (distutils.version.LooseVersion(tf.__version__) <
/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/deterministic.py:36: UserWarning: Enabeling deterministic mode in PyTorch can have a performance impact when using GPU.
  warnings.warn(
Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Trainer is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type NormalizedEnv is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type GymEnv is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type PandaEnv is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type dict is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type module is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type dict is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 637, in _default_inner
    return json.JSONEncoder.default(self, o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type timedelta64 is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts/garage_sac.py", line 112, in <module>
    garage_sac(seed=521)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 369, in __call__
    result = self.function(ctxt, **kwargs)
  File "scripts/garage_sac.py", line 108, in garage_sac
    trainer.train(n_epochs=10000, batch_size=1024, plot=True)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/trainer.py", line 400, in train
    dump_json(summary_file, self)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 464, in dump_json
    json.dump(data,
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 643, in _default_inner
    data[k] = self.default(v)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in _default_inner
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 670, in <dictcomp>
    data = {k: self.default(v) for (k, v) in obj_dict.items()}
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 643, in _default_inner
    data[k] = self.default(v)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 611, in default
    return self._default_inner(o)
  File "/home/bara/anaconda3/envs/garage2020/lib/python3.8/site-packages/garage/experiment/experiment.py", line 657, in _default_inner
    return float(o)
TypeError: float() argument must be a string or a number, not 'NoneType'

Thanks in advance for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions