diffusers
diffusers copied to clipboard
ImportError from 'diffusers'
ImportError: cannot import name 'StableDiffusionInpaintPipeline' from 'diffusers' (/usr/local/lib/python3.7/dist-packages/diffusers/init.py)
+1
Hi there!
I think that requires the main
branch. Can you try installing using the following instead?
pip install -U git+https://github.com/huggingface/diffusers
+1
I get the same error on huggingface Space, while trying to import 'StableDiffusionImg2ImgPipeline' instead of 'StableDiffusionPipeline'
![import_error_stableDiff](https://user-images.githubusercontent.com/7447007/187937808-380cb0c1-b166-4895-a057-bb1030c1dcab.png)
+1 Cant import any of these.
When I look in the init file, only the default pipe is available. So the others like img2img didn't make it in.
cc: @anton-l @patrickvonplaten
+1 Also having this issue with StableDiffusionImg2ImgPipeline and the inpainting equivalent
Hey everybody,
Could you please install diffusers as stated by @pcuenca to solve this problem:
pip install -U git+https://github.com/huggingface/diffusers
?
We will probably make a new diffusers version by the end of next week to include StableDiffusionImg2ImgPipeline
in main
For huggingface space, you need to import diffusers through github pip install, as i did in a requirements.txt file ;)
for example, If you are installing diffusers from a clone of CompVis/stable-diffusion
, you will get this error.
The file that exists on github is newer than the file that can be installed with pip, but it is the same version 0.2.4, so it cannot be upgraded using pip.
If you have installed the older version using pip, you will need to uninstall it once.
pip uninstall diffusers
then
pip install -U git+https://github.com/huggingface/diffusers
This is still not working for me. I followed the above comment to uninstall the old diffusers then install from git.
>>> from diffusers import StableDiffusionPipeline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alan/anaconda3/lib/python3.8/site-packages/diffusers/__init__.py", line 12, in <module>
from .configuration_utils import ConfigMixin
File "/home/alan/anaconda3/lib/python3.8/site-packages/diffusers/configuration_utils.py", line 26, in <module>
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
ImportError: cannot import name 'EntryNotFoundError' from 'huggingface_hub.utils' (/home/alan/anaconda3/lib/python3.8/site-packages/huggingface_hub/utils/__init__.py)
Hey @apcode,
Could you run diffusers-cli env
and show what versions you're using ? E.g. what Python version, what torch version, on what platform etc...
(base) alan@linux-beast:~/Workspace/diffusers -[] $ diffusers-cli env
Traceback (most recent call last):
File "/home/alan/anaconda3/bin/diffusers-cli", line 5, in <module>
from diffusers.commands.diffusers_cli import main
File "/home/alan/anaconda3/lib/python3.8/site-packages/diffusers/__init__.py", line 12, in <module>
from .configuration_utils import ConfigMixin
File "/home/alan/anaconda3/lib/python3.8/site-packages/diffusers/configuration_utils.py", line 26, in <module>
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
ImportError: cannot import name 'EntryNotFoundError' from 'huggingface_hub.utils' (/home/alan/anaconda3/lib/python3.8/site-packages/huggingface_hub/utils/__init__.py)
That's no good :-)
I am using anaconda and have run conda update conda
python 3.8.13
torch==1.12.1
transformers==4.10.2
uname -a Linux linux-beast 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
It is possible that you can upgrade transformers
? Maybe to 4.21
? :-)
upgraded to transformers==4.21.3 still happens.
Okey sorry, next try.
Could you update huggingface_hub
by running:
pip install --upgrade huggingface_hub
huggingface-hub==0.9.1
Still no joy. I appreciate the help btw
Hmm that's weird I'm pretty sure it should work with huggingface_hub==0.9.1
. Also tried reproducing it myself and I'm not able to.
Could you maybe try uninstalling huggingface_hub
both with:
pip uninstall huggingface_hub
and
conda remove huggingface_hub
and then re-installing it (just to make sure we don't have multiple version of huggingface-hub
used).
Also gently pinging @Wauplin and @LysandreJik here in case they've seen this hub error before
Hi there :wave: I can confirm that EntryNotFoundError
is new in huggingface_hub
so latest released version must be installed (v0.9.1). @apcode could you run the following snippet to be sure that the imported lib is indeed the one we think ?
import huggingface_hub
print(huggingface_hub.__version__)
(and I agree with @patrickvonplaten for a complete uninstall/reinstall, just in case. I don't what else could be wrong :grimacing: ).
Python 3.8.13 (default, Mar 28 2022, 11:38:47)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import huggingface_hub
>>> print(huggingface_hub.__version__)
0.2.1
That's quite a different version installed. So I tried:
$ conda search huggingface_hub
Loading channels: done
# Name Version Build Channel
huggingface_hub 0.0.17 pyhd3eb1b0_0 pkgs/main
huggingface_hub 0.2.1 pyhd3eb1b0_0 pkgs/main
Ahh, I don't think we have huggingface_hub
released on conda forge maybe? cc @LysandreJik here as well
Hmm, huggingface_hub
is released on conda-forge but there seem to be older versions on the main channel as well (see https://anaconda.org/search?q=huggingface_hub).
@LysandreJik is there a way to deprecate/yank/delete those old versions to avoid confusion ?
Ah indeed, it seems the main + anaconda channels have not upgraded. Let me take a look.
It's unlikely that we'll get these versions to upgrade as the anaconda main channel tries to have all their supported packages be compatible with one another; so spending time to get them to upgrade is likely a waste of time given that we would need to do so every time there is an update in one of our libraries.
I'd favor educating users to use conda-forge
as is done currently in the README where you currently mention conda install -c conda-forge diffusers
.
@apcode, could you please try with
conda install -c conda-forge huggingface_hub
? It should uninstall your currently installed version and install the new one:
The following packages will be UPDATED:
ca-certificates pkgs/main::ca-certificates-2022.07.19~ --> conda-forge::ca-certificates-2022.9.14-ha878542_0
certifi pkgs/main/linux-64::certifi-2022.6.15~ --> conda-forge/noarch::certifi-2022.9.14-pyhd8ed1ab_0
huggingface_hub pkgs/main::huggingface_hub-0.2.1-pyhd~ --> conda-forge::huggingface_hub-0.9.1-pyhd8ed1ab_0
Thank you!
Thanks for investigating @LysandreJik ! Do you think we can completely remove it from the main channel or this is not something we don't have a hand on ?
That's not something we have a hand on: that's managed by the anaconda team. IIUC they handle package versions so that there will never be dependency issues and dependency conflicts. If they were to remove support for huggingface_hub
, then they'd likely have a myriad of dependency issues, so I'd say that it's very unlikely to happen.
Ok, too bad :'(
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.