Skip to content

Faulty resolution of PEP 508 file scheme URL during locking #6521

@ByteB4rb1e

Description

@ByteB4rb1e

Issue description

When declaring a package dependency via PEP 508 URL-based lookup with file scheme, pipenv fails to resolve the version of the referenced dependency.

Expected result

Successful installation, analogous to pip install:

$> pipenv run pip install . --verbose
Using pip 25.1.1 from /home/tiara/.local/share/virtualenvs/pipenv-bug-6WL9parW/lib/python3.13/site-packages/pip (python 3.13)
Processing /home/tiara/workspace/local/pipenv-bug
  Installing build dependencies: started
  Running command pip subprocess to install build dependencies
  Using pip 25.1.1 from /home/tiara/.local/share/virtualenvs/pipenv-bug-6WL9parW/lib/python3.13/site-packages/pip (python 3.13)
  Collecting setuptools>=40.8.0
    Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/packages/9d/76/f789f7a86709c6b087c5a2f52f911838cad707cc613162401badc665acfe/setuptools-82.0.1-py3-none-any.whl.metadata
    Using cached setuptools-82.0.1-py3-none-any.whl.metadata (6.5 kB)
  Using cached setuptools-82.0.1-py3-none-any.whl (1.0 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-82.0.1
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Running command Getting requirements to build wheel
  running egg_info
  writing top_level_pkg.egg-info/PKG-INFO
  writing dependency_links to top_level_pkg.egg-info/dependency_links.txt
  writing requirements to top_level_pkg.egg-info/requires.txt
  writing top-level names to top_level_pkg.egg-info/top_level.txt
  reading manifest file 'top_level_pkg.egg-info/SOURCES.txt'
  writing manifest file 'top_level_pkg.egg-info/SOURCES.txt'
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Running command Preparing metadata (pyproject.toml)
  running dist_info
  creating /tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info
  writing /tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/dependency_links.txt
  writing requirements to /tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/requires.txt
  writing top-level names to /tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/top_level.txt
  writing manifest file '/tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/SOURCES.txt'
  writing manifest file '/tmp/pip-modern-metadata-g1r1473r/top_level_pkg.egg-info/SOURCES.txt'
  creating '/tmp/pip-modern-metadata-g1r1473r/top_level_pkg-1.0.0.dist-info'
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting local-child-pkg@ file:///home/tiara/workspace/local/pipenv-bug/vendor/local-child-pkg (from top-level-pkg==1.0.0)
  Using cached local_child_pkg-1.0.0-py3-none-any.whl
Requirement already satisfied: cowsay in /home/tiara/.local/share/virtualenvs/pipenv-bug-6WL9parW/lib/python3.13/site-packages (from local-child-pkg@ file:///home/tiara/workspace/local/pipenv-bug/vendor/local-child-pkg->top-level-pkg==1.0.0) (6.1)
Building wheels for collected packages: top-level-pkg
  Building wheel for top-level-pkg (pyproject.toml): started
  Running command Building wheel for top-level-pkg (pyproject.toml)
  running bdist_wheel
  running build
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_egg_info
  running egg_info
  writing top_level_pkg.egg-info/PKG-INFO
  writing dependency_links to top_level_pkg.egg-info/dependency_links.txt
  writing requirements to top_level_pkg.egg-info/requires.txt
  writing top-level names to top_level_pkg.egg-info/top_level.txt
  reading manifest file 'top_level_pkg.egg-info/SOURCES.txt'
  writing manifest file 'top_level_pkg.egg-info/SOURCES.txt'
  Copying top_level_pkg.egg-info to build/bdist.linux-x86_64/wheel/./top_level_pkg-1.0.0-py3.13.egg-info
  running install_scripts
  creating build/bdist.linux-x86_64/wheel/top_level_pkg-1.0.0.dist-info/WHEEL
  creating '/tmp/pip-wheel-hazwg42l/.tmp-tq60w9bz/top_level_pkg-1.0.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  adding 'top_level_pkg-1.0.0.dist-info/METADATA'
  adding 'top_level_pkg-1.0.0.dist-info/WHEEL'
  adding 'top_level_pkg-1.0.0.dist-info/top_level.txt'
  adding 'top_level_pkg-1.0.0.dist-info/RECORD'
  removing build/bdist.linux-x86_64/wheel
  Building wheel for top-level-pkg (pyproject.toml): finished with status 'done'
  Created wheel for top-level-pkg: filename=top_level_pkg-1.0.0-py3-none-any.whl size=1067 sha256=06b888ba08910365c56c4e07b24d64439f149a71b4f0b1838d0e71a5415290a3
  Stored in directory: /home/tiara/.cache/pip/wheels/8a/73/4a/5e0f9e055857fc3e810db82b0ec7b75d7e8f4a9d16b174f1e4
Successfully built top-level-pkg
Installing collected packages: local-child-pkg, top-level-pkg

Successfully installed local-child-pkg-1.0.0 top-level-pkg-1.0.0

Actual result

$> pipenv install --verbose .
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing ....
✔ Installation Succeeded
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (fe3a74)...
Writing supplied requirement line to temporary file: 'local-child-pkg'
Writing supplied requirement line to temporary file: '.'
Install Phase: Editable Requirements
Preparing Installation of 'local-child-pkg'
Preparing Installation of '.'
$ /home/tiara/.local/share/virtualenvs/pipenv-bug-6WL9parW/bin/python /home/tiara/.local/lib/python3.13/site-packages/pipenv/patched/pip/__pip-runner__.py install -i 
https://pypi.org/simple --no-input --upgrade --no-deps -r /tmp/pipenv-cd6l_14l-requirements/pipenv-qun3vfhf-reqs.txt
Using source directory: PosixPath('/home/tiara/.local/share/virtualenvs/pipenv-bug-6WL9parW/src')
Processing /home/tiara/workspace/local/pipenv-bug

  Installing build dependencies: started

  Installing build dependencies: finished with status 'done'

  Getting requirements to build wheel: started

  Getting requirements to build wheel: finished with status 'done'

  Preparing metadata (pyproject.toml): started

  Preparing metadata (pyproject.toml): finished with status 'done'

ERROR: Could not find a version that satisfies the requirement local-child-pkg (from versions: none)
ERROR: No matching distribution found for local-child-pkg
ERROR: Could not find a version that satisfies the requirement local-child-pkg (from versions: none)
ERROR: No matching distribution found for local-child-pkg
ERROR: Couldn't install package: {}
 Package installation failed...

Steps to replicate

In a clean working directory, execute this bootstrap script:

#!/usr/bin/env sh

cat << EOF > pyproject.toml
[project]
name = "top-level-pkg"
version = "1.0.0"
dynamic = ["dependencies"]

[tool.setuptools]
packages = []
EOF

cat << EOF > setup.py
from pathlib import Path
from setuptools import setup

setup(
    install_requires=[
        f"local-child-pkg @ file://{(Path('vendor') / 'local-child-pkg').resolve()}"
    ]
)
EOF

mkdir -p vendor/local-child-pkg
cat << EOF > vendor/local-child-pkg/pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "local-child-pkg"
version = "1.0.0"

dependencies = [
    "cowsay"
]

[tool.setuptools]
packages = []
EOF

then run pipenv install .


$ pipenv --support

Pipenv version: '2026.0.3'

Pipenv location: '/home/tiara/.local/lib/python3.13/site-packages/pipenv'

Python location: '/usr/bin/python3'

OS Name: 'posix'

User pip version: '25.3'

user Python installations found:

  • 3.13.7: /usr/bin/python3
  • 3.13.7: /bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.13.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.17.0-12-generic',
 'platform_system': 'Linux',
 'platform_version': '#12-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan  9 20:46:52 UTC '
                     '2026',
 'python_full_version': '3.13.7',
 'python_version': '3.13',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • QT_ACCESSIBILITY
  • COLORTERM
  • XDG_CONFIG_DIRS
  • HISTCONTROL
  • XDG_MENU_PREFIX
  • TERM_PROGRAM_VERSION
  • GNOME_DESKTOP_SESSION_ID
  • QT_IM_MODULES
  • TMUX
  • PTYXIS_PROFILE
  • HISTSIZE
  • GNOME_SHELL_SESSION_MODE
  • SSH_AUTH_SOCK
  • MEMORY_PRESSURE_WRITE
  • TMUX_PLUGIN_MANAGER_PATH
  • XMODIFIERS
  • DESKTOP_SESSION
  • GPG_TTY
  • EDITOR
  • GTK_MODULES
  • DBUS_STARTER_BUS_TYPE
  • PWD
  • XDG_SESSION_DESKTOP
  • LOGNAME
  • XDG_SESSION_TYPE
  • GPG_AGENT_INFO
  • SYSTEMD_EXEC_PID
  • HISTAPPEND
  • XAUTHORITY
  • IM_CONFIG_CHECK_ENV
  • HOME
  • USERNAME
  • IM_CONFIG_PHASE
  • LANG
  • XDG_CURRENT_DESKTOP
  • MEMORY_PRESSURE_WATCH
  • VTE_VERSION
  • WAYLAND_DISPLAY
  • INVOCATION_ID
  • MANAGERPID
  • GNOME_SETUP_DISPLAY
  • XDG_SESSION_CLASS
  • TERM
  • USER
  • TMUX_PANE
  • DISPLAY
  • SHLVL
  • QT_IM_MODULE
  • DBUS_STARTER_ADDRESS
  • XDG_RUNTIME_DIR
  • DEBUGINFOD_URLS
  • LC_ALL
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • HISTFILESIZE
  • DBUS_SESSION_BUS_ADDRESS
  • PTYXIS_VERSION
  • FLATPAK_TTY_PROGRESS
  • TERM_PROGRAM
  • _
  • OLDPWD
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/mingw64/bin:/home/tiara/.local/bin:/home/tiara/.cargo/bin:/c/Users/me/AppData/Local/Programs/Microsoft/jdk-17.0.14.7-hotspot/bin:/opt/nssm-2.24-103-gdee49fc/win64:/opt/apache-maven-3.9.9/bin:/opt/javacc-javacc-7.0.13/scripts:/opt/apache-ant-1.10.15/bin:/c/Program Files/Amazon/AWSCLIV2:/c/Users/me/AppData/Local/Programs/Docker/docker-28.2.1/docker:/c/Users/me/AppData/Local/Programs/docker-compose:/c/Users/me/AppData/Local/Programs/AquaSecurity/trivy_0.63.0_windows-64bit:/mingw64/bin:/home/tiara/.local/bin:/home/tiara/.cargo/bin:/c/Users/me/AppData/Local/Programs/Microsoft/jdk-17.0.14.7-hotspot/bin:/opt/nssm-2.24-103-gdee49fc/win64:/opt/apache-maven-3.9.9/bin:/opt/javacc-javacc-7.0.13/scripts:/opt/apache-ant-1.10.15/bin:/c/Program Files/Amazon/AWSCLIV2:/c/Users/me/AppData/Local/Programs/Docker/docker-28.2.1/docker:/c/Users/me/AppData/Local/Programs/docker-compose:/c/Users/me/AppData/Local/Programs/AquaSecurity/trivy_0.63.0_windows-64bit
  • SHELL: /bin/bash
  • EDITOR: vim
  • LANG: en_US.UTF-8
  • PWD: /home/tiara/workspace/local/pipenv-bug

Contents of Pipfile ('/home/tiara/workspace/local/pipenv-bug/Pipfile'):

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

[packages]

[dev-packages]

[requires]
python_version = "3.13"

Contents of Pipfile.lock ('/home/tiara/workspace/local/pipenv-bug/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "7865e46032abb18ae9d692b19a4cc8847ab396a30bec828d936967e3d8fe3a74"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.13"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "cowsay": {
            "hashes": [
                "sha256:274b1e6fc1b966d53976333eb90ac94cb07a450a700b455af9fbdf882244b30a"
            ],
            "markers": "python_version >= '3.8'",
            "version": "==6.1"
        },
        "local-child-pkg": {},
        "top-level-pkg": {
            "file": "."
        }
    },
    "develop": {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions