Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ImportError: cannot import name 'packaging' from 'pkg_resources' #822

Open
2 of 6 tasks
shalim2904 opened this issue Jun 23, 2024 · 2 comments
Open
2 of 6 tasks

Comments

@shalim2904
Copy link

shalim2904 commented Jun 23, 2024

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

first run of webui

Steps to reproduce the problem

download from git
and run

What should have happened?

webui loaded

What browsers do you use to access the UI ?

Mozilla Firefox

Sysinfo

sysinfo-2024-05-12-04-25.json

Console logs

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: f0.0.17v1.8.0rc-latest-287-g77bdb920
Commit hash: 77bdb9208d019e562f9f629647356dca2b2d5ef1
D:\App\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\forge_legacy_preprocessors\install.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Installing forge_legacy_preprocessor requirement: changing opencv-python version from 4.10.0.84 to 4.8.0
D:\App\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\install.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Installing sd-forge-controlnet requirement: changing opencv-python version from 4.10.0.84 to 4.8.0
Launching Web UI with arguments: --directml --skip-torch-cuda-test --gradio-allowed-path D:\App\Data\Images
Using directml with device: 
Total VRAM 1024 MB, total RAM 28417 MB
Trying to enable lowvram mode because your GPU seems to have 4GB or less. If you don't want this use: --always-normal-vram
Set vram state to: LOW_VRAM
Device: privateuseone
VAE dtype: torch.float32
CUDA Stream Activated:  False
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --attention-split
Traceback (most recent call last):
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\launch.py", line 51, in <module>
    main()
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\launch.py", line 47, in main
    start()
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\launch_utils.py", line 541, in start
    import webui
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\webui.py", line 19, in <module>
    initialize.imports()
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\initialize.py", line 53, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\processing.py", line 18, in <module>
    import modules.sd_hijack
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\sd_hijack.py", line 5, in <module>
    from modules import devices, sd_hijack_optimizations, shared, script_callbacks, errors, sd_unet, patches
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\sd_hijack_optimizations.py", line 13, in <module>
    from modules.hypernetworks import hypernetwork
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\hypernetworks\hypernetwork.py", line 13, in <module>
    from modules import devices, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint, errors
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\sd_samplers.py", line 1, in <module>
    from modules import sd_samplers_kdiffusion, sd_samplers_timesteps, sd_samplers_lcm, shared
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\modules\sd_samplers_kdiffusion.py", line 3, in <module>
    import k_diffusion.sampling
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\repositories\k-diffusion\k_diffusion\__init__.py", line 1, in <module>
    from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\repositories\k-diffusion\k_diffusion\evaluation.py", line 6, in <module>
    import clip
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\clip\__init__.py", line 1, in <module>
    from .clip import *
  File "D:\App\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\clip\clip.py", line 6, in <module>
    from pkg_resources import packaging
ImportError: cannot import name 'packaging' from 'pkg_resources' (D:\App\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\pkg_resources\__init__.py)

Additional information

installed using stability matrix

@GeminiSquishGames
Copy link

GeminiSquishGames commented Jun 24, 2024

Pretty much the same situation with me, Using Stability Matrix to manage versions and apps, but with dev2 branch. Main seems to be fine...

The line 6 in clip.py can be changed to just "import packaging" since it won't find pkg_resources as a module.

This makes it run for me but I dunno if it's going to make anything else wonky yet, and am not sure Stability Matrix doesn't do something different when downloading requirements to make this happen.

Again, for me this is just with the dev2 branch.

Edit: I think this is a Matrix issue and would be fixed by Yesterday's update.

@TzarvanBla
Copy link

Just wanted to throw in, that I had the same error,

Accidentally upgraded to the new Main version, then it broke

Downgraded setuptool to 69.5.1, then it worked again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants