-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
When creating a virtual environment, upgrade pip in webui.bat/webui.sh #15750
When creating a virtual environment, upgrade pip in webui.bat/webui.sh #15750
Conversation
Pip will be upgraded upon immediately creating the virtual environment. If the pip upgrade fails, this should not cause the script to fail (treat as a warning). After the environment is created, it will not attempt further updates to pip.
As I see you're updating pip before venv activate, so - globally. It's a bad as I see. Not only changing pip version globally is bad, also some systems have protected the global environment, like mine (requires big additional command line flag), and it will break the script |
You are making an extension - you can add this upgrade in it's install.py file or left in installation instruction |
@light-and-ray , thank you for taking the time to review the code. I greatly appreciate it. It is true that the code happens before the activate section. I did this purposefully. The python executable that the pip command is executing under is the executable file located in the virtual environment Scripts folder. When you run python this way, the context is the virtual environment. This is guaranteed never to run pip globally, because the global python will not be in this folder. I thought this was the safest way to make sure the upgrade does not happen globally. Thank you for noticing that I am developing stable diffusion extensions. The Automatic1111 extensions work very well. I still need to do some work on the ComfyUI custom nodes, then I will release them together. Personally, I prefer Automatic1111, and my extensions work better in that environment, but I thought it would be best to release them together. I like your kitten icon. |
Maybe I misunderstood you. What do you mean python's executable is located locally? It only exists on windows and only in the portable binary release. If you install webui using git clone, then ./webui.sh/bat, there is used global python executable and global environment until activate command |
@light-and-ray, the virtual environment is created and available for use after the python -m venv command. Activate.bat is simply a shorthand that allows you to run multiple commands in the context of the virtual environment. To run a single command in the virtual environment, you can call python.exe in the Scripts folder directly. In linux, it is the "bin" folder, but same concept. This is described on https://realpython.com/python-virtual-environments-a-primer/ @Rem TESTPIP.BAT @echo LOCAL: USING VENV\SCRIPTS\PYTHON @echo LOCAL: USING ACTIVATE |
Understand |
The default version of PIP with Python 3.10 does not record installation metadata properly for requirements installed using an url (egg-style), resulting in invalid lines when PIP FREEZE is called. For example, the packages clip and cstr are problematic. This makes it difficult to recreate a stable diffusion virtual environment. Upgrading PIP during virtual environment creation remedies this problem. I have found this is corrected in v24 of PIP.
Pip will be upgraded upon immediately creating the virtual environment. If the pip upgrade fails, this should not cause the script to fail (treat as a warning). Once the environment is created, it will not attempt further updates to pip on subsequent executions.
Description
Screenshots/videos:
clip==1.0
cstr==0.1.0
clip @ https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip#sha256=b5842c25da441d6c581b53a5c60e0c2127ebafe0f746f8e15561a006c6c3be6a
cstr @ git+https://github.com/WASasquatch/cstr@0520c29a18a7a869a6e5983861d6f7a4c86f8e9b
Checklist:
Note: tested on Windows and Darwin Linux (Mac)