stable-diffusion-webui-Layer-Divider icon indicating copy to clipboard operation
stable-diffusion-webui-Layer-Divider copied to clipboard

Pytoshop error

Open TijuanaKez opened this issue 2 years ago • 2 comments

Describe the bug Extension won't load due to Pytoshop error.

Installing Layer Divider Extension: Installing  pytoshop==1.1.0
Error loading script: layer_divider.py
Traceback (most recent call last):
  File "/Users/Me/stable-diffusion-webui/modules/scripts.py", line 263, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/Users/Me/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 "/Users/Me/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider.py", line 2, in <module>
    install_sam()
  File "/Users/Me/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider_modules/installation.py", line 19, in install_sam
    is_extension_there = any(filename.endswith(('.so', '.pyd')) for filename in os.listdir(pytoshop_path))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Me/stable-diffusion-webui/venv/Lib/site-packages/pytoshop'

Tried installing Pytoshop into the environment manually with pip but it says its already installed

Me@MeMacPro stable-diffusion-webui % source venv/bin/activate 
(venv) Me@MeMacPro stable-diffusion-webui % pip install pytoshop                              
Requirement already satisfied: pytoshop in ./venv/lib/python3.10/site-packages (1.1.0)
Requirement already satisfied: cython in ./venv/lib/python3.10/site-packages (from pytoshop) (0.29.35)
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from pytoshop) (1.23.5)

OS you are using: macOS Ventura

EDIT: Okay I see the problem from re-reading this post.

changed in install.py

pytoshop_path = os.path.join(sd_path, 'venv', ‘Lib', 'site-packages', 'pytoshop')

to

pytoshop_path = os.path.join(sd_path, 'venv', 'lib', 'python3.10', 'site-packages', 'pytoshop')

and it works.

TijuanaKez avatar Jun 03 '23 01:06 TijuanaKez

Ran into the same issue on Linux and wanted to verify that the above method works. To add further because I had to go back and adjust a second time:

The problem is that installation.py in the scripts/layer_divider_modules/ folder of the Layer-Divider extension is trying to pull from: /venv/Lib/site-packages/pytoshop Which looks like the following on line 6 of installation.py: pytoshop_path = os.path.join(sd_path, 'venv', ‘Lib', 'site-packages', 'pytoshop')

Your folder structure may vary so adjust as necessary but if you use default venv installation, you want it to point to: /venv/lib/python3.xx/site-packages/pytoshop Note that lib is lower-cased and that you should change python3.xx to whichever version is in /venv/lib/. In installation.py you should change the aforementioned line 6 to: pytoshop_path = os.path.join(sd_path, 'venv', 'lib', 'python3.11', 'site-packages', 'pytoshop')

Ominai avatar Jul 30 '23 04:07 Ominai

Hi @Ominai, @TijuanaKez. Thanks for pointing this out. I've fixed this in #18 to react on path in different OS. So this shouldn't happen anymore. If it happens again, please let me know.

jhj0517 avatar Jul 30 '23 12:07 jhj0517

Fixed requirements in #26. If anyone still face the error, please re-open.

jhj0517 avatar Jul 05 '24 07:07 jhj0517