Skip to content

Running scancode-toolkit on Windows throws an exception #85

Closed

Description

@rogu-beta

Update:

The issue is caused because commoncode does not properly set the supported range for its dependency on click, as can be seen here:

click >= 6.7, !=7.0

The package click has changed its ProgressBar implementation in commit pallets/click@fcd8503 which is part of the 8.2.0 release.

As such when installing commoncode, the most recent version of click is installed, which happens to be incompatible. The commoncode attempts to access is_hidden on EnhancedProgressBar which inherits from click's ProgressBar. As the attribute has been renamed from is_hidden to hidden this fails.


Running scancode-toolkit on Windows throws an exception when not using the --quiet option. This is particularly strange, because I am fairly certain that the same version of scancode-toolkit worked just a couple of days ago.

Using:

  • scancode-toolkit 32.3.3
  • commoncode 32.2.1
  • click 8.2.0
Setup plugins...
Collect file inventory...
Scan files for: info, licenses, copyrights, emails, urls with 4 process(es)...

Removing temporary files...done.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\01-data\10-git\test\venv\Scripts\scancode.exe\__main__.py", line 7, in <module>
    sys.exit(scancode())
             ~~~~~~~~^^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\commoncode\cliutils.py", line 73, in main
    return click.Command.main(
           ~~~~~~~~~~~~~~~~~~^
        self,
        ^^^^^
    ...<4 lines>...
        **extra,
        ^^^^^^^^
    )
    ^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1363, in main
    rv = self.invoke(ctx)
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 794, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 487, in scancode
    success, _results = run_scan(
                        ~~~~~~~~^
        input=input,
        ^^^^^^^^^^^^
    ...<20 lines>...
        **kwargs
        ^^^^^^^^
    )
    ^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 944, in run_scan
    scan_success = run_scanners(
        stage='scan',
    ...<8 lines>...
        echo_func=echo_func,
    )
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 1186, in run_scanners
    scan_success = scan_codebase(
        codebase, scanners, processes, timeout,
        with_timing=timing, progress_manager=progress_manager)
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 1285, in scan_codebase
    scans.__enter__()
    ~~~~~~~~~~~~~~~^^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\_termui_impl.py", line 118, in __enter__
    self.render_progress()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\commoncode\cliutils.py", line 199, in render_progress
    if not self.is_hidden:
           ^^^^^^^^^^^^^^
AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?

