core-bioimage-io-python
core-bioimage-io-python copied to clipboard
Loading model resource gives assertion error
The following code runs into an assertion error (extracted minimum example of a previously working implementation):
import bioimageio.core
rdf_doi = "10.5281/zenodo.7274275"
model_resource = bioimageio.core.load_resource_description(rdf_doi)
Output:
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json. Skipping download of https://raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json.
warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/bioimage-io.github.io/collection-bioimage-io/collection.json. Skipping download of https://bioimage-io.github.io/collection-bioimage-io/collection.json.
warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/bioimage-io.github.io/collection-bioimage-io/rdfs/10.5281/zenodo.7274275/8123818/rdf.yaml. Skipping download of https://bioimage-io.github.io/collection-bioimage-io/rdfs/10.5281/zenodo.7274275/8123818/rdf.yaml.
warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:439: CacheWarning: Reached cache warnings limit. No more warnings about cache hits will be issued.
warnings.warn(
Traceback (most recent call last):
File "/home/julian/.config/JetBrains/PyCharmCE2021.3/scratches/scratch.py", line 5, in <module>
model_resource = bioimageio.core.load_resource_description(rdf_doi)
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/io_.py", line 57, in load_resource_description
rd: ResourceDescription = resolve_raw_node(raw_rd=raw_rd, nodes_module=nodes)
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/utils.py", line 122, in resolve_raw_node
rd = SourceNodeTransformer().transform(rd)
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
return transformer(node, **kwargs) # noqa
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in generic_transformer
node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in <dictcomp>
node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
return transformer(node, **kwargs) # noqa
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 65, in transform_dict
return {key: self.transform(value, **kwargs) for key, value in node.items()}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 65, in <dictcomp>
return {key: self.transform(value, **kwargs) for key, value in node.items()}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
return transformer(node, **kwargs) # noqa
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in generic_transformer
node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in <dictcomp>
node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
return transformer(node, **kwargs) # noqa
File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/utils.py", line 84, in transform_ResolvedImportableSourceFile
assert importlib_spec is not None
AssertionError
I tried with bioimageio.core v0.5.8, then with the latest release v0.5.9 and also with a fresh conda environment installed with create -n tmp-env -c conda-forge bioimageio.core
I also tried with some other models yielding the same error.
Any help is appreciated
@jhennies thank you for reporting this issue. I'm able to reproduce it and hopefully have it fixed soon. I suspect it's related to the recent Zenodo API changes.
fixed by https://github.com/bioimage-io/spec-bioimage-io/pull/536