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.

Broken pipe in WSL2

See original GitHub issue

Issue description

Within WSL2 (Debian), when creating an environment and running pipenv shell i receive a broken pipe when it try’s to load. I dont know if this is a WSL2 thing or a pipenv thing.

Expected result

I would have expected to be put into the virtualenv

Actual result

When possible, provide the verbose output (--verbose), especially for locking and dependencies resolving issues.

$ pipenv shell --verbose
Launching subshell in virtual environment…
 . /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf/bin/activate
--verbose
write failed 32: Broken pipe

Steps to replicate

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


[~]$ cd /tmp
[/tmp]$ mkdir temp ; cd $_
[/tmp/temp]$ echo "print('hello world')" > test.py
[/tmp/temp]$ pipenv install --three
Creating a virtualenv for this project…
Pipfile: /tmp/temp/Pipfile
Using /usr/bin/python3.7m (3.7.3) to create virtualenv…
⠴ Creating virtual environment...Using base prefix '/usr'
New python executable in /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf/bin/python3.7m
Also creating executable in /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Running virtualenv with interpreter /usr/bin/python3.7m

✔ Successfully created virtual environment!
Virtualenv location: /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (a65489)!
Installing dependencies from Pipfile.lock (a65489)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
[/tmp/temp]$ pipenv shell
Launching subshell in virtual environment…
 . /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf/bin/activate
write failed 32: Broken pipe
[/tmp/temp]$ exit
exit
[/tmp/temp]$ pipenv shell
Launching subshell in virtual environment…
 . /home/jthorpe/.local/share/virtualenvs/temp-HIOIE7wf/bin/activate
[/tmp/temp]$ which python
/usr/bin/python
[/tmp/temp]$ exit
exit
[/tmp/temp]$ pipenv run "which python"
[/tmp/temp]$

Please run $ pipenv --support, and paste the results here. Don’t put backticks (`) around it! The output already contains Markdown formatting.

$ pipenv --support

Pipenv version: '2020.6.2'

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

Python location: '/usr/bin/python3'

Python installations found:

  • 3.7.3: /usr/bin/python3.7
  • 3.7.3: /usr/bin/python3
  • 3.7.3: /usr/bin/python3.7m
  • 2.7.16: /usr/bin/python2
  • 2.7.16: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.3',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.19.104-microsoft-standard',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Wed Feb 19 06:37:35 UTC 2020',
 'python_full_version': '3.7.3',
 'python_version': '3.7',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • LESS
  • WSL_DISTRO_NAME
  • WT_SESSION
  • PIPENV_ACTIVE
  • NAME
  • PWD
  • LOGNAME
  • PIP_PYTHON_PATH
  • HOME
  • LANG
  • WSL_INTEROP
  • LS_COLORS
  • TERM
  • LESSOPEN
  • USER
  • PIP_DISABLE_PIP_VERSION_CHECK
  • DISPLAY
  • SHLVL
  • PYTHONDONTWRITEBYTECODE
  • WSLENV
  • PATH
  • HOSTTYPE
  • WT_PROFILE_ID
  • OLDPWD
  • _
  • PIP_SHIMS_BASE_MODULE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /home/jthorpe/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Android:/mnt/c/Windows/System32:/mnt/c/Program Files/dotnet/:/mnt/c/Users/Joe/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Joe/Documents/opt/emacs26/bin:/mnt/c/Users/Joe/AppData/Local/hyper/app-3.0.2/resources/bin:/mnt/c/Users/Joe/AppData/Local/Programs/Microsoft VS Code/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/jthorpe/.local/bin:/mnt/c/Windows/System32/:/mnt/c/Windows/SysWOW64/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/jthorpe/.local/bin:/mnt/c/Windows/System32/:/mnt/c/Windows/SysWOW64/
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /tmp/temp

Contents of Pipfile (‘/tmp/temp/Pipfile’):

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

[dev-packages]

[packages]

[requires]
python_version = "3.7"

Contents of Pipfile.lock (‘/tmp/temp/Pipfile.lock’):

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
ividitocommented, Apr 22, 2022

Not sure if there’s any interest in revisiting this, but I’ve been running into the same issue as described above. If it helps, I also get the exact same behaviour using Poetry’s poetry shell command. I wonder if WSL doesn’t play nice with pexpect

0reactions
ividitocommented, Jul 7, 2022

@ividito What commands were you running/what Pipfile or other useful context? I have a friend at work that runs pipenv in WSL and I haven’t heard of any complaints from him, so I would like to ask for more details to be able to reproduce it.

I’ve dropped pipenv since I commented, but here’s my Pipfile from when I last observed this issue:

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

[dev-packages]

[packages]

[requires]
python_version = "3.7"

I ran into the issue while running pipenv shell . I do still run into this issue with poetry shell , and I’ve generally adapted my workflow to compensate rather than continue to wrestle with it. If there are specific resources I can provide or troubleshooting steps I can take that would help with reproducing it, let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Write failed: Broken pipe · Issue #748 · microsoft/WSL - GitHub
This happens in a scenario where I am ssh'd into a server and inactive. Even if the ssh connection is interrupted, the bash...
Read more >
WSL: Getting broken vertical pipe (U+00A6) instead of pipe (U ...
I have a standard EN/US Keyboard on my laptop, without numkeys. The environment is WSL2 (Windows Subsystem for Linux) and it happens no...
Read more >
dpkg-dep error: paste subprocess was killed by signal(Broken ...
It seems I have fixed the problem. sudo dpkg -i --force-overwrite [the path to the libpython3.10 archive folder]. and then
Read more >
Beware of Dirty Pipes and Docker Desktop on Windows! - DDEV
You have to go to “Windows Update” → “Advanced Options” -> Receive updates for other Microsoft Products” so that your WSL2 kernel gets...
Read more >
WSL 22.04 - npiperelay: write failed 32: Broken pipe
I installed Windows 10, WSL 2 and Ubuntu 22.04. In windows I have Keepass with the plugin Keeagent, and loaded my SSH Key...
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