Activity

  1. rogu-beta commented on May 15, 2025

    @rogu-beta
    Author

    It seems requirements.txt indicates that click==8.1.3 should be used, which might explain the issue (https://github.com/aboutcode-org/commoncode/blob/v32.2.1/requirements.txt). However, that is not what is being installed with scancode-toolkit for some reason. The version of scancode-toolkit should require click==8.1.7 though (https://github.com/aboutcode-org/scancode-toolkit/blob/e0db4dd8725f756e776a2118be3f400217e5c34d/requirements.txt#L11)

  2. rogu-beta commented on May 15, 2025

    @rogu-beta
    Author

    It appears that this has changed in click in the following commit pallets/click@fcd8503

    This might not be a bug in commoncode after all, but there is some package that despite being pinned in version still pulls a more recent version of click than it should.

  3. rogu-beta commented on May 15, 2025

    @rogu-beta
    Author

    I can confirm that installing commoncode, results in click 8.2.0 being installed due to range defined in setup.cfg:

    click >= 6.7, !=7.0

    (venv) C:\Users\user\01-data\10-git\test>pip install commoncode==32.2.1
    Collecting commoncode==32.2.1
      Using cached commoncode-32.2.1-py3-none-any.whl.metadata (2.5 kB)
    Collecting attrs!=20.1.0,>=18.1 (from commoncode==32.2.1)
      Using cached attrs-25.3.0-py3-none-any.whl.metadata (10 kB)
    Collecting Beautifulsoup4>=4.13.0 (from Beautifulsoup4[chardet]>=4.13.0->commoncode==32.2.1)
      Using cached beautifulsoup4-4.13.4-py3-none-any.whl.metadata (3.8 kB)
    Collecting click!=7.0,>=6.7 (from commoncode==32.2.1)
      Using cached click-8.2.0-py3-none-any.whl.metadata (2.5 kB)
    Collecting requests>=2.7.0 (from requests[use_chardet_on_py3]>=2.7.0->commoncode==32.2.1)
      Using cached requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
    Collecting saneyaml>=0.5.2 (from commoncode==32.2.1)
      Using cached saneyaml-0.6.1-py3-none-any.whl.metadata (3.0 kB)
    Collecting text_unidecode>=1.0 (from commoncode==32.2.1)
      Using cached text_unidecode-1.3-py2.py3-none-any.whl.metadata (2.4 kB)
    Collecting soupsieve>1.2 (from Beautifulsoup4>=4.13.0->Beautifulsoup4[chardet]>=4.13.0->commoncode==32.2.1)
      Using cached soupsieve-2.7-py3-none-any.whl.metadata (4.6 kB)
    Collecting typing-extensions>=4.0.0 (from Beautifulsoup4>=4.13.0->Beautifulsoup4[chardet]>=4.13.0->commoncode==32.2.1)
      Using cached typing_extensions-4.13.2-py3-none-any.whl.metadata (3.0 kB)
    Collecting chardet (from Beautifulsoup4[chardet]>=4.13.0->commoncode==32.2.1)
      Using cached chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
    Collecting colorama (from click!=7.0,>=6.7->commoncode==32.2.1)
      Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
    Collecting charset-normalizer<4,>=2 (from requests>=2.7.0->requests[use_chardet_on_py3]>=2.7.0->commoncode==32.2.1)
      Using cached charset_normalizer-3.4.2-cp313-cp313-win_amd64.whl.metadata (36 kB)
    Collecting idna<4,>=2.5 (from requests>=2.7.0->requests[use_chardet_on_py3]>=2.7.0->commoncode==32.2.1)
      Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)
    Collecting urllib3<3,>=1.21.1 (from requests>=2.7.0->requests[use_chardet_on_py3]>=2.7.0->commoncode==32.2.1)
      Using cached urllib3-2.4.0-py3-none-any.whl.metadata (6.5 kB)
    Collecting certifi>=2017.4.17 (from requests>=2.7.0->requests[use_chardet_on_py3]>=2.7.0->commoncode==32.2.1)
      Using cached certifi-2025.4.26-py3-none-any.whl.metadata (2.5 kB)
    Collecting PyYAML (from saneyaml>=0.5.2->commoncode==32.2.1)
      Using cached PyYAML-6.0.2-cp313-cp313-win_amd64.whl.metadata (2.1 kB)
    Using cached commoncode-32.2.1-py3-none-any.whl (91 kB)
    Using cached attrs-25.3.0-py3-none-any.whl (63 kB)
    Using cached beautifulsoup4-4.13.4-py3-none-any.whl (187 kB)
    Using cached click-8.2.0-py3-none-any.whl (102 kB)
    Using cached requests-2.32.3-py3-none-any.whl (64 kB)
    Using cached saneyaml-0.6.1-py3-none-any.whl (13 kB)
    Using cached text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
    Using cached certifi-2025.4.26-py3-none-any.whl (159 kB)
    Using cached chardet-5.2.0-py3-none-any.whl (199 kB)
    Using cached charset_normalizer-3.4.2-cp313-cp313-win_amd64.whl (105 kB)
    Using cached idna-3.10-py3-none-any.whl (70 kB)
    Using cached soupsieve-2.7-py3-none-any.whl (36 kB)
    Using cached typing_extensions-4.13.2-py3-none-any.whl (45 kB)
    Using cached urllib3-2.4.0-py3-none-any.whl (128 kB)
    Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
    Using cached PyYAML-6.0.2-cp313-cp313-win_amd64.whl (156 kB)
    Installing collected packages: text_unidecode, urllib3, typing-extensions, soupsieve, PyYAML, idna, colorama, charset-normalizer, chardet, certifi, attrs, saneyaml, requests, click, Beautifulsoup4, commoncode
    Successfully installed Beautifulsoup4-4.13.4 PyYAML-6.0.2 attrs-25.3.0 certifi-2025.4.26 chardet-5.2.0 charset-normalizer-3.4.2 click-8.2.0 colorama-0.4.6 commoncode-32.2.1 idna-3.10 requests-2.32.3 saneyaml-0.6.1 soupsieve-2.7 text_unidecode-1.3 typing-extensions-4.13.2 urllib3-2.4.0
    
    (venv) C:\Users\user\01-data\10-git\test>pip freeze
    attrs==25.3.0
    beautifulsoup4==4.13.4
    certifi==2025.4.26
    chardet==5.2.0
    charset-normalizer==3.4.2
    click==8.2.0
    colorama==0.4.6
    commoncode==32.2.1
    idna==3.10
    PyYAML==6.0.2
    requests==2.32.3
    saneyaml==0.6.1
    soupsieve==2.7
    text-unidecode==1.3
    typing_extensions==4.13.2
    urllib3==2.4.0
    
    (venv) C:\Users\rogu\01-data\10-git\beta\dso\ci-cd\tools\dejacode-helper>
    
  4. AyanSinhaMahapatra commented on Jun 11, 2025

    @AyanSinhaMahapatra
    Member

    Thanks @ghsa-retrieval for the report, this should be fixed with aboutcode-org/scancode-toolkit#4427 (after it is merged and released) and the new https://github.com/aboutcode-org/commoncode/releases/tag/v32.3.0, and this is also tracked in aboutcode-org/scancode-toolkit#4369

    So closing this as this is fixed in commoncode and this is tracked in SCTK with a duplicate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions