Skip to content

Unable to lock previously locked packages #5843

@edwinjosegeorge

Description

@edwinjosegeorge

I was tinkering around the latest pipenv version 2023.8.20 and had trouble moving from 2023.7.23. It seems this version is not backwards compatible.

Issue description

Unable to lock previously locked versions

Expected result

Lock to be completed as previous version

Actual result

Locking failed!

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 668, in <module>
    main()
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 654, in main
    _main(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 641, in _main
    resolve_packages(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 608, in resolve_packages
    results, resolver = resolve(
                        ^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 588, in resolve
    return resolve_deps(
           ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 841, in resolve_deps
    results, hashes, internal_resolver = actually_resolve_deps(
                                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 617, in actually_resolve_deps
    results = resolver.clean_results()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 552, in clean_results
    name, entry = format_requirement_for_lockfile(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/locking.py", line 63, in format_requirement_for_lockfile
    entry["ref"] = determine_vcs_revision_hash(req, vcs, pipfile_entry.get("ref"))
                                                         ^^^^^^^^^^^^^^^^^
AttributeError: 'String' object has no attribute 'get'

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/cli/command.py", line 209, in install
    do_install(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/routines/install.py", line 162, in do_install
    do_init(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/routines/install.py", line 638, in do_init
    do_lock(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/routines/lock.py", line 65, in do_lock
    venv_resolve_deps(
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 782, in venv_resolve_deps
    c = resolve(cmd, st, project=project)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 651, in resolve
    raise RuntimeError("Failed to lock Pipfile.lock!")
RuntimeError: Failed to lock Pipfile.lock!

Steps to replicate

I really doubt if this information could help to debug the issue! 🙊

pipenv lock

My attempt to debug

I have the lock file which was build using 2023.7.23, now I am trying to deploy it using 2023.8.20

> pipenv --version                                
pipenv, version 2023.8.20

> pipenv install --system --dev --deploy --verbose
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (548109)...
Writing supplied requirement line to temporary file: 'graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b'
Writing supplied requirement line to temporary file: 'retry-extended@ git+https://github.com/strollby/retry-extended@'
Writing supplied requirement line to temporary file: 'zeep@ git+https://github.com/strollby/python-zeep@'
Writing supplied requirement line to temporary file: './whl/graphene_mongo-0.4.0-py3-none-any.whl'
Install Phase: Editable Requirements
Preparing Installation of 'graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b'
Preparing Installation of 'retry-extended@ git+https://github.com/strollby/retry-extended@'
Preparing Installation of 'zeep@ git+https://github.com/strollby/python-zeep@'
Preparing Installation of './whl/graphene_mongo-0.4.0-py3-none-any.whl'
$ ~/my_project/.venv/bin/python3 /opt/homebrew/Cellar/pipenv/2023.8.20/libexec/lib/python3.11/site-packages/pipenv/patched/pip/__pip-runner__.py install -i 
https://pypi.org/simple --no-input --upgrade --no-deps -r /var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-s58g4x67-requirements/pipenv-fddc1de8-reqs.txt
Collecting graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b (from -r 
/var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-s58g4x67-requirements/pipenv-fddc1de8-reqs.txt (line 1))

  Using cached graphene_federation-3.1.4-py3-none-any.whl

Collecting retry-extended@ git+https://github.com/strollby/retry-extended@ (from -r /var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-s58g4x67-requirements/pipenv-fddc1de8-reqs.txt (line 2))

ERROR: The URL 'git+https://github.com/strollby/retry-extended@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
[pipenv.exceptions.InstallError]: ERROR: The URL 'git+https://github.com/strollby/retry-extended@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
ERROR: Couldn't install package: {}
 Package installation failed...

checking the lock file, I found the following line

"retry-extended": {
    "git": "https://github.com/strollby/retry-extended",
},
        

Hmmm!... Then let me re-install retry-extended with version

> pipenv --version                                
pipenv, version 2023.8.20

>pipenv install "git+https://github.com/strollby/retry-extended@9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9#egg=retry-extended"
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv run pip install <requirement_name> to bypass this mechanism, then run $ pipenv graph to inspect the versions actually installed in the virtualenv.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Traceback (most recent call last):
  File "~/my_project/.venv/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/cli/command.py", line 209, in install
    do_install(
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/routines/install.py", line 292, in do_install
    raise e
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/routines/install.py", line 277, in do_install
    do_init(
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/routines/install.py", line 614, in do_init
    do_lock(
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/routines/lock.py", line 65, in do_lock
    venv_resolve_deps(
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 782, in venv_resolve_deps
    c = resolve(cmd, st, project=project)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/my_project/.venv/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 651, in resolve
    raise RuntimeError("Failed to lock Pipfile.lock!")
RuntimeError: Failed to lock Pipfile.lock!

Ugh! Let's retry with old pipenv version

> pipenv --version                                
pipenv, version 2023.7.23

>pipenv install "git+https://github.com/strollby/retry-extended@9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9#egg=retry-extended"

Success!!.... Heh! So the lock was actually possible!!

Now the lock file is updated as follows

"retry-extended": {
    "git": "https://github.com/strollby/retry-extended",
    "ref": "9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9"
},

OK. It seems the issue might have resolved. Let me deploy using the new pipenv

> pipenv --version                                
pipenv, version 2023.8.20

> pipenv install --system --dev --deploy --verbose
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (d23d84)...
Writing supplied requirement line to temporary file: 'graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b'
Writing supplied requirement line to temporary file: 'retry-extended@ git+https://github.com/strollby/retry-extended@9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9'
Writing supplied requirement line to temporary file: 'zeep@ git+https://github.com/strollby/python-zeep@'
Writing supplied requirement line to temporary file: './whl/graphene_mongo-0.4.0-py3-none-any.whl'
Install Phase: Editable Requirements
Preparing Installation of 'graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b'
Preparing Installation of 'retry-extended@ git+https://github.com/strollby/retry-extended@9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9'
Preparing Installation of 'zeep@ git+https://github.com/strollby/python-zeep@'
Preparing Installation of './whl/graphene_mongo-0.4.0-py3-none-any.whl'
$ ~/my_project/.venv/bin/python3 ~/my_project/.venv/lib/python3.11/site-packages/pipenv/patched/pip/__pip-runner__.py install -i 
https://pypi.org/simple --no-input --upgrade --no-deps -r /var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-3cmyz2j2-requirements/pipenv-rph25xmu-reqs.txt
Collecting graphene-federation@ git+https://github.com/strollby/graphene-federation.git@6b414f1b310c0538806d25c5c25f5a312731440b (from -r 
/var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-3cmyz2j2-requirements/pipenv-rph25xmu-reqs.txt (line 1))

  Using cached graphene_federation-3.1.4-py3-none-any.whl

Collecting retry-extended@ git+https://github.com/strollby/retry-extended@9b401b3dd1fce5c3e084ee130a8cc951a6d27fb9 (from -r 
/var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-3cmyz2j2-requirements/pipenv-rph25xmu-reqs.txt (line 2))

  Using cached retry_extended-0.2.3-py3-none-any.whl

Collecting zeep@ git+https://github.com/strollby/python-zeep@ (from -r /var/folders/pm/7grpkr192dq50xdn86kw8clh0000gp/T/pipenv-3cmyz2j2-requirements/pipenv-rph25xmu-reqs.txt (line 3))

ERROR: The URL 'git+https://github.com/strollby/python-zeep@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
[pipenv.exceptions.InstallError]: ERROR: The URL 'git+https://github.com/strollby/python-zeep@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
ERROR: Couldn't install package: {}
 Package installation failed...

Ops!. Should I do the same with python-zeep ??? but this dependency is from one of my private library

What is happening here? Any help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bug 🐛This issue is a bug.Type: BugfixThis issue provides a fix for a known bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions