pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.83k stars 1.87k forks source link

Pipenv attempts to read entire filesystem when creating new virtualenvs, gets stuck on /keybase #4898

Open icy-ux opened 2 years ago

icy-ux commented 2 years ago

Description

I attempt to create a new virtualenv in /home/user/my/project. Since I have keybase on my system, there is a /keybase directory, representing a mounted kbfs filesystem. Accessing files in this directory results in network traffic and other strange phenomena. This appears to be causing pipenv to choke

$ strace pipenv -v
newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=1000, ...}, 0) = 0
newfstatat(AT_FDCWD, "/etc", {st_mode=S_IFDIR|0755, st_size=12288, ...}, 0) = 0
newfstatat(AT_FDCWD, "/lib", {st_mode=S_IFDIR|0555, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/keybase", 0x7ffe32a8e590, 0) = -1 (errno 18446744073709551354)
+++ killed by SIGKILL +++
Killed

Expected behavior

Pipenv should not try to access every directory on the filesystem when creating a virtualenv. Just the current and parent directories.

pip version

2021.11.23

Python version

Python 3.9.9

OS

Fedora 34

How to Reproduce

  1. Install Keybase
  2. Install pipenv, etc
  3. Install strace (to watch the system calls)
  4. Create a project directory in /home/user/my/project
  5. From inside the directory, execute strace pipenv -v (strace is optional, but will show where things hang)

Output

See above

Code of Conduct

matteius commented 2 years ago

@icy-ux You did not include output from pipenv --support. I wonder if this a case where you would have better results with a --user install of pipenv over a global system one, but again not entirely sure what you are working with without that detail in the report.

matteius commented 2 years ago

I see on my global install of pipenv, it does have a call to every root directory, and my local install version does the same, so probably a bad hunch I had just now @icy-ux

newfstatat(AT_FDCWD, "/mnt", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/media", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/libx32", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sbin", {st_mode=S_IFDIR|0755, st_size=20480, ...}, 0) = 0
newfstatat(AT_FDCWD, "/dev", {st_mode=S_IFDIR|0755, st_size=4160, ...}, 0) = 0
newfstatat(AT_FDCWD, "/snap", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/root", {st_mode=S_IFDIR|0700, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/srv", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=940, ...}, 0) = 0
newfstatat(AT_FDCWD, "/boot", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=16384, ...}, 0) = 0
newfstatat(AT_FDCWD, "/lost+found", {st_mode=S_IFDIR|0700, st_size=16384, ...}, 0) = 0
newfstatat(AT_FDCWD, "/bin", {st_mode=S_IFDIR|0755, st_size=36864, ...}, 0) = 0
newfstatat(AT_FDCWD, "/etc", {st_mode=S_IFDIR|0755, st_size=12288, ...}, 0) = 0
newfstatat(AT_FDCWD, "/opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/cdrom", {st_mode=S_IFDIR|0775, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}, 0) = 0
newfstatat(AT_FDCWD, "/swapfile", {st_mode=S_IFREG|0600, st_size=1581271040, ...}, 0) = 0
newfstatat(AT_FDCWD, "/lib32", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/sys", {st_mode=S_IFDIR|0555, st_size=0, ...}, 0) = 0
icy-ux commented 2 years ago

@.*** You did not include output from pipenv --support. I wonder if this a case where you would have better results with a --user install of pipenv over a global system one, but again not entirely sure what you are working with without that detail in the report.

Sure, here you go:

$ pipenv --support
<details><summary>$ pipenv --support</summary>

Pipenv version: `'2021.11.23'`

Pipenv location: `'/home/user/.local/lib/python3.9/site-packages/pipenv'`

Python location: `'/usr/bin/python3'`

Python installations found:

   - `3.9.9`: `/usr/bin/python3.9`
   - `3.9.9`: `/usr/bin/python`
   - `3.9.9`: `/usr/bin/python3`
   - `3.8.12`: `/usr/bin/python3.8`
   - `3.7.12`: `/usr/bin/python3.7`
   - `3.7.12`: `/usr/bin/python3.7m`
   - `3.6.15`: `/usr/bin/python3.6m`
   - `3.6.15`: `/usr/bin/python3.6`
   - `3.6.9`: `/usr/bin/pypy3`
   - `3.6.9`: `/usr/bin/pypy3.6`
   - `2.7.18`: `/usr/bin/python2`
   - `2.7.18`: `/usr/bin/python2.7`
   - `2.7.13`: `/usr/bin/pypy`
   - `2.7.13`: `/usr/bin/pypy2.7`
   - `2.7.13`: `/usr/bin/pypy2`

PEP 508 Information:

{'implementation_name': 'cpython', 'implementation_version': '3.9.9', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '5.4.156-1.fc25.qubes.x86_64', 'platform_system': 'Linux', 'platform_version': '#1 SMP Fri Oct 29 02:51:34 CEST 2021', 'python_full_version': '3.9.9', 'python_version': '3.9', 'sys_platform': 'linux'}


System environment variables:

   - `SHELL`
   - `COLORTERM`
   - `HISTCONTROL`
   - `GNOME_DESKTOP_SESSION_ID`
   - `HISTSIZE`
   - `HOSTNAME`
   - `VMTYPE`
   - `SSH_AUTH_SOCK`
   - `QUBES_KEYMAP`
   - `QREXEC_AGENT_PID`
   - `SSH_AGENT_PID`
   - `XDG_SEAT`
   - `PWD`
   - `LOGNAME`
   - `XDG_SESSION_TYPE`
   - `WINDOWPATH`
   - `HOME`
   - `SSH_ASKPASS`
   - `LANG`
   - `_JAVA_AWT_WM_NONREPARENTING`
   - `LS_COLORS`
   - `VTE_VERSION`
   - `QREXEC_SERVICE_FULL_NAME`
   - `GNOME_TERMINAL_SCREEN`
   - `QREXEC_SERVICE_ARGUMENT`
   - `MOZ_GMP_PATH`
   - `UPDTYPE`
   - `XDG_SESSION_CLASS`
   - `TERM`
   - `QUBES_ENV_SOURCED`
   - `LESSOPEN`
   - `QREXEC_REMOTE_DOMAIN`
   - `USER`
   - `GNOME_TERMINAL_SERVICE`
   - `DISPLAY`
   - `SHLVL`
   - `XDG_VTNR`
   - `XDG_SESSION_ID`
   - `QUBES_USER_KEYMAP`
   - `XDG_RUNTIME_DIR`
   - `which_declare`
   - `XDG_DATA_DIRS`
   - `PATH`
   - `DBUS_SESSION_BUS_ADDRESS`
   - `MAIL`
   - `QT_X11_NO_MITSHM`
   - `OLDPWD`
   - `BASH_FUNC_which%%`
   - `_`
   - `PIP_SHIMS_BASE_MODULE`
   - `PIP_DISABLE_PIP_VERSION_CHECK`
   - `PYTHONDONTWRITEBYTECODE`
   - `PIP_PYTHON_PATH`
   - `PYTHONFINDER_IGNORE_UNSUPPORTED`

Pipenv–specific environment variables:

Debug–specific environment variables:

   - `PATH`: `/home/user/.cargo/bin:/home/user/.local/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin`
   - `SHELL`: `/bin/bash`
   - `LANG`: `C.UTF-8`
   - `PWD`: `/home/user/myproject`

---------------------------

</details>
tokeefe commented 2 years ago

I was seeing this as well. Try creating a Pipfile with something in it that's valid TOML e.g.,

echo '[foo]' > Pipfile