Skip to content

Error when importing FileStorageObserver #884

Open
@k47h4

Description

I tried to re-run some code with the newest version of sacred that used to work with a sacred version from late 2019 and now get the following error. The problem already seems to occur when trying to import the FileStorageObserver. What would be the best fix for this issue?

I am using python version 3.6 on macOS Mojave 10.14.6.

Traceback (most recent call last):
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/importlib_metadata-4.12.0-py3.6.egg/importlib_metadata/_compat.py", line 9, in
from typing import Protocol
ImportError: cannot import name 'Protocol'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_code.py", line 5, in
from sacred.observers import FileStorageObserver
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/sacred/init.py", line 11, in
from sacred.experiment import Experiment
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/sacred/experiment.py", line 12, in
from sacred.arg_parser import format_usage, get_config_updates
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/sacred/arg_parser.py", line 14, in
from sacred.serializer import restore
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/sacred/serializer.py", line 1, in
import jsonpickle
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/jsonpickle-2.2.0-py3.6.egg/jsonpickle/init.py", line 81, in
from .version import version # noqa: F401
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/jsonpickle-2.2.0-py3.6.egg/jsonpickle/version.py", line 5, in
import importlib_metadata as metadata
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/importlib_metadata-4.12.0-py3.6.egg/importlib_metadata/init.py", line 17, in
from . import _adapters, _meta
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/importlib_metadata-4.12.0-py3.6.egg/importlib_metadata/_meta.py", line 1, in
from ._compat import Protocol
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/importlib_metadata-4.12.0-py3.6.egg/importlib_metadata/_compat.py", line 12, in
from typing_extensions import Protocol # type: ignore
File "/Users/k47h4/anaconda3/envs/topdown_plasticity/lib/python3.6/site-packages/typing_extensions-4.3.0-py3.6.egg/typing_extensions.py", line 160, in
class _FinalForm(typing._SpecialForm, _root=True):
AttributeError: module 'typing' has no attribute '_SpecialForm'

The entire code can be found in this repository: https://github.com/k47h4/interneuron_circuits_plasticity
Here is a code snippet from run_code.py:

from sacred.observers import FileStorageObserver

def run_in_thread(values):
    from Spiking_model import ex
    ex.observers.append(FileStorageObserver.create('Spiking_model'))
    ex.run('run_network')

values1 = np.array([0])
n_threads = len(values1)   
pool = multiprocessing.Pool(n_threads)
pool.map(run_in_thread, values1)

Thank you!

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