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

pip doesn't work (pyodbc version related error) #12979

Closed
1 task done
Yoonho-Na opened this issue Sep 27, 2024 · 1 comment · Fixed by #12953
Closed
1 task done

pip doesn't work (pyodbc version related error) #12979

Yoonho-Na opened this issue Sep 27, 2024 · 1 comment · Fixed by #12953
Labels
C: error messages Improving error messages type: bug A confirmed bug or unintended behavior

Comments

@Yoonho-Na
Copy link

Yoonho-Na commented Sep 27, 2024

Description

I want to install some libraries using pip
But I get warning from pyodbc.

WARNING: Error parsing dependencies of pyodbc: Invalid version: '4.0.0-unsupported'

I tried to reinstall pyodbc by
pip uninstall pyodbc and pip install pyodbc
but when I do pip uninstall pyodbc
it says WARNING: Skipping pyodbc as it is not installed.
but when I pip list it shows
pyodbc 4.0.0-unsupported

and then I tried to upgrade pyodbc this error occured

pip install pyodbc
Defaulting to user installation because normal site-packages is not writeable
ERROR: Exception:
Traceback (most recent call last):
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
    status = _inner_run()
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
    return self.run(options, args)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
    return func(self, options, args)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 379, in run
    requirement_set = resolver.resolve(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
    result = self._result = resolver.resolve(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 148, in _add_to_criteria
    matches = self._p.find_matches(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 232, in find_matches
    return self._factory.find_candidates(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 451, in find_candidates
    return self._iter_found_candidates(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 342, in _iter_found_candidates
    _get_installed_candidate(),
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 288, in _get_installed_candidate
    if not specifier.contains(installed_dist.version, prereleases=True):
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/metadata/pkg_resources.py", line 192, in version
    return parse_version(self._dist.version)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/packaging/version.py", line 56, in parse
    return Version(version)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: '4.0.0-unsupported'

I also tried upgrading pip and It doesn't work too.

pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /home/yh/.local/lib/python3.8/site-packages (24.2)
WARNING: Error parsing dependencies of pyodbc: Invalid version: '4.0.0-unsupported'

I also have tried putting -U options in pip too.
Since I can't install or uninstall the pyodbc and pip, I'm stuck..
How can I fix this?

Expected behavior

package correctly installed

pip version

24.2

Python version

3.8.8

OS

ubuntu

How to Reproduce

with pyodbc==4.0.0-unsupported

pip install pyodbc

Defaulting to user installation because normal site-packages is not writeable
ERROR: Exception:
Traceback (most recent call last):
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
    status = _inner_run()
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
    return self.run(options, args)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
    return func(self, options, args)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 379, in run
    requirement_set = resolver.resolve(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
    result = self._result = resolver.resolve(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 148, in _add_to_criteria
    matches = self._p.find_matches(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 232, in find_matches
    return self._factory.find_candidates(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 451, in find_candidates
    return self._iter_found_candidates(
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 342, in _iter_found_candidates
    _get_installed_candidate(),
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 288, in _get_installed_candidate
    if not specifier.contains(installed_dist.version, prereleases=True):
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_internal/metadata/pkg_resources.py", line 192, in version
    return parse_version(self._dist.version)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/packaging/version.py", line 56, in parse
    return Version(version)
  File "/home/yh/.local/lib/python3.8/site-packages/pip/_vendor/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: '4.0.0-unsupported'

pip install --upgrade pip

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /home/yh/.local/lib/python3.8/site-packages (24.2)
WARNING: Error parsing dependencies of pyodbc: Invalid version: '4.0.0-unsupported'

Output

No response

Code of Conduct

@Yoonho-Na Yoonho-Na added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Sep 27, 2024
@notatallshaw
Copy link
Member

notatallshaw commented Sep 27, 2024

Starting with pip 24.1, packages with invalid versions can not be processed by pip. To use newer versions of pip you must uninstall using 'pip<24.1', some other Python package tool, or manually delete it.

If you require this package you must stick to older versions of pip, e.g. pip install 'pip<24.1'.

This is very similiar to #12950, I will work on adding a nicer error message in #12953.

To read more about why arbitary strings can no longer be used as version numbers you can read this blog post: https://pradyunsg.me/blog/2024/05/13/pip-24-1-betas/

@notatallshaw notatallshaw added C: error messages Improving error messages and removed S: needs triage Issues/PRs that need to be triaged labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: error messages Improving error messages type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants