Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EnvironmentError [Errno 39] "Directory not empty" while pip installing or updating a package in python3

Tags:

python

pip

Posting both Q & A here as there wasn't a post on SO for this kind of error yet, and other links on web-search led to unresolved gihub issues. Here is me just updating a package in my virtual python environment:

(py36) $ pip install tornado -U
Collecting tornado
  Downloading https://files.pythonhosted.org/packages/03/3f/5f89d99fca3c0100c8cede4f53f660b126d39e0d6a1e943e95cc3ed386fb/tornado-6.0.2.tar.gz (481kB)
    100% |████████████████████████████████| 491kB 476kB/s 
Building wheels for collected packages: tornado
  Building wheel for tornado (setup.py) ... done
  Stored in directory: /home/nikhil/.cache/pip/wheels/61/7e/7a/5e02e60dc329aef32ecf70e0425319ee7e2198c3a7cf98b4a2
Successfully built tornado
Installing collected packages: tornado
  Found existing installation: tornado 5.1.1
    Uninstalling tornado-5.1.1:
      Successfully uninstalled tornado-5.1.1
Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '/mnt/STUFF/py36/lib/python3.6/site-packages/~ornado'

So how to get around this?

like image 647
Nikhil VJ Avatar asked Nov 06 '22 18:11

Nikhil VJ


1 Answers

Checking the actual folder highlighted in the error message:

/mnt/STUFF/py36/lib/python3.6/site-packages/~ornado

I found that there was another one of those .fuse-hidden... files sitting there which is typically while I'm using Geany (text editor) in my folders during its runtime, which then disappear after I've saved by files and I refresh my folder. Somehow such a file got created here as well and never got removed. Note that this might be my OS's fault and not Geany's - IDK. Anyways I removed the file myself and ran the upgrade command and no errors this time.

like image 151
Nikhil VJ Avatar answered Nov 13 '22 18:11

Nikhil VJ