Skip to content

Cannot parse python beta version markers, eg: 3.11.0b1 #5132

@SmokinCaterpillar

Description

@SmokinCaterpillar

Issue description

pipenv install fails if run in parallel in multiple projects in multiple tabs. It returns the following error:

Traceback (most recent call last):
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 856, in <module>
    main()
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 842, in main
    _main(
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 822, in _main
    resolve_packages(
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 783, in resolve_packages
    results = clean_results(results, resolver, project, dev)
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 652, in clean_results
    entry_dict = translate_markers(entry.get_cleaned_dict(keep_outdated=False))
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 277, in get_cleaned_dict
    if self.original_markers and not self.markers:
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 634, in __getattribute__
    return super().__getattribute__(key)
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 239, in original_markers
    original_markers, lockfile_dict = self.get_markers_from_dict(self.lockfile_dict)
  File "/home/robert/anaconda3/lib/python3.7/site-packages/pipenv/resolver.py", line 212, in get_markers_from_dict
    markers.add(normalize_marker_str(entry_dict["markers"]))
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 692, in normalize_marker_str
    parts = cleanup_pyspecs(pyversion)
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 286, in cleanup_pyspecs
    for op_and_version_type, versions in _group_by_op(tuple(specs)):
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 200, in _group_by_op
    specs = [_get_specs(x) for x in list(specs)]
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 200, in <listcomp>
    specs = [_get_specs(x) for x in list(specs)]
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 193, in _get_specs
    result.append((spec.operator, _tuplize_version(spec.version)))
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 124, in _tuplize_version
    return tuple(int(x) for x in filter(lambda i: i != "*", version.split(".")))
  File "/home/robert/.local/share/virtualenvs/cube_norman-5aqotYjS/lib/python3.10/site-packages/pipenv/vendor/requirementslib/models/markers.py", line 124, in <genexpr>
    return tuple(int(x) for x in filter(lambda i: i != "*", version.split(".")))
ValueError: invalid literal for int() with base 10: '0b1'

Expected result

All pipenv install should execute without any interference between each other because these are completely independent projects.

Steps to replicate

run pipenv install in multiple linux tabs and multiple (independent) Python projects in parallel. The more projects the more likely it will fail (I guess this is a caching issue so this cannot be replicated deterministically).

The only way to mitigate this is to run pipenv --clear and pipenv install sequentially.


$ pipenv --support

Pipenv version: '2022.6.7'

Pipenv location: '/home/robert/anaconda3/lib/python3.7/site-packages/pipenv'

Python location: '/home/robert/anaconda3/bin/python'

Python installations found:

  • 3.8.10: /usr/bin/python3
  • 3.8.10: /usr/bin/python3.8
  • 3.7.13: /home/robert/anaconda3/bin/python3
  • 3.7.13: /home/robert/anaconda3/bin/python3.7
  • 3.7.13: /home/robert/anaconda3/bin/python
  • 3.7.13: /home/robert/anaconda3/bin/python3.7m
  • 2.7.18: /usr/bin/python2.7
  • 2.7.18: /usr/bin/python2
  • 2.7.18: /usr/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.13',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.4.0-113-generic',
 'platform_system': 'Linux',
 'platform_version': '#127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022',
 'python_full_version': '3.7.13',
 'python_version': '3.7',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SESSION_MANAGER
  • QT_ACCESSIBILITY
  • COLORTERM
  • XDG_CONFIG_DIRS
  • SSH_AGENT_LAUNCHER
  • XDG_MENU_PREFIX
  • GNOME_DESKTOP_SESSION_ID
  • LC_ADDRESS
  • GNOME_SHELL_SESSION_MODE
  • LC_NAME
  • SSH_AUTH_SOCK
  • XMODIFIERS
  • DESKTOP_SESSION
  • LC_MONETARY
  • GTK_MODULES
  • PWD
  • LOGNAME
  • XDG_SESSION_DESKTOP
  • XDG_SESSION_TYPE
  • XAUTHORITY
  • GJS_DEBUG_TOPICS
  • HOME
  • USERNAME
  • IM_CONFIG_PHASE
  • LC_PAPER
  • LANG
  • LS_COLORS
  • XDG_CURRENT_DESKTOP
  • VTE_VERSION
  • WAYLAND_DISPLAY
  • GNOME_TERMINAL_SCREEN
  • INVOCATION_ID
  • MANAGERPID
  • GJS_DEBUG_OUTPUT
  • GNOME_SETUP_DISPLAY
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • TERM
  • LC_IDENTIFICATION
  • LESSOPEN
  • USER
  • GNOME_TERMINAL_SERVICE
  • DISPLAY
  • SHLVL
  • LC_TELEPHONE
  • QT_IM_MODULE
  • LC_MEASUREMENT
  • PAPERSIZE
  • XDG_RUNTIME_DIR
  • LC_TIME
  • JOURNAL_STREAM
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • DBUS_SESSION_BUS_ADDRESS
  • LC_NUMERIC
  • OLDPWD
  • _
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: ~/bin:/home/robert/anaconda3/bin:/home/robert/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/robert/PythonWorkspace/CubeProject/cube_norman

Contents of Pipfile ('/home/robert/PythonWorkspace/CubeProject/cube_norman/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[[source]]
name = "Alcemy"
url = "https://__token__:${GITLAB_TOKEN_DONALD_READ}@gitlab.com/api/v4/projects/32572043/packages/pypi/simple"
verify_ssl = true

[packages]
flake8 = "==4.0.1"
black = "==22.3"
mypy = "==0.961"
isort = "==5.10.1"

pytest = "==7.1.2"
pytest-cov = "==3.0.0"
pytest-xdist = "==2.5.0"

simplejson = "==3.17.6"
fastapi = "==0.78.0"                                     # specifies pydantic as well
uvicorn = "==0.17.6"
pyjwt = "==2.4.0"
passlib = { version = "==1.7.4", extras = ["bcrypt"] }
boto3 = "==1.24.4"
requests = "==2.27"
sentry-sdk = "==1.5.12"
pytz = "==2022.1"
types-pytz = "2021.3"
python-dateutil = "==2.8.2"
types-python-dateutil = "==2.8.2"
cube-donald = { index = "Alcemy", version = "==0.14.0" }

[dev-packages]
pre-commit = "==2.19.0"
pyupgrade = "==2.34.0"

[scripts]
format = "bash -c 'black . && isort .'"
check = "bash -c 'flake8 . && mypy cube_norman'"

[requires]
python_version = "3.10"

[pipenv]
allow_prereleases = true
</details>

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions