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

cannot import name 'TypedDict' from 'typing' #3246

Open
dd-jy opened this issue Feb 13, 2023 · 4 comments
Open

cannot import name 'TypedDict' from 'typing' #3246

dd-jy opened this issue Feb 13, 2023 · 4 comments
Labels

Comments

@dd-jy
Copy link
Contributor

dd-jy commented Feb 13, 2023

Description

Please leave a brief description of the bug or feature request:
It occurs the error with python3.7.15 environment.

========================================================================
ERROR: UNABLE TO IMPORT SCANCODE PLUGINS.
Check your installation configuration (setup.py) or re-install/re-configure ScanCode.
The following plugin(s) are referenced and cannot be loaded/imported:
cannot import name 'TypedDict' from 'typing' (/home/worker/.pyenv/versions/3.7.15/lib/python3.7/typing.py)
========================================================================
Traceback (most recent call last):
  File "/home/worker/.pyenv/versions/3.7.15/bin/scancode", line 5, in <module>
    from scancode.cli import scancode
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/scancode/cli.py", line 126, in <module>
    raise e
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/scancode/cli.py", line 113, in <module>
    plugin_classes, plugin_options = PluginManager.load_plugins()
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/plugincode/__init__.py", line 196, in load_plugins
    mgr_setup = manager.setup()
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/plugincode/__init__.py", line 222, in setup
    raise e
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/plugincode/__init__.py", line 220, in setup
    self.manager.load_setuptools_entrypoints(entrypoint)
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 208, in load
    module = import_module(match.group('module'))
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/summarycode/plugin_consolidate.py", line 24, in <module>
    from summarycode import copyright_tallies
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/summarycode/copyright_tallies.py", line 14, in <module>
    import fingerprints
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/__init__.py", line 1, in <module>
    from fingerprints.fingerprint import fingerprint
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/fingerprint.py", line 6, in <module>
    from fingerprints.types import replace_types
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/types/__init__.py", line 5, in <module>
    from fingerprints.types.replacer import get_replacer, NormFunc
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/types/replacer.py", line 6, in <module>
    from fingerprints.types.data import TYPES
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/types/data.py", line 2, in <module>
    from fingerprints.types.common import TypesList
  File "/home/worker/.pyenv/versions/3.7.15/lib/python3.7/site-packages/fingerprints/types/common.py", line 2, in <module>
    from typing import TypedDict, List
ImportError: cannot import name 'TypedDict' from 'typing' (/home/worker/.pyenv/versions/3.7.15/lib/python3.7/typing.py)

How To Reproduce

Tell us how to reproduce the issue.

  1. Create a python 3.7.15 environment with pyenv or global python configuration.
  2. Install the scancode with the command 'pip install scancode-toolkit'.
  3. Run the scancode 'scancode -v'.
    image

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? (Windows/MacOS/Linux) Linux
  • What version of scancode-toolkit was used to generate the scan file? 31.2.4
  • What installation method was used to install/run scancode? (pip/source download/other) pip
@dd-jy dd-jy added the bug label Feb 13, 2023
@pombredanne
Copy link
Member

@dd-jy Thank you for the report! Do you mind to check if this still happens with the latest develop since we are about to release v32? This would be super helpful!
This would be with:

- Create a python 3.7.15 environment with pyenv or global python configuration.
- Get a fresh git clone of scancode
- create a virtualenv locally with `python -m venv .` and then `source bin/activate`
- Install scancode with the command 'pip install -e .'
- Run the scancode 'scancode -v'

@pombredanne
Copy link
Member

@dd-jy the issue comes from this other issue opensanctions/fingerprints#15

Short term you can run this workaround instead: pip install scancode-toolkit fingerprints==1.0.3

@dd-jy
Copy link
Contributor Author

dd-jy commented Feb 14, 2023

@pombredanne
I tested with the latest develop branch and it still happens.
But, the workaround works fine.

@dd-jy
Copy link
Contributor Author

dd-jy commented Feb 20, 2023

@pombredanne when will it be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants