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' #496

Open
thomasdn opened this issue Aug 16, 2023 · 3 comments
Open

ImportError: cannot import name 'get_terminal_size' from 'click' #496

thomasdn opened this issue Aug 16, 2023 · 3 comments

Comments

@thomasdn
Copy link
Contributor

When trying to run a cleanly cloned sigal, I get this error:

ImportError: cannot import name 'get_terminal_size' from 'click'

Below are the steps taken to get the error.

Am I missing some requirement? Or is Sigal using deprecated functionality of click? Or is Click really requiring a newer Python?
Sigal README says it is compatible with Python 3.5+

$ git clone https://github.com/saimn/sigal.git
Cloning into 'sigal'...
remote: Enumerating objects: 8221, done.
remote: Counting objects: 100% (1076/1076), done.
remote: Compressing objects: 100% (376/376), done.
remote: Total 8221 (delta 664), reused 1041 (delta 654), pack-reused 7145
Receiving objects: 100% (8221/8221), 7.52 MiB | 17.83 MiB/s, done.
Resolving deltas: 100% (4837/4837), done.
$ cd src/sigal
sh: 2: cd: can't cd to src/sigal
$ ls
2  adduser  age  backupviking  eisolzried  emmet-vim  FakeNameGenerator  gitcourse  Google-rank-tracker  htop  imapbackup  imapsync  ladybird  lazygal  Nim  nord-vim  piccolor  qdirstat  qmk_firmware  qmk_toolbox  ripgrep  sigal  spotifykeydumper
$ cd sigal/src/sigal
$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ venv/bin/pip3 install wheel
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/28/f5/6955d7b3a5d71ce6bac104f9cf98c1b0513ad656cdaca8ea7d579196f771/wheel-0.41.1-py3-none-any.whl (64kB)
    100% |████████████████████████████████| 71kB 5.0MB/s 
Installing collected packages: wheel
Successfully installed wheel-0.41.1
(venv) $ cat > requirements.txt
wheel
sigal
Pillow
jinja2
pilkit
click
markdown
(venv) $ venv/bin/pip3 install -Ur requirements.txt
Requirement already up-to-date: wheel in ./venv/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (0.41.1)
Collecting sigal (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/eb/e3/779021a2828cf55a43c33c57fb5b566a928e11635f31d18a738079329522/sigal-2.2-py3-none-any.whl (948kB)
    100% |████████████████████████████████| 952kB 1.2MB/s 
Collecting Pillow (from -r requirements.txt (line 3))
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/00/d5/4903f310765e0ff2b8e91ffe55031ac6af77d982f0156061e20a4d1a8b2d/Pillow-9.5.0.tar.gz (50.5MB)
    100% |████████████████████████████████| 50.5MB 25kB/s 
Collecting jinja2 (from -r requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/bc/c3/f068337a370801f372f2f8f6bad74a5c140f6fda3d9de154052708dd3c65/Jinja2-3.1.2-py3-none-any.whl
Collecting pilkit (from -r requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/c4/5c/318d9c20f309e6a79ea4d4605f86597d05f3e007d3d1925ff02474808659/pilkit-2.0.tar.gz (161kB)
    100% |████████████████████████████████| 163kB 6.5MB/s 
Collecting click (from -r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/1a/70/e63223f8116931d365993d4a6b7ef653a4d920b41d03de7c59499962821f/click-8.1.6-py3-none-any.whl (97kB)
    100% |████████████████████████████████| 102kB 9.4MB/s 
Collecting markdown (from -r requirements.txt (line 7))
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl (94kB)
    100% |████████████████████████████████| 102kB 10.3MB/s 
Collecting natsort (from sigal->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ef/82/7a9d0550484a62c6da82858ee9419f3dd1ccc9aa1c26a1e43da3ecd20b0d/natsort-8.4.0-py3-none-any.whl
Collecting blinker (from sigal->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/0d/f1/5f39e771cd730d347539bb74c6d496737b9d5f0a53bc9fdbf3e170f1ee48/blinker-1.6.2-py3-none-any.whl
Collecting MarkupSafe>=2.0 (from jinja2->-r requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/6d/7c/59a3248f411813f8ccba92a55feaac4bf360d29e2ff05ee7d8e1ef2d7dbf/MarkupSafe-2.1.3.tar.gz
Collecting importlib-metadata; python_version < "3.8" (from click->-r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/ff/94/64287b38c7de4c90683630338cf28f129decbba0a44f0c6db35a873c73c4/importlib_metadata-6.7.0-py3-none-any.whl
Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata; python_version < "3.8"->click->-r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->click->-r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/5b/fa/c9e82bbe1af6266adf08afb563905eb87cab83fde00a0a08963510621047/zipp-3.15.0-py3-none-any.whl
Building wheels for collected packages: Pillow, pilkit, MarkupSafe
  Running setup.py bdist_wheel for Pillow ... done
  Stored in directory: /home/tdn/.cache/pip/wheels/ca/4d/df/d168a9bc75cabf441026762d25f8a03a3cce26d81101a94590
  Running setup.py bdist_wheel for pilkit ... done
  Stored in directory: /home/tdn/.cache/pip/wheels/83/87/b9/db03ec06109a48529da8ba6315550ec177c6d749f50bd85932
  Running setup.py bdist_wheel for MarkupSafe ... done
  Stored in directory: /home/tdn/.cache/pip/wheels/30/d4/08/0a74420bc38e805ce1bce8103840bc255cb75f94d4328befa7
Successfully built Pillow pilkit MarkupSafe
Installing collected packages: typing-extensions, zipp, importlib-metadata, markdown, natsort, click, Pillow, blinker, pilkit, MarkupSafe, jinja2, sigal
Successfully installed MarkupSafe-2.1.3 Pillow-9.5.0 blinker-1.6.2 click-8.1.6 importlib-metadata-6.7.0 jinja2-3.1.2 markdown-3.4.4 natsort-8.4.0 pilkit-2.0 sigal-2.2 typing-extensions-4.7.1 zipp-3.15.0
(venv) $ touch venv/bin/activate
(venv) $ sigal init
Traceback (most recent call last):
  File "/home/tdn/git/sigal/src/sigal/venv/bin/sigal", line 6, in <module>
    from sigal import main
  File "/home/tdn/git/sigal/src/sigal/venv/lib/python3.7/site-packages/sigal/__init__.py", line 33, in <module>
    from .gallery import Gallery
  File "/home/tdn/git/sigal/src/sigal/venv/lib/python3.7/site-packages/sigal/gallery.py", line 39, in <module>
    from click import get_terminal_size, progressbar
ImportError: cannot import name 'get_terminal_size' from 'click' (/home/tdn/git/sigal/src/sigal/venv/lib/python3.7/site-packages/click/__init__.py)
(venv) $ 
(venv) $ python -V
Python 3.7.3
(venv) $ uname -r
4.19.0-25-amd64
(venv) $ 

@saimn
Copy link
Owner

saimn commented Aug 19, 2023

Hmm this has been fixed a while ago : 29f69bc
And sigal currently requires Python 3.8 or later; so not sure which version you are installing/using ?

@thomasdn
Copy link
Contributor Author

Sigal README says:

Sigal is compatible with Python 3.5+.

So I guess this is outdated, huh?

As to Sigal version, I use: I just did a git clone, so I would guess I got the most recent version of the code as per 4 days ago?

@saimn
Copy link
Owner

saimn commented Aug 30, 2023

So I guess this is outdated, huh?

yeah indeed, I just pushed an update.

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