BlueBrain / MOOC-neurons-and-synapses-2017

Reference data for the "Simulation Neuroscience:Neurons and Synapses" Massive Online Open Course
Other
43 stars 26 forks source link

Nexus tutorial failing #88

Closed adrien-berchet closed 3 years ago

adrien-berchet commented 3 years ago

Hello,

In the Nexus tutorial, when I try to run the one_cell_minds notebook, I get an error when I execute the following cell:

forge = KnowledgeGraphForge("https://raw.githubusercontent.com/BlueBrain/nexus/ef830192d4e7bb95f9351c4bdab7b0114c27e2f0/docs/src/main/paradox/docs/getting-started/notebooks/forge.yml",
                            bucket=f"{ORG}/{PROJECT}",
                            endpoint="https://sandbox.bluebrainnexus.io/v1",
                            token=TOKEN)

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_17777/1142190872.py in <module>
      2                             bucket=f"{ORG}/{PROJECT}",
      3                             endpoint="https://sandbox.bluebrainnexus.io/v1",
----> 4                             token=TOKEN)

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/core/forge.py in __init__(self, configuration, **kwargs)
    183         store_name = store_config.pop("name")
    184         store = import_class(store_name, "stores")
--> 185         self._store: Store = store(**store_config)
    186         store_config.update(name=store_name)
    187 

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/specializations/stores/bluebrain_nexus.py in __init__(self, endpoint, bucket, token, versioned_id_template, file_resource_mapping, model_context, searchendpoints, **store_config)
     87                  model_context: Optional[Context] = None, searchendpoints:Optional[Dict] = None, **store_config) -> None:
     88         super().__init__(endpoint, bucket, token, versioned_id_template, file_resource_mapping,
---> 89                          model_context, searchendpoints, **store_config)
     90 
     91     @property

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/core/archetypes/store.py in __init__(self, endpoint, bucket, token, versioned_id_template, file_resource_mapping, model_context, searchendpoints, **store_config)
     62         self.file_mapping: Optional[Any] = loaded
     63         self.model_context: Optional[Context] = model_context
---> 64         self.service: Any = self._initialize_service(self.endpoint, self.bucket, self.token, searchendpoints, **store_config)
     65         self.context: Context = self.service.context if hasattr(self.service, "context") else None
     66         self.metadata_context: Context = self.service.metadata_context if hasattr(self.service, "metadata_context") else None

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/specializations/stores/bluebrain_nexus.py in _initialize_service(self, endpoint, bucket, token, searchendpoints, **store_config)
    510                            store_context=nexus_context_iri, namespace=namespace, project_property = project_property,
    511                            deprecated_property=deprecated_property, content_type=content_type, accept=accept,
--> 512                            files_upload_config=files_upload_config, files_download_config=files_download_config)
    513 
    514 

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/specializations/stores/nexus/service.py in __init__(self, endpoint, org, prj, token, model_context, max_connection, searchendpoints, store_context, namespace, project_property, deprecated_property, content_type, accept, files_upload_config, files_download_config)
    117             self.headers_upload["Authorization"] = "Bearer " + token
    118             self.headers_download["Authorization"] = "Bearer " + token
--> 119         self.context = Context(self.get_project_context())
    120 
    121         self.url_base_files = "/".join((self.endpoint, "files"))

~/miniconda3/envs/kgforge/lib/python3.7/site-packages/kgforge/specializations/stores/nexus/service.py in get_project_context(self)
    146         project_data = nexus.projects.fetch(self.organisation, self.project)
    147         context = {
--> 148             "@base": project_data["base"],
    149             "@vocab": project_data["vocab"]
    150         }

KeyError: 'base'

I think I followed the tutorial properly. Any clue?

Thanks!

MFSY commented 3 years ago

Hi @adrien-berchet ,

Can you tell me the value of bucket, i.e f"{ORG}/{PROJECT}" ?

For info:

Set ORG to be "github-users" => ORG = "github-users" Set PROJECT to be the automatically created project name (this name is your github account user name) when you logged into the Nexus sandbox instance.

You can look at your created project in => https://sandbox.bluebrainnexus.io/web/admin/github-users

adrien-berchet commented 3 years ago

Hello @MFSY Indeed I did not see I had to set the PROJECT value, sorry about this... Thanks for your help!

MFSY commented 3 years ago

Thanks @adrien-berchet .