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

Raised an ValueError: '.*' not allowed for '>=' constraints exception when installing pylint #130

Closed
1 task done
felixlu opened this issue Jul 17, 2020 · 1 comment · Fixed by #256
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@felixlu
Copy link

felixlu commented Jul 17, 2020

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

  1. pdm init
  2. pdm add -d pylint

Actual behavior

Raised an ValueError: '.*' not allowed for '>=' constraints exception, details:

$ pdm add -d pylint -v
/Users/MY_USERNAME/.local/pipx/shared/lib/python3.7/site-packages/setuptools/distutils_patch.py:26: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  "Distutils was imported before Setuptools. This usage is discouraged "
Adding packages to dev dependencies: pylint
⠙ Resolving dependencies  Adding requirement pylint
⠸ Resolving dependencies========Start resolving requirements========
  pylint
Traceback (most recent call last):
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/metadata.py", line 675, in __init__
    self._data = json.loads(data)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/MY_USERNAME/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/core.py", line 68, in __call__
    return self.main(*args, **kwargs)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/core.py", line 103, in main
    raise err.with_traceback(traceback)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/core.py", line 99, in main
    f(options.project, options)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/cli/commands/add.py", line 43, in handle
    packages=options.packages,
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/cli/actions.py", line 140, in do_add
    resolved = do_lock(project, strategy, tracked_names, reqs)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/cli/actions.py", line 59, in do_lock
    resolver, requirements, project.environment.python_requires
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/resolver/core.py", line 146, in resolve
    result = resolver.resolve(requirements)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/resolvelib/resolvers.py", line 427, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/resolvelib/resolvers.py", line 324, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/resolvelib/resolvers.py", line 224, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/resolvelib/resolvers.py", line 215, in _get_criteria_to_update
    for r in self._p.get_dependencies(candidate):
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/resolver/providers.py", line 72, in get_dependencies
    deps, requires_python, summary = self.repository.get_dependencies(candidate)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/repositories.py", line 63, in get_dependencies
    requirements, requires_python, summary = getter(candidate)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/repositories.py", line 29, in wrapper
    result = func(self, candidate)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/repositories.py", line 106, in _get_dependencies_from_metadata
    deps = candidate.get_dependencies_from_metadata()
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/candidates.py", line 188, in get_dependencies_from_metadata
    metadata = self.get_metadata()
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/candidates.py", line 155, in get_metadata
    self.metadata = self.wheel.metadata
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/util.py", line 446, in __get__
    value = self.func(obj)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/wheel.py", line 237, in metadata
    result = Metadata(fileobj=wf)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/metadata.py", line 685, in __init__
    scheme=scheme)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/metadata.py", line 259, in __init__
    self.read_file(fileobj)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/metadata.py", line 357, in read_file
    self.set(field, value)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/metadata.py", line 457, in set
    if not scheme.is_valid_constraint_list(value):
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/pdm/models/candidates.py", line 38, in is_valid_constraint_list
    return self.is_valid_matcher("dummy_name (%s)" % s)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/version.py", line 703, in is_valid_matcher
    self.matcher(s)
  File "/Users/MY_USERNAME/.local/pipx/venvs/pdm/lib/python3.7/site-packages/distlib/version.py", line 116, in __init__
    '%r constraints' % op)
ValueError: '.*' not allowed for '>=' constraints

Expected behavior

Install pylint successfully.

Environment Information

$ pdm info && pdm info --env
/Users/MY_USERNAME/.local/pipx/shared/lib/python3.7/site-packages/setuptools/distutils_patch.py:26: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  "Distutils was imported before Setuptools. This usage is discouraged "
PDM version:        0.8.6
Python Interpreter: /usr/bin/python3 (3.7.3)
Project Root:       /Users/MY_USERNAME/Devel/_demos/pdm_test
/Users/MY_USERNAME/.local/pipx/shared/lib/python3.7/site-packages/setuptools/distutils_patch.py:26: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  "Distutils was imported before Setuptools. This usage is discouraged "
{
  "implementation_name": "cpython",
  "implementation_version": "3.7.3",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "19.5.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64",
  "python_full_version": "3.7.3",
  "platform_python_implementaiton": "CPython",
  "python_version": "3.7",
  "sys_platform": "darwin"
}
@felixlu felixlu added the 🐛 bug Something isn't working label Jul 17, 2020
@frostming
Copy link
Collaborator

Pylint has python_requires=">=3.5.*", this looks more like a bug to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants