question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WSL: pipenv shell does not launch a subshell

See original GitHub issue

Issue description

WSL on Windows 10 with Ubuntu 18.04 On WSL the command ‘pipenv shell’ does not launch a subshell or activate the environment. Due to #3488, I had to uninstall all Windows versions of Python to have success at creating the environment.

Expected result

Launching subshell in virtual environment…
(env-setup) mfaine@MSSLW17050462:/mnt/c/Users/mfaine/Desktop/env-setup$

Actual result

Launching subshell in virtual environment…
mfaine@MSSLW17050462:/mnt/c/Users/mfaine/Desktop/env-setup$

Typing exit here will close the terminal. It is possible to to manually activate the environment without launching a subshell with:

source $(pipenv --venv)/bin/activate

Steps to replicate

Pipfile:

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

[dev-packages]

[packages]

[requires]
python_version = "2.7"

Expected result

mfaine@MSSLW17050462:/mnt/c/Users/mfaine/Desktop/env-setup$ pipenv install
Creating a virtualenv for this project…
Pipfile: /mnt/c/Users/mfaine/Desktop/env-setup/Pipfile
Using /usr/bin/python2.7 (2.7.15rc1) to create virtualenv…
⠏ Creating virtual environment...New python executable in /home/mfaine/.local/share/virtualenvs/env-setup-tPXXVp16/bin/python2.7
Also creating executable in /home/mfaine/.local/share/virtualenvs/env-setup-tPXXVp16/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /usr/bin/python2.7
✔ Successfully created virtual environment!
Virtualenv location: /home/mfaine/.local/share/virtualenvs/env-setup-tPXXVp16
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (dfae9f)!
Installing dependencies from Pipfile.lock (dfae9f)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
mfaine@MSSLW17050462:/mnt/c/Users/mfaine/Desktop/env-setup$ pipenv shell
Launching subshell in virtual environment…
(env-setup) mfaine@MSSLW17050462:/mnt/c/Users/mfaine/Desktop/env-setup$
-------------------------------------------------------------------------------
$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/home/mfaine/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.6.7: /usr/bin/python3
  • 3.6.7: /usr/bin/python3.6m
  • 2.7.15rc1: /usr/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-43-Microsoft',
 'platform_system': 'Linux',
 'platform_version': '#1-Microsoft Wed Dec 31 14:42:53 PST 2014',
 'python_full_version': '3.6.7',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • LS_COLORS
  • HOSTTYPE
  • LESSCLOSE
  • LANG
  • USER
  • PWD
  • HOME
  • NAME
  • SHELL
  • TERM
  • SHLVL
  • LOGNAME
  • PATH
  • LESSOPEN
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

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:/mnt/c/ProgramData/scoop/shims:/mnt/c/Windows:/mnt/c/Windows/System32:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Oracle/product/12.2.0/client_1/bin:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_1966171:/mnt/c/Program Files/Microsoft Network Monitor 3:/mnt/c/Program Files (x86)/HID Global/ActivClient:/mnt/c/Program Files/HID Global/ActivClient:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/ProgramData/Oracle/Java/javapath_target_152566531:/mnt/c/Program Files/nodejs:/mnt/c/Program Files (x86)/Sennheiser/SoftphoneSDK:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Program Files/PuTTY:/mnt/c/Vagrant/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/mnt/c/Program Files (x86)/Windows Kits/10/Microsoft Application Virtualization/Sequencer:/mnt/c/Users/mfaine/scoop/shims:/mnt/c/Users/mfaine/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Users/mfaine/AppData/Roaming/npm:/mnt/c/Users/mfaine/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/mnt/c/Program Files/Oracle/VirtualBox:/home/mfaine/.local/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /mnt/c/Users/mfaine/Desktop/env-setup

Contents of Pipfile (‘/mnt/c/Users/mfaine/Desktop/env-setup/Pipfile’):

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

[dev-packages]

[packages]


[requires]
python_version = "2.7"

Contents of Pipfile.lock (‘/mnt/c/Users/mfaine/Desktop/env-setup/Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "ae4bdd7d4157baab65ae9d0e8389a6011e6b640995372c45ec81fa5d1ddfae9f"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "2.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}



Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PetterScommented, Feb 7, 2019

pipenv shell has always worked as it should for me on WSL, with or without python installed in Windows, on three different computers.

0reactions
DeepSpace2commented, Nov 5, 2020

@bromps I ‘solved’ it by recreating the environment with the WSL’s interpreter as was suggested, as I’m already using pipenv 2020.11.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv shell Launching subshell in virtual environment ...
So I run: pipenv shell and get only this message: Launching subshell in virtual environment… 'powershell.exe' is not recognized as an internal ...
Read more >
Pip Environment: Cant access python interpreter
After activating the pipenv shell, try running python - - version and if that does not return an error, python - m pip...
Read more >
pipenv Documentation - Read the Docs
Using $ pipenv run ensures that your installed packages are available to your script. It's also possible to spawn a new shell that...
Read more >
An Effective Python Environment: Making Yourself at Home
You might not be able to run many existing shell scripts in Xonsh as a result. ... a subshell) $ pipenv shell Launching...
Read more >
direnv – unclutter your .profile | direnv
envrc file. direnv is not loading the .envrc into the current shell. It's creating a new bash sub-process to load the stdlib, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found