Skip to content

Install fails for local package with (escaped) space in local path #6308

@webbsledge

Description

@webbsledge

Issue description

pipenv install -e /path/to\ the\ local/directory/ fails when run from the command line using zsh. I did not test other shells.

After further testing, I found that the package installed successfully with pipenv install -e /path/to_the_local/directory, which leads me to believe pipenv has a bug which needs to resolve globing/regex from the command line

Expected result

I would have expected pipenv to handle the escaped spaces in the path sequence correctly.

Actual result

Output below from pipenv install -e /Users/sledge/Development/API/IBKR/IB\ Gateway/IBTJts/source/pythonclient/

Note the escaped space in .../IB\ Gateway/... above.

Installing -e /Users/sledge/Development/API/IBKR/IB Gateway/IBJts/source/pythonclient/...
✔ 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 (f449ce)...
All dependencies are now up-to-date!
Upgrading -e /Users/sledge/Development/API/IBKR/IB Gateway/IBJts/source/pythonclient/ in  dependencies.
Building requirements...
Resolving dependencies...
✘ Locking Failed!
⠼ Locking packages...False
<console width=216 ColorSystem.EIGHT_BIT>
Traceback (most recent call last):
  File "/opt/homebrew/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/cli/options.py", line 52, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/cli/command.py", line 207, in install
    do_install(
    ~~~~~~~~~~^
        state.project,
        ^^^^^^^^^^^^^^
    ...<14 lines>...
        skip_lock=state.installstate.skip_lock,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/routines/install.py", line 310, in do_install
    new_packages, _ = handle_new_packages(
                      ~~~~~~~~~~~~~~~~~~~^
        project,
        ^^^^^^^^
    ...<9 lines>...
        index=index,
        ^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/routines/install.py", line 114, in handle_new_packages
    do_update(
    ~~~~~~~~~^
        project,
        ^^^^^^^^
    ...<7 lines>...
        categories=pipfile_categories,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/routines/update.py", line 75, in do_update
    upgrade(
    ~~~~~~~^
        project,
        ^^^^^^^^
    ...<9 lines>...
        extra_pip_args=extra_pip_args,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/routines/update.py", line 367, in upgrade
    upgrade_lock_data = venv_resolve_deps(
        requested_packages[pipfile_category],
    ...<6 lines>...
        pypi_mirror=pypi_mirror,
    )
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/utils/resolver.py", line 907, in venv_resolve_deps
    c = resolve(cmd, st, project=project)
  File "/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv/utils/resolver.py", line 771, in resolve
    raise RuntimeError("Failed to lock Pipfile.lock!")
RuntimeError: Failed to lock Pipfile.lock!

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

Simply try to install any local directory as a package, where the local directory has spaces in the path name that need to be escaped in the system shell.


$ pipenv --support

Pipenv version: '2024.3.1'

Pipenv location: '/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/lib/python3.13/site-packages/pipenv'

Python location: '/opt/homebrew/Cellar/pipenv/2024.3.1/libexec/bin/python'

OS Name: 'posix'

User pip version: '24.2'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.13.0',
 'os_name': 'posix',
 'platform_machine': 'arm64',
 'platform_python_implementation': 'CPython',
 'platform_release': '24.1.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT '
                     '2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020',
 'python_full_version': '3.13.0',
 'python_version': '3.13',
 'sys_platform': 'darwin'}

System environment variables:

  • TERM_SESSION_ID
  • SSH_AUTH_SOCK
  • LC_TERMINAL_VERSION
  • COLORFGBG
  • ITERM_PROFILE
  • XPC_FLAGS
  • LANG
  • PWD
  • SHELL
  • __CFBundleIdentifier
  • TERM_FEATURES
  • TERM_PROGRAM_VERSION
  • TERM_PROGRAM
  • PATH
  • LC_TERMINAL
  • COLORTERM
  • COMMAND_MODE
  • TERM
  • TERMINFO_DIRS
  • HOME
  • TMPDIR
  • USER
  • XPC_SERVICE_NAME
  • LOGNAME
  • ITERM_SESSION_ID
  • __CF_USER_TEXT_ENCODING
  • SHLVL
  • OLDPWD
  • HOMEBREW_PREFIX
  • HOMEBREW_CELLAR
  • HOMEBREW_REPOSITORY
  • INFOPATH
  • PYENV_SHELL
  • P9K_TTY
  • _P9K_TTY
  • ZSH
  • LS_COLORS
  • ZSH_COMPDUMP
  • PAGER
  • LESS
  • LSCOLORS
  • P9K_SSH
  • _P9K_SSH_TTY
  • EDITOR
  • FZF_DEFAULT_OPTS
  • FZF_DEFAULT_COMMAND
  • FZF_CTRL_T_COMMAND
  • FZF_ALT_C_COMMAND
  • FZF_CTRL_T_OPTS
  • FZF_ALT_C_OPTS
  • BAT_THEME
  • AICHAT_CONFIG_DIR
  • NVM_DIR
  • NVM_CD_FLAGS
  • NVM_BIN
  • NVM_INC
  • PYENV_ROOT
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /Users/sledge/.pyenv/versions/3.11.10/bin:/Users/sledge/.pyenv/versions/3.12.7/bin:/Users/sledge/.pyenv/versions/3.13.0/bin:/Users/sledge/.pyenv/versions/3.10.15/bin:/Users/sledge/.pyenv/shims:/Users/sledge/.nvm/versions/node/v20.16.0/bin:/Users/sledge/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/sledge/Library/Application Support/JetBrains/Toolbox/scripts
  • SHELL: /opt/homebrew/bin/zsh
  • EDITOR: nvim
  • LANG: en_US.UTF-8
  • PWD: /Users/sledge/Development/Python/security-analysis

Contents of Pipfile ('/Users/sledge/Development/Python/security-analysis/Pipfile'):

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

[packages]
sqlalchemy = "*"
psycopg = "*"
ipykernel = "*"
jupyter = "*"
fredapi = "*"
schwab-py = "*"
quantlib = "*"
pandas = "*"
numpy = "*"
matplotlib = "*"
pyarrow = "*"
sec-edgar-api = "*"
scikit-learn = "*"
edgartools = {file = "../edgartools", editable = true}
pyportfolioopt = {file = "../PyPortfolioOpt", editable = true}
ibapi = {file = "../../API/IBKR/IB_Gateway/IBJts/source/pythonclient", editable = true}

[dev-packages]

[requires]
python_version = "3.13"
python_full_version = "3.13.0"

Contents of Pipfile.lock ('/Users/sledge/Development/Python/security-analysis/Pipfile.lock'):

This is too long to include.

Metadata

Metadata

Assignees

Labels

Contributor CandidateThe issue has been identified/triaged and contributions are welcomed/encouraged.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions