pipenv: pipenv shell fails to find /usr/local/bin/bash in pexpect

Issue description

I can’t run pipenv shell. This is different to the other issues related to this issue, since my SHELL variable is correctly configured. It seems to be something pexpect is doing wrong.

Expected result

Successfully running pipenv shell

Actual result
$ pipenv --version
pipenv, version 2018.7.1
$ echo $SHELL
/usr/local/bin/bash
$ stat $SHELL
16777220 8618578105 lrwxr-xr-x 1 keegan admin 0 30 "Jun 15 08:03:49 2018" "Jun 15 08:03:49 2018" "Jun 15 08:03:49 2018" "Jun 15 08:03:49 2018" 4194304 0 0 /usr/local/bin/bash
$ pipenv shell --verbose
Launching subshell in virtual environment…
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pipenv/cli.py", line 664, in shell
    three=three, python=python, fancy=fancy, shell_args=shell_args, pypi_mirror=pypi_mirror
  File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2163, in do_shell
    shell.fork_compat(*fork_args)
  File "/usr/local/lib/python3.7/site-packages/pipenv/shells.py", line 107, in fork_compat
    self.cmd, ['-i'], dimensions=(dims.lines, dims.columns),
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/pty_spawn.py", line 204, in __init__
    self._spawn(command, args, preexec_fn, dimensions)
  File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/pty_spawn.py", line 276, in _spawn
    'executable: %s.' % self.command)
pipenv.vendor.pexpect.exceptions.ExceptionPexpect: The command was not found or was not executable: -/usr/local/bin/bash.

Note: /usr/local/bin/bash is a symlink to /usr/local/Cellar/bash/4.4.23/bin/bash (managed by brew). Setting SHELL to that value or /bin/bash both fail.

Steps to replicate

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


$ pipenv --support

Pipenv version: '2018.7.1'

Pipenv location: '/usr/local/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/opt/python/bin/python3.7'

Other Python installations in PATH:

  • 2.7: /usr/local/bin/python2.7

  • 2.7: /usr/local/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.7: /usr/local/bin/python3.7m

  • 3.7: /usr/local/bin/python3.7

  • 2.7.15: /usr/local/bin/python

  • 2.7.10: /usr/bin/python

  • 2.7.15: /usr/local/bin/python2

  • 3.7.0: /usr/local/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '17.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT '
                     '2018; root:xnu-4570.61.1~1/RELEASE_X86_64',
 'python_full_version': '3.7.0',
 'python_version': '3.7',
 'sys_platform': 'darwin'}

System environment variables:

  • STY
  • SRCPATH
  • MAILCHECK
  • LANG
  • XPC_FLAGS
  • HISTCONTROL
  • OLDPWD
  • TERM_SESSION_ID
  • EDITOR
  • COLORTERM
  • PERL_MB_OPT
  • __CF_USER_TEXT_ENCODING
  • LOCKPRG
  • ITERM_SESSION_ID
  • SSH_AUTH_SOCK
  • USER
  • GOPATH
  • PWD
  • HOME
  • WINDOW
  • TERM_PROGRAM
  • TERM_PROGRAM_VERSION
  • Apple_PubSub_Socket_Render
  • ITERM_PROFILE
  • PERL_MM_OPT
  • TMPDIR
  • PERL_LOCAL_LIB_ROOT
  • XPC_SERVICE_NAME
  • SHELL
  • TERM
  • PERL5LIB
  • COLORFGBG
  • SHLVL
  • LOGNAME
  • GOBIN
  • PATH
  • HISTSIZE
  • HISTFILESIZE
  • TERMCAP
  • _
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /Users/keegan/.cargo/bin:/usr/local/opt/go/libexec/bin:/Users/keegan/bin:/Users/keegan/google-cloud-sdk/bin:/Users/keegan/.yarn/bin:/Users/keegan/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/keegan/.cargo/bin:/usr/local/opt/go/libexec/bin:/Users/keegan/bin:/Users/keegan/google-cloud-sdk/bin:/Users/keegan/.yarn/bin:/Users/keegan/perl5/bin:/Users/keegan/go/bin:/Users/keegan/go/bin
  • SHELL: /usr/local/bin/bash
  • EDITOR: vim
  • LANG: en_GB.UTF-8
  • PWD: /Users/keegan/go/src/github.com/weaveworks/kubediff

Contents of Pipfile (‘/Users/keegan/go/src/github.com/weaveworks/kubediff/Pipfile’):

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

[packages]
attrs = "*"
tabulate = "*"
PyYAML = "*"

[dev-packages]

[requires]
python_version = "3.7"

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Will there be a new release containing the bug fix?

Is this not fixed yet in the latest on PyPI? Pretty egregious bug for a high-profile project:

⏵ pipenv --version
    pipenv, version 2018.10.13
⏵ pipenv shell
...
pipenv.vendor.pexpect.exceptions.ExceptionPexpect: The command was not found or was not executable: fish.

⏵ python3
>>> from pipenv.shells import _detect_emulator, detect_info
>>> detect_info()
('fish', 'fish')
^D

⏵ env PIPENV_SHELL="$SHELL" pipenv shell
Loading .env environment variables…
Launching subshell in virtual environment…

⏵  source .../dev-TrP3E4Ut/bin/activate.fish
(dev-TrP3E4Ut) ... ⏵

# worked.