Unable to install: FileNotFoundError: [Errno 2] No such file or directory: '' #10684

Open
vitaly-zdanevich opened this Issue Jun 29, 2017 · 3 comments

Comments

Projects
None yet
3 participants
$ sudo pip3 install ipython
The directory '/Users/admin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/admin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ipython
  Downloading ipython-6.1.0-py3-none-any.whl (741kB)
    100% |████████████████████████████████| 747kB 1.5MB/s
Collecting traitlets>=4.2 (from ipython)
  Downloading traitlets-4.3.2-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 5.4MB/s
Collecting appnope; sys_platform == "darwin" (from ipython)
  Downloading appnope-0.1.0-py2.py3-none-any.whl
Collecting jedi>=0.10 (from ipython)
  Downloading jedi-0.10.2-py2.py3-none-any.whl (190kB)
    100% |████████████████████████████████| 194kB 2.9MB/s
Collecting decorator (from ipython)
  Downloading decorator-4.0.11-py2.py3-none-any.whl
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
  Downloading prompt_toolkit-1.0.14-py3-none-any.whl (248kB)
    100% |████████████████████████████████| 256kB 3.2MB/s
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.6/site-packages (from ipython)
Collecting pickleshare (from ipython)
  Downloading pickleshare-0.7.4-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/site-packages (from ipython)
Collecting pygments (from ipython)
  Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 1.4MB/s
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from traitlets>=4.2->ipython)
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
  Downloading wcwidth-0.1.7-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython)
Installing collected packages: decorator, ipython-genutils, traitlets, appnope, jedi, wcwidth, prompt-toolkit, pickleshare, simplegeneric, pygments, ipython
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''

macOS

Owner

Carreau commented Jun 29, 2017

sudo pip3 install ipython

You should avoid installing things with sudo, if you are doing that you may inadvertently affect system packages (or brew packages) which will screw up thing in hard to revert ways. Prefer the use --user if you don't have permission to write in some place. That's already heavily hinted by the error message present at the top:

The directory '/Users/admin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/admin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

from the traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)

You can clearly see that IPython is not involved, al the errors are coming from pip (that takes a it of use reading tracebacks). So I would suggest upgrading pip. And checking individual packages:

Installing collected packages: decorator, ipython-genutils, traitlets, appnope, jedi, wcwidth, prompt-toolkit, pickleshare, simplegeneric, pygments

To figure out which one is failing. Though I strongly feel this is due from (mis)-using sudo.

Ok, thank you for answer, I chmoded directories and installed collected packages one-by-one withour errors and tried to upgrade pip3 (the same current version 9.0.1) but now during install without sudo I see

Collecting ipython
  Using cached ipython-6.1.0-py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/site-packages (from ipython)
Collecting traitlets>=4.2 (from ipython)
  Using cached traitlets-4.3.2-py2.py3-none-any.whl
Collecting pickleshare (from ipython)
  Using cached pickleshare-0.7.4-py2.py3-none-any.whl
Collecting appnope; sys_platform == "darwin" (from ipython)
  Using cached appnope-0.1.0-py2.py3-none-any.whl
Collecting jedi>=0.10 (from ipython)
  Using cached jedi-0.10.2-py2.py3-none-any.whl
Collecting decorator (from ipython)
  Using cached decorator-4.0.11-py2.py3-none-any.whl
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
  Using cached prompt_toolkit-1.0.14-py3-none-any.whl
Collecting pygments (from ipython)
  Using cached Pygments-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.6/site-packages (from ipython)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython)
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from traitlets>=4.2->ipython)
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
  Using cached wcwidth-0.1.7-py2.py3-none-any.whl
Installing collected packages: simplegeneric, ipython-genutils, decorator, traitlets, pickleshare, appnope, jedi, wcwidth, prompt-toolkit, pygments, ipython
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
Owner

Carreau commented Jun 30, 2017

I'm afraid I don't know enough of the pip internals to know what's going on. I would try something aggressive like:

$ pip --verbose install --verbose --no-deps --no-cache ipython --force-reinstall --upgrade

And also ask on pip bug tracker. But you having to sudo-chmod with homebrew is a really bad sign that something is wrong with your system. I would likely run a brew doctor and/or nuke my brew python install then reinstall python3. Usually with Python and/or brew if you have to use sudo then something is deeply wrong and things are only going to get worse with time.

takluyver added this to the not ipython milestone Jul 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment