pypa / pipx

Install and Run Python Applications in Isolated Environments
https://pipx.pypa.io
MIT License
10.49k stars 414 forks source link

packaging.requirements.InvalidRequirement: .* suffix can only be used with `==` or `!=` operators #998

Closed TheTechromancer closed 1 year ago

TheTechromancer commented 1 year ago

Installing via pip works fine, but when I try to install via pipx, I get an error related to package versioning syntax.

Command:

pipx install git+https://github.com/blacklanternsecurity/MANSPIDER

Python version: 3.11 Pip version: 23.1.2 Pipx version: 1.2.0

Pipx output:

Traceback (most recent call last):
  File "/usr/bin/pipx", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/main.py", line 863, in cli
    return run_pipx_command(parsed_pipx_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/main.py", line 214, in run_pipx_command
    return commands.install(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/commands/install.py", line 60, in install
    venv.install_package(
  File "/usr/lib/python3.11/site-packages/pipx/venv.py", line 257, in install_package
    self._update_package_metadata(
  File "/usr/lib/python3.11/site-packages/pipx/venv.py", line 331, in _update_package_metadata
    venv_package_metadata = self.get_venv_metadata_for_package(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/venv.py", line 313, in get_venv_metadata_for_package
    venv_metadata = inspect_venv(
                    ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/venv_inspect.py", line 251, in inspect_venv
    app_paths_of_dependencies = _dfs_package_apps(
                                ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/venv_inspect.py", line 142, in _dfs_package_apps
    app_paths_of_dependencies = _dfs_package_apps(
                                ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/venv_inspect.py", line 121, in _dfs_package_apps
    dependencies = get_package_dependencies(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pipx/venv_inspect.py", line 54, in get_package_dependencies
    for req in map(Requirement, dist.requires or []):
  File "/usr/lib/python3.11/site-packages/packaging/requirements.py", line 37, in __init__
    raise InvalidRequirement(str(e)) from e
packaging.requirements.InvalidRequirement: .* suffix can only be used with `==` or `!=` operators
    extract-msg (<=0.29.*)
                 ~~~~~~~^

pyproject.toml:

name = "man-spider"
version = "1.0.4"
description = "Full-featured SMB spider capable of searching file content"
authors = ["TheTechromancer"]
license = "GPL-3.0"
repository = "https://github.com/blacklanternsecurity/MANSPIDER"
homepage = "https://github.com/blacklanternsecurity/MANSPIDER"

[tool.poetry.scripts]
manspider = 'man_spider.manspider:main'

[tool.poetry.dependencies]
python = "^3.6"
impacket = "^0.9.22"
textract = "^1.6.3"
python-magic = "^0.4.22"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
dukecat0 commented 1 year ago

See https://github.com/pypa/pipx/issues/948#issuecomment-1464936871

dukecat0 commented 1 year ago

If you still want to install it, you can downgrade packaging to 21.3 by pip install -U packaging==21.3

TahaMunir1 commented 4 months ago

Faced this issue even with packaging==21.3. Resolved it by downgrading to pip==23.2.1

AcidChristLab commented 3 months ago

Faced this issue even with packaging==21.3. Resolved it by downgrading to pip==23.2.1

Is the downgrading to old versions can be called a solution to the problem?

TahaMunir1 commented 3 months ago

Faced this issue even with packaging==21.3. Resolved it by downgrading to pip==23.2.1

Is the downgrading to old versions can be called a solution to the problem?

Not the ideal solution, but some libraries being used are still using the notation of <= with * which latest pip doesn't support. So, if you want to use those libraries, this is the only solution till those libraries update the requirements.

uranusjr commented 3 months ago

I think there’s a case to be made for packaging to be practical here and allows this as a special case. But there’s nothing we can do here in pipx. Feel free to open an issue in packaging and link it to this issue.