Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHONPATH can break editable packages #4261

Closed
asmodehn opened this issue Feb 1, 2017 · 1 comment
Closed

PYTHONPATH can break editable packages #4261

asmodehn opened this issue Feb 1, 2017 · 1 comment
Labels
auto-locked Outdated issues that have been locked by automation project: setuptools Related to setuptools

Comments

@asmodehn
Copy link

asmodehn commented Feb 1, 2017

  • Pip version: 9.0.1
  • Python version: 2.7
  • Operating system: Ubuntu 14.04

Description:

When installing packages as --editable, pip add their path to <prefix>/lib/python2.7/site-packages/easy-install.pth.
So installing multiple package means we get one line per package in that file.

However if a package path is listed in PYTHONPATH, that line in easy-install.pth is removed.

Is this expected ?
I had naively assumed that PYTHONPATH shouldn't affect how installing a packages can hide others, only how they are found...

What I've run:

alexv@AlexV-Linux:~$ mkdir tmptest
alexv@AlexV-Linux:~$ cd tmptest/

alexv@AlexV-Linux:~/tmptest$ git clone https://github.com/mitsuhiko/flask.git
Cloning into 'flask'...
remote: Counting objects: 12959, done.
remote: Total 12959 (delta 0), reused 0 (delta 0), pack-reused 12959
Receiving objects: 100% (12959/12959), 3.70 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (8957/8957), done.
Checking connectivity... done.

alexv@AlexV-Linux:~/tmptest$ git clone https://github.com/kennethreitz/requests
Cloning into 'requests'...
remote: Counting objects: 19087, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 19087 (delta 0), reused 0 (delta 0), pack-reused 19083
Receiving objects: 100% (19087/19087), 7.89 MiB | 2.60 MiB/s, done.
Resolving deltas: 100% (12467/12467), done.
Checking connectivity... done.

alexv@AlexV-Linux:~/tmptest$ mkvirtualenv tmptest
New python executable in /home/alexv/.virtualenvs/tmptest/bin/python
Installing setuptools, pip, wheel...done.

(tmptest) alexv@AlexV-Linux:~/tmptest$ pip --version
pip 9.0.1 from /home/alexv/.virtualenvs/tmptest/local/lib/python2.7/site-packages (python 2.7)

(tmptest) alexv@AlexV-Linux:~/tmptest$ export PYTHONPATH=`pwd`/flask
(tmptest) alexv@AlexV-Linux:~/tmptest$ echo $PYTHONPATH 
/home/alexv/tmptest/flask

(tmptest) alexv@AlexV-Linux:~/tmptest$ pip install -e flask
Obtaining file:///home/alexv/tmptest/flask
Collecting Werkzeug>=0.7 (from Flask==0.13.dev0)
/home/alexv/.virtualenvs/tmptest/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/alexv/.virtualenvs/tmptest/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached Werkzeug-0.11.15-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from Flask==0.13.dev0)
  Using cached Jinja2-2.9.5-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from Flask==0.13.dev0)
Collecting click>=2.0 (from Flask==0.13.dev0)
  Using cached click-6.7-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.13.dev0)
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, click, Flask
  Running setup.py develop for Flask
Successfully installed Flask Jinja2-2.9.5 MarkupSafe-0.23 Werkzeug-0.11.15 click-6.7 itsdangerous-0.24

(tmptest) alexv@AlexV-Linux:~/tmptest$ cat ~/.virtualenvs/tmptest/lib/python2.7/site-packages/easy-install.pth 
/home/alexv/tmptest/flask

(tmptest) alexv@AlexV-Linux:~/tmptest$ pip install -e requests
Obtaining file:///home/alexv/tmptest/requests
Installing collected packages: requests
  Running setup.py develop for requests
Successfully installed requests

(tmptest) alexv@AlexV-Linux:~/tmptest$ cat ~/.virtualenvs/tmptest/lib/python2.7/site-packages/easy-install.pth 
/home/alexv/tmptest/requests

I was expecting :

(tmptest) alexv@AlexV-Linux:~/tmptest$ cat ~/.virtualenvs/tmptest/lib/python2.7/site-packages/easy-install.pth 
/home/alexv/tmptest/flask
/home/alexv/tmptest/requests

which is the case when PYTHONPATH is empty.

@dstufft
Copy link
Member

dstufft commented Mar 31, 2017

I'm going to close this, easy-install.pth is managed by setuptools so any issues with it would need to be reported on their tracker.

@dstufft dstufft closed this as completed Mar 31, 2017
@xavfernandez xavfernandez added the project: setuptools Related to setuptools label Apr 2, 2017
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation project: setuptools Related to setuptools
Projects
None yet
Development

No branches or pull requests

3 participants