Skip to content

Can't run cellsparse in QuPath because of Pillow (or base64 or io) #6

@tpecot

Description

@tpecot

Hi,

I've been trying to install cellsparse tu run it within QuPath. I'm running a Windows PC and I use QuPath 0.4.3 (I also tested QuPath 0.4.4, got the same problem) and qupath-extension-cellsparse-0.2.0. I was able to install the SAM extension running on my GPU without any problem. I tried to install both the GPU version and the CPU version (I thought it might come from the python version, 3.10 for installing GPU version for Windows, 3.11 for CPU) but got the same problem, i.e. when I run cellsparse extension to train either with Cellpose, ELEPHANT or Stardist, I get the following error:
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\applications.py", line 276, in call
await super().call(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\errors.py", line 184, in call
raise exc
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\errors.py", line 162, in call
await self.app(scope, receive, _send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call
raise exc
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call
raise e
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 718, in call
await route.handle(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 144, in stardist
return run(
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 42, in run
img = normalize(decode_image(b64img), 0, 100, axis=(0, 1))
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 30, in decode_image
return np.array(Image.open(io.BytesIO(base64.b64decode(b64data))))
File "C:\Users\tpecot\Anaconda3\envs\cellsparse-api\lib\site-packages\PIL\Image.py", line 3305, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001B2AF9BEE30>

It seems that it comes from PIL or base64 or io, I tried to change Pillow package version, but got the same error. Any idea?

Thanks a lot!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions