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.

pip 19.x --upgrade breaks on nfs

See original GitHub issue

Environment

  • pip version: 19.x
  • Python version: 2.7, 3.6
  • OS: Linux

Description pip19 uses AdjacentTempDirectory, where previous pip versions used tempfile. Because of nfs “silly rename”, if working on an nfs mount and pip is called via a subprocess from a python script that happens to use one of the packages being upgraded, pip fails when trying to cleanup (since the C extensions are still mapped to interpreter – can be seen in /proc/$PID/maps)

Expected behavior

Expect this either to not fail (as in previous versions of pip) or just raise more appropriate exception. Right now, this causes pip to enter this error handler (that seems to be designed for windows). chmod’ing the path to 200 works for Windows, but is not enough to delete on Linux. The chmod done here ultimately causes pip to raise Permission Error. Maybe that should be chmod to stat.S_IRWXU?

How to Reproduce

in some nfs location, install simplejson (or anything that uses a C extension)

python3.6 -m virtualenv env
source env/bin/activate
pip install simplejson==3.16.0

then import it, and call pip in a subprocess

import subprocess
import sys

import simplejson  # <-- causes this to break


INSTALL_COMMAND = [
    sys.executable,
    "-m",
    "pip",
    "install",
    "--disable-pip-version-check",
    "--upgrade",
    "--force-reinstall",
    "simplejson==3.16.0",
]
print("return code:", subprocess.Popen(INSTALL_COMMAND).wait())

You can also run the script interactively and see the mapped files. I saved above code as ‘mini.py’

$ python -i mini.py &
# wait for the pip process to finish
$ cat /proc/$!/maps | grep nfs
# will show the .nfs* files

Output

Looking in indexes: https://...
Collecting simplejson==3.16.0
Installing collected packages: simplejson
  Found existing installation: simplejson 3.16.0
    Uninstalling simplejson-3.16.0:
      Successfully uninstalled simplejson-3.16.0
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'env/lib/python3.6/site-packages/~implejson'
Consider using the `--user` option or check the permissions.

return code: 1

Taking a look at that location:

$ ls env/lib/python3.6/site-packages/~implejson
ls: cannot open directory 'env/lib/python3.6/site-packages/~implejson': Permission denied
$ chmod 700 env/lib/python3.6/site-packages/~implejson
$ ls -a env/lib/python3.6/site-packages/~implejson
.  ..  .nfsxxxxxxxxxxxxxxxxxxxxxxxx  # <-- some nfs silly-renamed file
Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:23 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
kottmastcommented, Jan 18, 2020

I think I’m hitting this issue, but I’m confused about the affected version and/or I’m hitting something related. I’m on an ubuntu machine, with nfs mounted /home and trying to create a conda environment from a environment.yml file. The conda part of the installation works, but pip fails on version 19.3.1 with the .nfsxxx device or resource is busy error. I tried downgrading to several previous versions of pip, but it then produces the “directory is not empty” error. Has this ever worked? Is there some workaround available?

1reaction
cjerdonekcommented, Mar 11, 2019

This looks like the same as issue #6321 which was recently filed, but this issue has more information. Thanks a lot for the detailed report and analysis, @ntextreme3!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug in pip version 19.0 breaks builds fix by downgrading to ...
pip v19.0 appears to have a bug that doesn't install packages such as flask & pyinstaller. I have found a work around which...
Read more >
Pip's uninstall temporary directories are left in site-packages ...
Use tasks to break down this issue into smaller parts. ... "pip 19.x --upgrade breaks on nfs" - https://github.com/pypa/pip/issues/6327.
Read more >
flufl.lock - PyPI
The flufl.lock library provides an NFS-safe file-based locking algorithm influenced by the GNU/Linux open(2) manpage, under the description of the O_EXCL ...
Read more >
What's New - Oracle Linux Yum Server
supermin-5.1.19-10.module+el8.7.0+20887+b7d2050a - Tool for creating supermin ... rust-freetype-0.7.0-5.el9 - Bindings for Freetype used by Servo (Update) ...
Read more >
OpenBSD Upgrade Guide: 7.0 to 7.1
You may also have issues with DNS resolution during the first reboot, so PF rules and NFS mounts dependent upon DNS may cause...
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