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

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

Closed
SmokinCaterpillar opened this issue Jun 14, 2022 · 4 comments · Fixed by #5151
Closed

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

SmokinCaterpillar opened this issue Jun 14, 2022 · 4 comments · Fixed by #5151
Assignees
Labels
Type: Bug 🐛 This issue is a bug. Type: Vendored Dependencies This issue affects vendored dependencies within pipenv.

Comments

@SmokinCaterpillar
Copy link

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>
@SmokinCaterpillar
Copy link
Author

Okay, only starting it in parallel kinda triggered it, now the error persists and even happens when just running pipenv in a single tab every time. I did not change anything, but seriously the exact same setup worked yesterday.

@matteius
Copy link
Member

@SmokinCaterpillar It appears to have run into a new recently reported issue of requirementslib: sarugaku/requirementslib#317

@matteius matteius added Type: Vendored Dependencies This issue affects vendored dependencies within pipenv. Type: Bug 🐛 This issue is a bug. labels Jun 15, 2022
@matteius matteius self-assigned this Jun 15, 2022
@SmokinCaterpillar
Copy link
Author

ah, yes looks like it. Pinning hypothesis to an older version fixed it. Thanks can be closed as duplicate.

@matteius
Copy link
Member

@SmokinCaterpillar Its not a duplicate since the other ticket is in requirementslib. I am going to keep this open until we can bring the fix into pipenv.

@matteius matteius reopened this Jun 15, 2022
@matteius matteius changed the title pipenv install fails if run multiple times in parallel in different tabs on independent projects Cannot parse python beta version markers, eg: 3.11.0b1 Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 This issue is a bug. Type: Vendored Dependencies This issue affects vendored dependencies within pipenv.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants