stable-diffusion-api-server icon indicating copy to clipboard operation
stable-diffusion-api-server copied to clipboard

Flask Error with Python3, Import Error with just Python

Open KarmaMole opened this issue 2 years ago • 4 comments

If I try to start the server with python3 server.py as instructed, I get:

Traceback (most recent call last): File "C:\Stable Diffusion Engines\stable-diffusion-api-server-main\server.py", line 5, in import flask ModuleNotFoundError: No module named 'flask'

I've also tried pip install flask, but it just says 'requirements fullfilled'.

And if I try to start it with just python server.py, I get: ImportError: cannot import name 'SAFE_WEIGHTS_NAME' from 'transformers.utils' (C:\Users\Omar.conda\envs\sd-api-server\lib\site-packages\transformers\utils_init_.py)

I've followed all the instructions exactly as specified.

KarmaMole avatar Mar 12 '23 01:03 KarmaMole

I had same issue. Couldn't get it to work until I ran the pip install from the python console in visual studio code. Some wrong path wrong environment mixup, but you'd think pip would put it in the right one. anyway try to figure out your environments.

aardvarkian avatar Apr 26 '23 03:04 aardvarkian

Update: I tried pip installs of flusk and transformers, but on sd-API Server start I' am getting the following import error:

ImportError: cannot import name 'SAFE_WEIGHTS_NAME' from 'transformers.utils' (C:\Users\sa\anaconda3\envs\sd-api-server\lib\site-packages\transformers\utils_init_.py)

-- Same flask ModuleNotFoundError.

is there already so solution how to fix in order to start the sd-API-server correctly ?

which concrete pip-install could help ?

bolli20000 avatar May 01 '23 11:05 bolli20000

for me helps: pip install flask pip install diffusors pip install transfomers

then python server.py works (from 2nd time, first time pytorch_model.bin only download 72%)

kostianu4 avatar Sep 16 '23 09:09 kostianu4

I'm having the same issue with ModuleNotFoundError: No module named 'flask' I tried everything mentioned here, no luck. I also spent an hour feeding ChatGPT error messages, but is has no clue what to do and started going in circles.

I am a Photoshop user trying to use a plugin, figuring out what has gone wrong here is above my skill level.

I think there is some problem with paths/environments, feels like there are somehow mutiple Python installations, each one with it's own 'extras' installed or something, in any case my Python is hella confused about Flask because I have installed it a million times but it still cannot find it when I try to run the server. When I want to uninstall it, it is right there though.

I give up on ever getting this to work.

nextlevelbros avatar Dec 24 '23 02:12 nextlevelbros