scalableminds / webknossos-libs

Python API and CLI tools for working with WEBKNOSSOS datasets, annotations and server interactions. Includes converter to OME-Zarr.
https://docs.webknossos.org/webknossos-py/index.html
22 stars 12 forks source link

Error downloading annotation, annotation.download.hybridToFile.failed #1205

Open erjel opened 3 days ago

erjel commented 3 days ago

How to reproduce:

conda create -n wk-test python=3.12
conda activate wk-test
pip install webknossoss
python
>>> import webknossos as wk
>>> wk.Annotation.download('<annotation URL>')

Error message:

If this is unexpected, please double-check your WEBKNOSSOS URL and credentials.
If the error persists, it might be caused by a version mismatch of the python client and the WEBKNOSSOS server API version.
See https://github.com/scalableminds/webknossos-libs/releases for current releases.
Got response status 400 with body: {"messages":[{"error":"Failed to download annotation"},{"chain":"[Server Time 2024-10-24 15:21]  <~ annotation.writeTemporaryFile.failed <~ annotation.download.hybridToFile.failed"}]}

webknossos version: 0.15.6 Server version: 30284 (using a institute instance)

What webknossos-libs version do I need?

fm3 commented 3 days ago

I’m afraid the warning message is misleading in this case. This does not look like an API version mismatch to me, more like a server-side error during packaging the annotation as zip. Can you download the same annotation via the web interface?

erjel commented 3 days ago

Hi @fm3 ,

I just tested it. No, I cannot download the annotation via Webinterface. I get an error message as well.

{
  "messages": [
    {
      "error": "Failed to download annotation"
    },
    {
      "chain": "[Server Time 2024-10-24 16:09]  \u003C~ annotation.writeTemporaryFile.failed \u003C~ annotation.download.hybridToFile.failed"
    }
  ]
}
erjel commented 3 days ago

It works however when I copy the annotation to my account. It is a read-only annotation ...

erjel commented 3 days ago

We changed the permissions for my account, now it works with the original annotation as well. From my side the issue is resolved.

It is still strange that I can see annotations without the specific permission rights, but I guess that is more a feature than a bug ...

fm3 commented 3 days ago

Thanks for the update! I still think something’s not quite right on the server side. It would help us figure out what happened here if you could provide some more details. What permission change did you do exactly? How did you open the annotation before? By link (might include a sharing token)? Or from the list in the dashboard?

erjel commented 2 days ago

Our workflow looks something like this:

  1. A new project is created
  2. Volume labeling task are created in regions of interest
  3. For each task a single instance is assigned for annotation
  4. Once the instance is done, I get the instance ID
  5. I download the annotation via its instance ID with the Python API as illustrated above

If I want to have a look at the annotation, I do not care about the annotation/ project/ task dashboard but rather access the annotation directly via the URL : https://webknossos.<domain>/annotations/<instance id>

Accessing the annotation via the URL worked fine. I was able to visually inspect the annotation instance, copy the task ID, and could even copy the instance to my account as exploratory annotation. From there (with a new annotation ID) I could download the data as I would have expected from the "original" annotation.

Apparently, I was not part of the "project team" (I could not even see the task ID of the original annotation when I searched for it in "Administration" -> "Tasks" dashboard). As far as I understand each project needs a "team".

Once I got permissions (on the level of a "Team Manager"), I could also download the original annotation without any problems.