-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
auto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automation
Description
Environment
- pip version: 19.0.3
- Python version: 3.7.4
- OS: Linux
Description
When user = true is set in pip config file, pip is installing to ~/.local/lib/python3.7/site-packages when inside a virtual environment
Expected behavior
pip install to the virtual environment site-packages directory
How to Reproduce
I have attached a Dockerfile below, when running docker build --no-cache ., we can see pip correctly installs packages into the virtualenv when there's no config, but installs packages into ~/.local/lib/python3.7/site-packages with a config file, despite being inside of a virtualenv.
FROM python:3.7.4-stretch
RUN useradd --create-home jenkins
USER jenkins
WORKDIR /home/jenkins
ENV PATH $PATH:/home/jenkins/.local/bin
RUN python -m venv venv
RUN (. venv/bin/activate; which pip; pip install -U pip)
RUN (. venv/bin/activate; which pip; pip install requests)
RUN ls ~/.local/lib/python3.7/site-packages || true
USER root
RUN echo "[global]\nuser = true" > /etc/pip.conf
USER jenkins
RUN (. venv/bin/activate; which pip; pip install -U ipython)
RUN ls ~/.local/lib/python3.7/site-packages
Output
Sending build context to Docker daemon 2.048kB
Step 1/14 : From python:3.7.4-stretch
---> b9d77e48a75c
Step 2/14 : RUN useradd --create-home jenkins
---> Using cache
---> c6030228c860
Step 3/14 : USER jenkins
---> Using cache
---> 91dbed0a1cd3
Step 4/14 : WORKDIR /home/jenkins
---> Using cache
---> 32eeea86e3cd
Step 5/14 : ENV PATH $PATH:/home/jenkins/.local/bin
---> Using cache
---> 334f586845f4
Step 6/14 : RUN python -m venv venv
---> Using cache
---> a62d19d72b1d
Step 7/14 : RUN (. venv/bin/activate; which pip; pip install -U pip)
---> Using cache
---> bca3a04b6389
Step 8/14 : RUN (. venv/bin/activate; which pip; pip install requests)
---> Running in 3a701fa1ffc6
/home/jenkins/venv/bin/pip
Collecting requests
Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting idna<2.9,>=2.5 (from requests)
Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
Collecting certifi>=2017.4.17 (from requests)
Downloading https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl (154kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)
Downloading https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl (125kB)
Installing collected packages: chardet, idna, certifi, urllib3, requests
Successfully installed certifi-2019.9.11 chardet-3.0.4 idna-2.8 requests-2.22.0 urllib3-1.25.6
Removing intermediate container 3a701fa1ffc6
---> 860fea68f0c0
Step 9/14 : RUN ls ~/.local/lib/python3.7/site-packages || true
---> Running in 34713cb003a0
ls: cannot access '/home/jenkins/.local/lib/python3.7/site-packages': No such file or directory
Removing intermediate container 34713cb003a0
---> f20074719388
Step 10/14 : USER root
---> Running in a5159340e018
Removing intermediate container a5159340e018
---> b57da5e5b7b5
Step 11/14 : RUN echo "[global]\nuser = true" > /etc/pip.conf
---> Running in d121a8f757a8
Removing intermediate container d121a8f757a8
---> b198d482a177
Step 12/14 : USER jenkins
---> Running in dc1d886916b3
Removing intermediate container dc1d886916b3
---> ca3a6e15f487
Step 13/14 : RUN (. venv/bin/activate; which pip; pip install -U ipython)
---> Running in 855608a0d89a
/home/jenkins/venv/bin/pip
Collecting ipython
Downloading https://files.pythonhosted.org/packages/fb/44/f28a13852e562af719f9de1761680a84a93e8b4c50e22d00d68f60ee2e8b/ipython-7.8.0-py3-none-any.whl (775kB)
Collecting decorator (from ipython)
Downloading https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Collecting backcall (from ipython)
Downloading https://files.pythonhosted.org/packages/84/71/c8ca4f5bb1e08401b916c68003acf0a0655df935d74d93bf3f3364b310e0/backcall-0.1.0.tar.gz
Collecting pickleshare (from ipython)
Downloading https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython)
Downloading https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl (75kB)
Collecting pygments (from ipython)
Downloading https://files.pythonhosted.org/packages/5c/73/1dfa428150e3ccb0fa3e68db406e5be48698f2a979ccbcec795f28f44048/Pygments-2.4.2-py2.py3-none-any.whl (883kB)
Requirement already satisfied, skipping upgrade: setuptools>=18.5 in ./venv/lib/python3.7/site-packages (from ipython) (40.8.0)
Collecting jedi>=0.10 (from ipython)
Downloading https://files.pythonhosted.org/packages/55/54/da994f359e4e7da4776a200e76dbc85ba5fc319eefc22e33d55296d95a1d/jedi-0.15.1-py2.py3-none-any.whl (1.0MB)
Collecting pexpect; sys_platform != "win32" (from ipython)
Downloading https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl (58kB)
Collecting prompt-toolkit<2.1.0,>=2.0.0 (from ipython)
Downloading https://files.pythonhosted.org/packages/87/61/2dfea88583d5454e3a64f9308a686071d58d59a55db638268a6413e1eb6d/prompt_toolkit-2.0.10-py3-none-any.whl (340kB)
Collecting six (from traitlets>=4.2->ipython)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython)
Downloading https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting parso>=0.5.0 (from jedi>=0.10->ipython)
Downloading https://files.pythonhosted.org/packages/a3/bd/bf4e5bd01d79906e5b945a7af033154da49fd2b0d5b5c705a21330323305/parso-0.5.1-py2.py3-none-any.whl (95kB)
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython)
Downloading https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->ipython)
Downloading https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Installing collected packages: decorator, backcall, pickleshare, six, ipython-genutils, traitlets, pygments, parso, jedi, ptyprocess, pexpect,wcwidth, prompt-toolkit, ipython
Running setup.py install for backcall: started
Running setup.py install for backcall: finished with status 'done'
Successfully installed backcall-0.1.0 decorator-4.4.0 ipython-7.8.0 ipython-genutils-0.2.0 jedi-0.15.1 parso-0.5.1 pexpect-4.7.0 pickleshare-0.7.5 prompt-toolkit-2.0.10 ptyprocess-0.6.0 pygments-2.4.2 six-1.12.0 traitlets-4.3.3 wcwidth-0.1.7
Removing intermediate container 855608a0d89a
---> e5e5558a6e05
Step 14/14 : RUN ls ~/.local/lib/python3.7/site-packages
---> Running in 69913aea160d
IPython
Pygments-2.4.2.dist-info
__pycache__
backcall
backcall-0.1.0-py3.7.egg-info
decorator-4.4.0.dist-info
decorator.py
ipython-7.8.0.dist-info
ipython_genutils
ipython_genutils-0.2.0.dist-info
jedi
jedi-0.15.1.dist-info
parso
parso-0.5.1.dist-info
pexpect
pexpect-4.7.0.dist-info
pickleshare-0.7.5.dist-info
pickleshare.py
prompt_toolkit
prompt_toolkit-2.0.10.dist-info
ptyprocess
ptyprocess-0.6.0.dist-info
pygments
six-1.12.0.dist-info
six.py
traitlets
traitlets-4.3.3.dist-info
wcwidth
wcwidth-0.1.7.dist-info
Removing intermediate container 69913aea160d
---> db4c4336649a
Successfully built db4c4336649a
Metadata
Metadata
Assignees
Labels
auto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automation