-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Issue description
When using PIPENV_PIPFILE that points to another location on the filesystem, running a pipenv check
command immediately before a pipenv install
seems to pollute some global scope (I'm totally guessing here), which prevents the install from doing anything. Instead of installing packages, it winds up just installing 0/0 packages. If I instead run the pipenv install
and then run pipenv check
, then the install proceeds correctly.
I thought this might be related to #3585 so I manually changed the file to put the normalized path of PIPENV_PIPFILE back into the environment variable, but that still didn't resolve this issue.
Expected result
I expect the install to pull down packages from pypi and put them into the venv.
Actual result
The venv created does not have the requested package. You'll also notice it (in my opinion) incorrectly creates a Pipfile inside of my working directory, even though I've specified a different path via PIPENV_PIPFILE, but it appears that #2661 already exists to discuss that.
Steps to replicate
I created the following Makefile in an empty directory (/tmp/test on a Mac):
PIPENV_VENV_IN_PROJECT=1
clean:
rm -rf ./subdir/foo/.venv && \
rm ./Pipfile || true
failing:
PIPENV_PIPFILE=subdir/foo/Pipfile \
PIPENV_VENV_IN_PROJECT=$(PIPENV_VENV_IN_PROJECT) \
pipenv check && \
pipenv install --skip-lock --verbose
working:
PIPENV_PIPFILE=subdir/foo/Pipfile \
PIPENV_VENV_IN_PROJECT=$(PIPENV_VENV_IN_PROJECT) \
pipenv install --skip-lock && \
pipenv check
And then I ran mkdir -p subdir/foo
and placed the following contents into subdir/foo/Pipfile:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
colorama = "*"
[requires]
python_version = "3.6"
Run the failing target and notice that it installs zero packages:
➜ ls -a
. .. Makefile subdir
➜ make failing
PIPENV_PIPFILE=subdir/foo/Pipfile \
PIPENV_VENV_IN_PROJECT=1 \
pipenv check && \
pipenv install --skip-lock --verbose
Creating a virtualenv for this project…
Pipfile: /private/tmp/test/subdir/foo/Pipfile
Using /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (3.6.8) to create virtualenv…
⠏ Creating virtual environment...Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /private/tmp/test/subdir/foo/.venv/bin/python3
Also creating executable in /private/tmp/test/subdir/foo/.venv/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
✔ Successfully created virtual environment!
Virtualenv location: /private/tmp/test/subdir/foo/.venv
Checking PEP 508 requirements…
Passed!
Checking installed package safety…
All good!
Creating a Pipfile for this project…
Installing dependencies from Pipfile…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
➜ ls -a
. .. Makefile Pipfile subdir
➜ ls -a subdir/foo/.venv/lib/python3.6/site-packages
. easy_install.py pkg_resources wheel
.. pip setuptools wheel-0.33.1.dist-info
__pycache__ pip-19.0.3.dist-info setuptools-41.0.0.dist-info
And now here is output from the subsequent clean and run of the working target. Notice that this time it does install the colorama package:
➜ make clean
rm -rf ./subdir/foo/.venv && \
rm ./Pipfile || true
➜ ls -a
. .. Makefile subdir
➜ make working
PIPENV_PIPFILE=subdir/foo/Pipfile \
PIPENV_VENV_IN_PROJECT=1 \
pipenv install --skip-lock && \
pipenv check
Creating a virtualenv for this project…
Pipfile: /private/tmp/test/subdir/foo/Pipfile
Using /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (3.6.8) to create virtualenv…
⠧ Creating virtual environment...Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /private/tmp/test/subdir/foo/.venv/bin/python3
Also creating executable in /private/tmp/test/subdir/foo/.venv/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
✔ Successfully created virtual environment!
Virtualenv location: /private/tmp/test/subdir/foo/.venv
Installing dependencies from Pipfile…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Creating a Pipfile for this project…
Checking PEP 508 requirements…
Passed!
Checking installed package safety…
All good!
➜ ls -a
. .. Makefile Pipfile subdir
➜ ls -a subdir/foo/.venv/lib/python3.6/site-packages
. colorama-0.4.1.dist-info pkg_resources wheel-0.33.1.dist-info
.. easy_install.py setuptools
__pycache__ pip setuptools-41.0.0.dist-info
colorama pip-19.0.3.dist-info wheel
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv'
Python location: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6'
Python installations found:
3.6.8
:/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
3.6.8
:/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m
2.7.10
:/usr/bin/python
2.7.10
:/usr/bin/pythonw
2.7.10
:/usr/bin/python2.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.8',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '18.2.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST '
'2018; root:xnu-4903.241.1~1/RELEASE_X86_64',
'python_full_version': '3.6.8',
'python_version': '3.6',
'sys_platform': 'darwin'}
System environment variables:
TERM_SESSION_ID
SSH_AUTH_SOCK
Apple_PubSub_Socket_Render
COLORFGBG
ITERM_PROFILE
XPC_FLAGS
LANG
PWD
SHELL
SECURITYSESSIONID
TERM_PROGRAM_VERSION
TERM_PROGRAM
PATH
COLORTERM
COMMAND_MODE
TERM
HOME
TMPDIR
USER
XPC_SERVICE_NAME
LOGNAME
__CF_USER_TEXT_ENCODING
ITERM_SESSION_ID
SHLVL
OLDPWD
ZSH
PAGER
LESS
LC_CTYPE
LSCOLORS
NVM_DIR
NVM_CD_FLAGS
NVM_BIN
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/Users/lebron/.nvm/versions/node/v10.15.0/bin:/usr/local/opt/mysql@5.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/lebron/Library/Python/3.6/bin
SHELL
:/bin/zsh
LANG
:en_US.UTF-8
PWD
:/tmp/test
Contents of Pipfile
('/private/tmp/test/Pipfile'):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.7"