Skip to content

Silently fails to install pip when pwd does not exist #1074

@moser

Description

@moser

I just had weird problem which cost me about a day to figur out.
Actually, it is two problems

Here are the steps to reproduce and some version info:

~/tmp
[13:22:55] $ mkdir haha-i-will-be-deleted

~/tmp
[13:23:26] $ cd haha-i-will-be-deleted 

~/tmp/haha-i-will-be-deleted
[13:25:03] $ rm -r `pwd`

~/tmp/haha-i-will-be-deleted
[13:25:08] $ python3 -m venv ~/tmp/foo                                                                                                                                                                                                                                          

~/tmp/haha-i-will-be-deleted
[13:25:35] $ ls ../foo/bin 
activate  activate.csh  activate.fish  python  python3

~/tmp/haha-i-will-be-deleted
[13:25:39] $ cd ..

~/tmp
[13:25:44] $ python3 -m venv ~/tmp/bar

~/tmp
[13:25:49] $ ls bar/bin 
activate  activate.csh  activate.fish  easy_install  easy_install-3.5  pip  pip3  pip3.5  python  python3

~/tmp
[13:25:51] $ python3 --version
Python 3.5.2

~/tmp
[13:27:22] $ dpkg -l | grep python3.5
grep: Warnung: GREP_OPTIONS sind veraltet. Bitte benutzen Sie ein Alias oder ein Skript
ii  libpython3.5:amd64                          3.5.2-2ubuntu0~16.04.1                        amd64        Shared Python runtime library (version 3.5)
ii  libpython3.5-dev:amd64                      3.5.2-2ubuntu0~16.04.1                        amd64        Header files and a static library for Python (v3.5)
ii  libpython3.5-minimal:amd64                  3.5.2-2ubuntu0~16.04.1                        amd64        Minimal subset of the Python language (version 3.5)
ii  libpython3.5-stdlib:amd64                   3.5.2-2ubuntu0~16.04.1                        amd64        Interactive high-level object-oriented language (standard library, version 3.5)
ii  python3.5                                   3.5.2-2ubuntu0~16.04.1                        amd64        Interactive high-level object-oriented language (version 3.5)
ii  python3.5-dev                               3.5.2-2ubuntu0~16.04.1                        amd64        Header files and a static library for Python (v3.5)
ii  python3.5-minimal                           3.5.2-2ubuntu0~16.04.1                        amd64        Minimal subset of the Python language (version 3.5)
ii  python3.5-venv                              3.5.2-2ubuntu0~16.04.1                        amd64        Interactive high-level object-oriented language (pyvenv binary, version 3.5)

I assume that this is actually a problem with ensurepip:

# continuing the example above
~/tmp
[13:38:57] $ cd haha-i-will-be-deleted 

~/tmp/haha-i-will-be-deleted
[13:38:59] $ rm -r `pwd`

~/tmp/haha-i-will-be-deleted
[13:39:55] $ source ../foo/bin/activate

(foo) 
~/tmp/haha-i-will-be-deleted
[13:40:13] $ python3 -Im ensurepip --upgrade --default-pip
sh: 0: getcwd() failed: No such file or directory
Ignoring indexes: https://pypi.python.org/simple
Exception:
Traceback (most recent call last):
  File "/tmp/tmpcr219yu4/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/tmp/tmpcr219yu4/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 305, in run
    wheel_cache
  File "/tmp/tmpcr219yu4/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 270, in populate_requirement_set
    wheel_cache=wheel_cache
  File "/tmp/tmpcr219yu4/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 178, in from_line
    path = os.path.normpath(os.path.abspath(name))
  File "/usr/lib/python3.5/posixpath.py", line 361, in abspath
    cwd = os.getcwd()
FileNotFoundError: [Errno 2] Datei oder Verzeichnis nicht gefunden

(foo) 
~/tmp/haha-i-will-be-deleted
[13:40:16] $ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions