cantrell / stable-diffusion-api-server

A local API server on top of Stable Diffusion.
Apache License 2.0
357 stars 61 forks source link

Flask Error with Python3, Import Error with just Python #27

Open KarmaMole opened 1 year ago

KarmaMole commented 1 year ago

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.

aardvarkian commented 1 year ago

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.

bolli20000 commented 1 year ago

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 ?

kostianu4 commented 1 year ago

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%)

nextlevelbros commented 10 months ago

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.