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

[BUG] missing dependency: setuptools #656

Closed
dotysan opened this issue Feb 25, 2024 · 3 comments · Fixed by #673
Closed

[BUG] missing dependency: setuptools #656

dotysan opened this issue Feb 25, 2024 · 3 comments · Fixed by #673
Assignees
Labels

Comments

@dotysan
Copy link

dotysan commented Feb 25, 2024

On Python 3.12, one cannot assume setuptools is available. python/cpython#95299

$ python3.12 -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install --upgrade pip
  ...
(.venv) $ pip list
Package Version
------- -------
pip     24.0
(.venv) $ pip install prospector
  ...
(.venv) $ prospector 
Traceback (most recent call last):
  File "/home/curtis/src/pre-commit/.venv/bin/prospector", line 5, in <module>
    from prospector.run import main
  File "/home/curtis/src/pre-commit/.venv/lib64/python3.12/site-packages/prospector/run.py", line 9, in <module>
    from prospector import blender, postfilter, tools
  File "/home/curtis/src/pre-commit/.venv/lib64/python3.12/site-packages/prospector/blender.py", line 9, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Workaround:

(.venv) $ pip install setuptools
  ...
(.venv) $ prospector 
Messages
========

foo.py
  Line: 1
    pylint: disallowed-name / Disallowed name "foo"



Check Information
=================
         Started: 2024-02-25 15:00:20.065460
        Finished: 2024-02-25 15:00:20.162956
      Time Taken: 0.10 seconds
       Formatter: grouped
        Profiles: default, no_doc_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings
      Strictness: None
  Libraries Used: 
       Tools Run: dodgy, mccabe, profile-validator, pycodestyle, pyflakes, pylint
  Messages Found: 1
@drice
Copy link

drice commented Mar 21, 2024

Easy workaround, add setuptools to additional_dependencies

  - repo: https://github.com/landscapeio/prospector
    rev: v1.10.3
    hooks:
      - id: prospector
        additional_dependencies: ["setuptools"]

@sbrunner
Copy link
Member

sbrunner commented Oct 5, 2024

Shouldn't we use import lib?
https://docs.python.org/3/library/importlib.html

@sbrunner sbrunner self-assigned this Oct 5, 2024
@carlio
Copy link
Contributor

carlio commented Oct 6, 2024

Yes that probably makes more sense now. pkg_resources is probably just a hangover from when prospector was written in python2

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

Successfully merging a pull request may close this issue.

5 participants