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

ImportError: cannot import name 'get_terminal_size' from 'click.termui' #106

Closed
PhreakHeaven opened this issue Dec 11, 2022 · 14 comments
Closed

Comments

@PhreakHeaven
Copy link

Describe the bug
Error running process: G:\StableDiffVoldy\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py Traceback (most recent call last): File "G:\StableDiffVoldy\stable-diffusion-webui\modules\scripts.py", line 338, in process script.process(p, *script_args) File "G:\StableDiffVoldy\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py", line 350, in process generator = self._create_generator( File "G:\StableDiffVoldy\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py", line 166, in _create_generator generator = AttentionGenerator(generator) File "G:\StableDiffVoldy\stable-diffusion-webui\extensions\sd-dynamic-prompts\prompts\generators\attentiongenerator.py", line 8, in __init__ import spacy File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\spacy\__init__.py", line 15, in <module> from .cli.info import info # noqa: F401 File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\spacy\cli\__init__.py", line 3, in <module> from ._util import app, setup_cli # noqa: F401 File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\spacy\cli\_util.py", line 9, in <module> import typer File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\typer\__init__.py", line 12, in <module> from click.termui import get_terminal_size as get_terminal_size ImportError: cannot import name 'get_terminal_size' from 'click.termui' (G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\click\termui.py)

To Reproduce
Steps to reproduce the behaviour, include the prompt you used if applicable:

  1. Try to use 'Dynamic Prompts'
  2. See that nothing is happening to the results
  3. See error in terminal

Tried all checkboxes individually.

Expected behaviour
No error and proper results.

Additional context
Obviously related to the Typer and Click packages, but can't figure out what to do. People have solved it in the past by downgrading the Click package (from info on other repos).

adieyal added a commit that referenced this issue Dec 11, 2022
@adieyal
Copy link
Owner

adieyal commented Dec 11, 2022

Could you please test this branch - https://github.com/adieyal/sd-dynamic-prompts/tree/bug/typer-dependency

@PhreakHeaven
Copy link
Author

@adieyal

I hope I can download the zip and extract the contents of the parent directory to the relevant directory in the extensions directory (moved previous files/dirs to a backup directory) and re-launch :-P I would assume that should work. About to test; thanks for quick response!

@PhreakHeaven
Copy link
Author

@adieyal

Same error...:(

@PhreakHeaven
Copy link
Author

@adieyal

I don't know much about GIT, but the hidden '.git' directory was the only item that was with the old files that is not in the directory after copying the bug fix and killing/launching.

@PhreakHeaven
Copy link
Author

@adieyal

I assume that has to do with the 'git pull' command though...which would explain why it's non-existent now.

@PhreakHeaven
Copy link
Author

@adieyal

Have:

click 8.1.3
typer 0.7.0

installed

@adieyal
Copy link
Owner

adieyal commented Dec 11, 2022

@adieyal

Have:

click 8.1.3 typer 0.7.0

installed

What command did you use to get the versions?

@adieyal
Copy link
Owner

adieyal commented Dec 11, 2022

I hope I can download the zip and extract the contents of the parent directory to the relevant directory in the extensions directory (moved previous files/dirs to a backup directory) and re-launch :-P I would assume that should work. About to test; thanks for quick response!

Yes, that should work, in fact only the install.py file changed so you can update that instead of updating the entire directory

@PhreakHeaven
Copy link
Author

PhreakHeaven commented Dec 11, 2022

@adieyal

What command did you use to get the versions?

Python is in my PATH, so I just did "pip list" in Windows Command Prompt. Maybe that's not the relevant info relative to the WebUI directory/VENV?

@PhreakHeaven
Copy link
Author

@PhreakHeaven
Copy link
Author

PhreakHeaven commented Dec 14, 2022

@adieyal

Still haven't figured anything out to solve this....all I've found is posts referencing an older update to Click and Typer, but nothing regarding the versions that are being used (on my machine, at least). I also forced Spacy to update, and it did, but still the same error :-(

As the [release notes of click 8.1.0] (https://click.palletsprojects.com/en/8.1.x/changes/#version-8-1-0) state, get_terminal_size is removed, use shutil.get_terminal_size instead.

The` issue was fixed in version 0.4.1 of typer, so upgrade the typer package by running the following command.

(from tiangolo/typer#375)

Well, I'm on Click v8.1.3 and Typer v0.7.0, so what the heck? Plus, 'Dynamic Prompts' WAS working previously (like a week ago) with Automatic1111's WebUI.

@adieyal
Copy link
Owner

adieyal commented Dec 15, 2022

that's strange - typer 0.7.0 should fix the issue. It could be the case that pip list does not use the same pip as auto1111.

I have made a small change to install.py. Try downloading it using this link and replacing your currently version. Let me know if that works.

@PhreakHeaven
Copy link
Author

PhreakHeaven commented Dec 16, 2022

@adieyal

Yesssss! Thank you so much for figuring that out for me...I spent most of last Saturday acting like I knew anything and just scrolled around in all of the files, looking for something that might stand out; no success, of course. That's why we count on experts :) I had just begun using this extension a couple weeks ago and shortly after that it just threw an error on every attempt; thanks again!

@adieyal
Copy link
Owner

adieyal commented Dec 16, 2022

That's awesome - sorry to hear that you struggled so much, glad it's working 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

2 participants