Closed Yaruze66 closed 9 months ago
I assume you installed the packaging module to a different python instance, since if it's installed, the error should not occur. You can try finding the python executable that gets used by SD-WebUI and directly install it into that instance.
Usually the python instance that gets used by SD-WebUI is next to the webui
folder.
You can then find the python executable in system/python/python.exe
, if you open a cmd window in this python directory, you should be able to run python -m pip install packaging
You can also manually check if the packaging module exists, it should be in system\python\Lib\site-packages\packaging
Let me know if that helps! :)
I'm using the regular Stable Diffusion WebUI from AUTOMATIC1111with Python 3.10.6 separately installed, I don't have any "system" or "webui" folders.
I have a packaging module in stable-diffusion-webui\venv\Lib\site-packages (Requirement already satisfied: packaging in d:\stable-diffusion-webui\venv\lib\site-packages (23.2)).
I also tried installing this module in %localappdata%\Programs\Python\Python310\Lib\site-packages but it also didn't help.
I see, I don't see exactly know how it could fail to find the packaging module, I use the built in launch_utils of SD-WebUI to check it's existence.
If you'd like you can verify which exact python executable your SD-WebUI uses by doing the following.
In the directory that webui-user.bat
is in, you can find the modules
folder, inside here you have a file called launch_utils.py
Open the file, and find the line with:
python = sys.executable
Below this, you can add a new line and write something like:
print(f"Python location: {python}")
This will then print the python location when you start SD-WebUI.
Python location: D:\stable-diffusion-webui\venv\Scripts\python.exe
If I delete the folders "packaging" and "packaging-23.2.dist-info" in D:\stable-diffusion-webui\venv\Lib\site-packages then I get the following log:
venv "D:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python location: D:\stable-diffusion-webui\venv\Scripts\python.exe
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.6.0-2-g4afaaf8a
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
Traceback (most recent call last):
File "D:\stable-diffusion-webui\launch.py", line 48, in <module>
main()
File "D:\stable-diffusion-webui\launch.py", line 39, in main
prepare_environment()
File "D:\stable-diffusion-webui\modules\launch_utils.py", line 396, in prepare_environment
if not requirements_met(requirements_file):
File "D:\stable-diffusion-webui\modules\launch_utils.py", line 283, in requirements_met
import packaging.version
ModuleNotFoundError: No module named 'packaging'
Does this mean that the module is actually installed correctly, and in my case, for some reason, it is the extension cannot import it correctly?
I see now that the issue is caused by my extension after all, sorry for making you do all those checks 😅 You likely installed the packages module correctly so I made that error message quite confusing.
I simply made it print the Python module 'packaging' has not been imported correctly
message whenever any error occured, rather than when an actual import error occured.
I will post a hotfix in a bit that should hopefully resolve the issue!
I've posted a quick hotfix which should now only print the import error message when an actual import error occurs.
It also tries an alternative way of fetching the SD-WebUI version if the initial method failed, please let me know if the latest commit fixes your issue! :)
CivitAI Browser+: Aria2 RPC started
*** Error loading script: civitai_gui.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "D:\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_gui.py", line 34, in <module>
ver_bool = version.parse(ver[1:]) >= version.parse("1.7")
File "D:\stable-diffusion-webui\venv\lib\site-packages\packaging\version.py", line 54, in parse
return Version(version)
File "D:\stable-diffusion-webui\venv\lib\site-packages\packaging\version.py", line 200, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '1.6.0-2-g4afaaf8a'
https://github.com/BlafKing/sd-civitai-browser-plus/issues/154 <- I noticed that someone here also has a non-standard version of SD-WebUI and has the same problem with importing the module. Can the non-standard writing of the version ("v1.6.0-2-g4afaaf8a" instead of simple "v1.6.0") somehow affect?
Good catch! That was indeed causing an error, I've published another commit which should fix that issue as well!
Nice! Problem fixed! Thank you! 😉
Awesome! I'll go ahead and close this bug report! :)
Describe the bug.
When I launching SD-WebUI with this extension, I get the following this in the console: "CivitAI Browser+: Python module 'packaging' has not been imported correctly, please try to restart or install it manually."
None of the above helped.
Steps to reproduce the problem.
Expected behavior
Correct import of the Python "packaging" module.
System info
Console logs
Additional information
No response