InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Docker container won't launch "TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'"

Open cdgriffith opened this issue 2 years ago • 11 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

No response

What version did you experience this issue on?

main-cuda e53e970544c2bb92c081475ce1f170946256c06fc3466095fe5599465711942c

What happened?

Trying to launch invoke AI through TrueNAS Scale.

Looks like the container is using python 3.9, but should be 3.10 for that syntax

2023-06-05T03:13:03.289331921Z Traceback (most recent call last):
2023-06-05T03:13:03.289363150Z   File "/usr/src/InvokeAI/bin/invokeai", line 5, in <module>
2023-06-05T03:13:03.289371105Z     from invokeai.app.cli_app import invoke_cli
2023-06-05T03:13:03.289375303Z   File "/usr/src/InvokeAI/lib/python3.9/site-packages/invokeai/app/cli_app.py", line 17, in <module>
2023-06-05T03:13:03.289398726Z     from invokeai.app.services.images import ImageService
2023-06-05T03:13:03.289415728Z   File "/usr/src/InvokeAI/lib/python3.9/site-packages/invokeai/app/services/images.py", line 26, in <module>
2023-06-05T03:13:03.289439032Z     from invokeai.app.services.image_file_storage import (
2023-06-05T03:13:03.289444352Z   File "/usr/src/InvokeAI/lib/python3.9/site-packages/invokeai/app/services/image_file_storage.py", line 79, in <module>
2023-06-05T03:13:03.289473717Z     class DiskImageFileStorage(ImageFileStorageBase):
2023-06-05T03:13:03.289480039Z   File "/usr/src/InvokeAI/lib/python3.9/site-packages/invokeai/app/services/image_file_storage.py", line 192, in DiskImageFileStorage
2023-06-05T03:13:03.289532017Z     def __get_cache(self, image_name: str) -> PILImageType | None:
2023-06-05T03:13:03.289540473Z TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Screenshots

Screenshot 2023-06-04 221405 Screenshot 2023-06-04 221440

Additional context

No response

Contact Details

No response

cdgriffith avatar Jun 05 '23 03:06 cdgriffith

This commit: https://github.com/invoke-ai/InvokeAI/commit/5bf9891553eb423c0d39539bc66c2ad551f37323 appears to have introduced code that is not compatible with Python 3.9 (It uses the | symbol which was introduced in 3.10)

The default dockerfile is still using python 3.9, so it fails with the above type error on startup.

I also just hit this problem. Will try a couple things and see where I get.

tinklern avatar Jun 07 '23 17:06 tinklern

So changing the python version in the dockerfile from 3.9 to 3.10, then running build.sh and using the container hash provided in the output works fine on the git tag v2.3.5post2. The --web command-line argument is missing when doing this on master though :(

ElRoberto538 avatar Jun 13 '23 06:06 ElRoberto538

I haven't seen a new build for weeks fwiw.

fat-tire avatar Jun 14 '23 06:06 fat-tire

Sorry about the troubles with the docker image - that's all broken right now. It will not work with main in its current state. We're working hard on fixing all of that very soon! @fat-tire: perhaps once that's done, it will be easier for you to re-contribute your Podman PR, if you're still interested?

For the time being, I would highly recommend using an older 2.3.5post2 image. It won't have all the latest and greatest, but it will at least work.

ebr avatar Jun 16 '23 03:06 ebr

Thank you for everyone who looked into this and the information!

I did end up pulling and building 2.3.5post2 locally (with a python 3.10 upgrade for good measure), so do have it working!

I think it would be handy if the images on docker hub could be version tagged, rather than just Sha https://hub.docker.com/r/invokeai/invokeai

That was if someone runs into similar issues in the future they can easily select an older working version, and not get lost in all the development ones

cdgriffith avatar Jun 16 '23 05:06 cdgriffith

Sure @ebr I can re-look at the podman pr, though I think we kind of resolved to just have the builds made with the docker script, since they're compatible and some of the newer features for Dockerfiles hadn't made it yet to podman. (Podman does need some special attention for the run script, but I can see if any new modifications are needed.)

fat-tire avatar Jun 16 '23 06:06 fat-tire

I'll be retiring the run/build scripts in favour of docker-compose, so perhaps adding podman-compose alongside it would be most straightforward. I'll tag you in the PR to get your thoughts, once it's ready (soon™)

ebr avatar Jun 16 '23 15:06 ebr

Cool. Also if you take a look at the last few comments on my PR, i kind of threw in all the stuff that differentiates a podman-run vs a docker-run (since the consensus was to leave the build.sh alone and just let docker do it...) It's not difficult to autodetect the container engine as we do here and just have one script "to rule them all". Might be easier to maintain :shrug:

fat-tire avatar Jun 17 '23 00:06 fat-tire

Do you have any recommended Docker tags? I have tried up to the release date of 2.3.5post1 but I had no luck. A bit annoying since it has to download ~3GB of data each time 😅.

lsalazarm99 avatar Jun 18 '23 07:06 lsalazarm99

Do you have any recommended Docker tags? I have tried up to the release date of 2.3.5post1 but I had no luck. A bit annoying since it has to download ~3GB of data each time sweat_smile.

invokeai/invokeai:sha-84b801d-cuda works.

ElRoberto538 avatar Jun 18 '23 07:06 ElRoberto538

Thanks @ElRoberto538!

I also came to say that I tried one more time and found that sha-1d9c115-cuda (14 hours newer than the other one) works too.

lsalazarm99 avatar Jun 18 '23 07:06 lsalazarm99

Just tested this and it's still broken? Is Docker not going to be supported anymore?

ElRoberto538 avatar Jul 03 '23 23:07 ElRoberto538

There’s a new docker file being released alongside 3.0.

hipsterusername avatar Jul 04 '23 02:07 hipsterusername

There’s a new docker file being released alongside 3.0.

Is there an issue/task for that? Is it something I can help with?

ElRoberto538 avatar Jul 04 '23 04:07 ElRoberto538

Currently in #3587 i believe - Feel free to take a look and comment!

hipsterusername avatar Jul 04 '23 11:07 hipsterusername

@ebr

hipsterusername avatar Jul 04 '23 14:07 hipsterusername