Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when importing FileStorageObserver #884

Open
k47h4 opened this issue Aug 1, 2022 · 1 comment
Open

Error when importing FileStorageObserver #884

k47h4 opened this issue Aug 1, 2022 · 1 comment

Comments

@k47h4
Copy link

k47h4 commented Aug 1, 2022

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!

@thequilo
Copy link
Collaborator

Hmm, it works for me (on Python 3.9). Does the same error occur when you just import jsonpickle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants