madpah / requirements-parser

A Pip requirements file parser.
https://requirements-parser.readthedocs.io
Apache License 2.0
125 stars 41 forks source link

Missing dependency: setuptools #104

Closed oh2fih closed 1 month ago

oh2fih commented 1 month ago

The requirement.py:24 has this import:

from pkg_resources import Requirement as Req

The pkg_resources is a part of pypa/setuptools, but setuptools is missing from the pyproject.toml.

This causes ModuleNotFoundError:

Traceback (most recent call last):
  File ""%LocalAppData%\Local\Programs\Python\Python312\Lib\site-packages\requirements\__init__.py", line 19, in <module>
    from .parser import parse
  File ""%LocalAppData%\Local\Programs\Python\Python312\Lib\site-packages\requirements\parser.py", line 23, in <module>
    from .requirement import Requirement
  File ""%LocalAppData%\Local\Programs\Python\Python312\Lib\site-packages\requirements\requirement.py", line 24, in <module>
    from pkg_resources import Requirement as Req
ModuleNotFoundError: No module named 'pkg_resources'

Using pip install setuptools fixes the error.

oh2fih commented 1 month ago

There is already a pull request https://github.com/madpah/requirements-parser/pull/80 from October 2022 that would solve this issue...

oh2fih commented 1 month ago

Closing this issue in favor to https://github.com/madpah/requirements-parser/issues/88.

The pkg_resources is deprecated and should be replaced with packaging.requirements.Requirement.