pipenv
pipenv copied to clipboard
Pipenv fails to install a package when non-existent env variables are used in package URL on windows
Issue description
As mentioned in the documentation, you may inject credentials into the URL of a package as environment variables. But in case these variables do not exist, the user is not prompted for username and password, but instead the operation fails with authentication error. The problem occurred on windows 10 host with Python 3.8.6-64-bit and pipenv 2020.11.15.
Expected result
Non-existent env variables should be replaced with empty strings and a request to https://:@github.com/myaccount/myproject.git would pop-up a window asking the user to provide the username and password.
Actual result
Package installation fails with authentication failure:
>py -3.8-64 -m pipenv install -e "git+https://${GITHUB_USER}:${GITHUB_PASS}@github.com/myaccount/myproject.git#egg=myproject"
Creating a virtualenv for this project...
Pipfile: C:\Users\****\Documents\workspace\tmp\Pipfile
Using C:/Users/****/AppData/Local/Programs/Python/Python38/python.exe (3.8.6) to create virtualenv...
[= ] Creating virtual environment...created virtual environment CPython3.8.6.final.0-64 in 1062ms
creator CPython3Windows(dest=C:\Users\****\.virtualenvs\tmp-mTB5Vxym, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\****\AppData\Local\pypa\virtualenv)
added seed packages: pip==21.0.1, setuptools==54.1.2, wheel==0.36.2
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Successfully created virtual environment!
Virtualenv location: C:\Users\****\.virtualenvs\tmp-mTB5Vxym
Creating a Pipfile for this project...
Installing -e git+https://${GITHUB_USER}:${GITHUB_PASS}@github.com/myaccount/myproject.git#egg=myproject...
Error: An error occurred while installing -e git+https://${GITHUB_USER}:${GITHUB_PASS}@github.com/myaccount/myproject.git#egg=myproject!
Error text: Obtaining myproject from git+https://%24%7BGITHUB_USER%7D:****@github.com/myaccount/myproject.git#egg=myproject (from -r c:\users\****\appdata\local\temp\pipenv-kzakn_kw-requirements\pipenv-8cxdhqus-requirement.txt (line 1))
Cloning https://%24%7BGITHUB_USER%7D:****@github.com/myaccount/myproject.git to c:\users\****\.virtualenvs\tmp-mtb5vxym\src\myproject
Running command git clone -q 'https://%24%7BGITHUB_USER%7D:****@github.com/myaccount/myproject.git' 'C:\Users\****\.virtualenvs\tmp-mTB5Vxym\src\myproject'
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/myaccount/myproject.git/'
WARNING: Discarding git+https://%24%7BGITHUB_USER%7D:****@github.com/myaccount/myproject.git#egg=myproject. Command errored out with exit status 128: git clone -q 'https://%24%7BGITHUB_USER%7D:****@github.com/myaccount/myproject.git' 'C:\Users\****\.virtualenvs\tmp-mTB5Vxym\src\myproject' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement myproject (unavailable)
ERROR: No matching distribution found for myproject (unavailable)
Installation Failed
Steps to replicate
On Windows with the env variables GITHUB_USER and GITHUB_PASS unset, run the following on an empty project:
>py -3.8-64 -m pipenv install -e "git+https://${GITHUB_USER}:${GITHUB_PASS}@github.com/myaccount/myproject.git#egg=myproject"
$ pipenv --support
Pipenv version: '2020.11.15'
Pipenv location: 'C:\\Users\\****\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\pipenv'
Python location: 'C:\\Users\\****\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'
Python installations found:
3.8.6:C:\Users\****\AppData\Local\Programs\Python\Python38\python.exe3.7.0:C:\Program Files\Python37\python.exe3.7.0:C:\Python37-32\python.exe2.7.6:C:\Python27\python.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.8.6',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.17763',
'python_full_version': '3.8.6',
'python_version': '3.8',
'sys_platform': 'win32'}
System environment variables:
ALLUSERSPROFILEAPPDATACHOCOLATEYINSTALLCHOCOLATEYLASTPATHUPDATECOMMONPROGRAMFILESCOMMONPROGRAMFILES(X86)COMMONPROGRAMW6432COMPUTERNAMECOMSPECDRIVERDATAGIT_LFS_PATHGROOVY_HOMEHOMEDRIVEHOMEPATHINTELLIJ IDEA COMMUNITY EDITIONLM_LICENSE_FILELOCALAPPDATALOGONSERVERNUMBER_OF_PROCESSORSONEDRIVEONEDRIVECOMMERCIALOSPATHPATHEXTPIPENV_MAX_DEPTHPROCESSOR_ARCHITECTUREPROCESSOR_IDENTIFIERPROCESSOR_LEVELPROCESSOR_REVISIONPROG27B48B2C054PROGRAMDATAPROGRAMFILESPROGRAMFILES(X86)PROGRAMW6432PROMPTPSMODULEPATHPUBLICPYCHARM EDUQT_DEVICE_PIXEL_RATIOREPSSESSIONNAMESYSTEMDRIVESYSTEMROOTTEMPTMPUATDATAUSERDNSDOMAINUSERDOMAINUSERDOMAIN_ROAMINGPROFILEUSERNAMEUSERPROFILEVBOX_MSI_INSTALL_PATHVS110COMNTOOLSVS120COMNTOOLSVS140COMNTOOLSWINDIRPIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_SHIMS_BASE_MODULEPIP_PYTHON_PATHPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_MAX_DEPTH:5
Debug–specific environment variables:
Contents of Pipfile ('C:\Users\****\Documents\workspace\tmp\Pipfile'):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.8"
@souris4science Have you tried with pipenv==2022.1.8? I expect it might be the same because subprocesses are used in the install and locking process, so I am not sure it is viable to popup a UI prompting you for your username and PW
@matteius I gave it a try today and the problem still occurs with pipenv==2022.1.8.