pypa/pip

--user option broken? (when using relative path for PYTHONUSERBASE)

Closed this issue · 10 comments

PYTHONUSERBASE=py-env pip install --user Flask fails with:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 241, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/site-packages/pip/req.py", line 1298, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pip/req.py", line 663, in install
    f = open(os.path.join(egg_info_dir, 'installed-files.txt'), 'w')
IOError: [Errno 2] No such file or directory: 'py-env/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg-info/installed-files.txt'

py-env/lib/python2.7/site-packages/ is empty so normally it can't create installed-files.txt when it didn't even create the .egg-info directory yet.

Versions are:

$ pip --version
pip 1.4.1 from /usr/lib/python2.7/site-packages (python 2.7)

$ python -c 'import setuptools; print setuptools.__version__'
0.9.8

the relative py-env path for PYTHONUSERBASE is the problem here.
just using python setup.py install --user directly (i.e. what pip does internally), I wasn't able to get it to work either.
not sure that PYTHONUSERBASE supports relative path names.

afaik it did work previously ... but if it's documented to not work, that's ok too

hmm, I'll check some older pips and see.

PEP 370 and/or what distutils does could also be checked.

I cannot reproduce this, it appears that the issue was not a pip issue to begin with and I'm assuming that at some point in the last 3 years, whoever's issue this actually was has solved it for us.

happens still for me

$ PYTHONUSERBASE=py-env pip install --user Flask
Collecting Flask
  Using cached Flask-0.12-py2.py3-none-any.whl
Collecting Werkzeug>=0.7 (from Flask)
  Downloading Werkzeug-0.12.1-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 1.8MB/s 
Requirement already satisfied: Jinja2>=2.4 in /usr/lib/python3.6/site-packages (from Flask)
Collecting itsdangerous>=0.21 (from Flask)
  Using cached itsdangerous-0.24.tar.gz
Collecting click>=2.0 (from Flask)
  Using cached click-6.7-py2.py3-none-any.whl
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python3.6/site-packages (from Jinja2>=2.4->Flask)
Installing collected packages: Werkzeug, itsdangerous, click, Flask
  Running setup.py install for itsdangerous ... done
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 922, in install
    with open(inst_files_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'py-env/lib/python3.6/site-packages/itsdangerous-0.24-py3.6.egg-info/installed-files.txt'
$ pip --version
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
$ python -c 'import setuptools; print(setuptools.__version__)'
34.3.2

What operating system?

ArchLinux … setuptools and pip are installed from package, but should be vanilla (and I don't see anything suspicious in the PKGBUILDs)

This should be fixed by #4495?

@dstufft Since #4495 is merged, can this be closed now?