Skip to content

pipenv shell does not work with PowerShell Core #1689

@brettcannon

Description

@brettcannon

Running pipenv shell under PowerShell Core does not work.

Pipenv version: '11.6.1'

Pipenv location: 'C:\\Users\\brcan\\AppData\\Roaming\\Python\\Python36\\site-packages\\pipenv'

Python location: 'C:\\Users\\brcan\\AppData\\Local\\Programs\\Python\\Python36\\python.exe'

Other Python installations in PATH:


Expected result

pipenv shell to execute the Activate.ps1 script for the virtual environment.

Actual result
PS C:\Users\brcan\Desktop\bunk> py -3 -m pipenv shell
Traceback (most recent call last):
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\core.py", line 2107, in do_shell
    c = pexpect.spawn(
AttributeError: module 'pexpect' has no attribute 'spawn'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\__main__.py", line 4, in <module>
    cli()
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\cli.py", line 281, in shell
    core.do_shell(three=three, python=python, fancy=fancy, shell_args=shell_args)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\core.py", line 2123, in do_shell
    pew.workon_cmd([workon_name])
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\pew.py", line 368, in workon_cmd
    shell(env, cwd=project_dir)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\pew.py", line 194, in shell
    shell = _detect_shell()
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\pew.py", line 187, in _detect_shell
    shell = get_shell(os.getpid())
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\_win_utils.py", line 111, in get_shell
    return check_parent(pid)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\_win_utils.py", line 108, in check_parent
    return check_parent(ppid, lvl=lvl+1)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\_win_utils.py", line 108, in check_parent
    return check_parent(ppid, lvl=lvl+1)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\_win_utils.py", line 108, in check_parent
    return check_parent(ppid, lvl=lvl+1)
  File "C:\Users\brcan\AppData\Roaming\Python\Python36\site-packages\pipenv\patched\pew\_win_utils.py", line 104, in check_parent
    if ppid and processes[ppid]['executable'].lower().rsplit('.', 1)[0] in SHELL_NAMES:
KeyError: 18064
Steps to replicate
PS C:\Users\brcan\Desktop\bunk> py -3 -m pipenv --python 3.6.4
Virtualenv already exists!
Removing existing virtualenv…
Creating a virtualenv for this project…
Using C:\Users\brcan\AppData\Local\Programs\Python\Python36\python.exe (3.6.4) to create virtualenv…
Already using interpreter C:\Users\brcan\AppData\Local\Programs\Python\Python36\python.exe
Using base prefix 'C:\\Users\\brcan\\AppData\\Local\\Programs\\Python\\Python36'
New python executable in C:\Users\brcan\.virtualenvs\bunk-M_X9FcBv\Scripts\python.exe
Installing setuptools, pip, wheel...done.

Virtualenv location: C:\Users\brcan\.virtualenvs\bunk-M_X9FcBv
Creating a Pipfile for this project…
PS C:\Users\brcan\Desktop\bunk> py -3 -m pipenv shell

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: WindowsThis issue affects the Windows Operating System.Type: Bug 🐛This issue is a bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions