Skip to content

Current code for dependencies checking is causing infinite package reinstalls and other inconsistencies #13487

@illtellyoulater

Description

@illtellyoulater

What happened?

So many extensions (even popular ones like TemporalKit) are messing up python environments because the wrong way they are checking for dependencies at runtime.
Consider the example code in the wiki (https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy) for installing an extension, which gets executed at every launch:

import launch

if not launch.is_installed("aitextgen"):
    launch.run_pip("install aitextgen==0.6.0", "requirements for MagicPrompt")

This breaks for all libraries having a "-" in their name for example ffmpeg-python, scikit-image, etc... which are then installed even when they already are.

As of now the majority of extensions are just iterating over their requirements.txt file with this code... Imagine the inconsistencies this is causing...

Please just add a note to the wiki section about this !

Steps to reproduce the problem

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False
> launch_utils.is_installed("ffmpeg")
True

What should have happened?

Extension authors reading the wiki should have been reminded to not iterate over requirements.txt using the above code.

Sysinfo

n/a

What browsers do you use to access the UI ?

No response

Console logs

n/a

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-reportReport of a bug, yet to be confirmed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions