`pipenv check` in a shell script errors from using outdated pip functionality
See original GitHub issueBe sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.
Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.
Make sure to mention your debugging experience if the documented solution failed.
Issue description
pipenv check works fine until I run it in a shell script. Then I get an error:
pipenv install
pipenv check
# ...
An error occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/__main__.py", line 8, in <module>
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/click/core.py", line 722, in __call__
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/click/core.py", line 697, in main
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/click/core.py", line 1066, in invoke
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/click/core.py", line 895, in invoke
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/click/core.py", line 535, in invoke
File "/usr/lib/python3/dist-packages/pipenv/patched/safety.zip/safety/cli.py", line 52, in check
AttributeError: module 'pip' has no attribute 'get_installed_distributions'
Note that this is a healthy environment – my Python code runs fine. It seems like for some reason pipenv is using a very old and no-longer-existing pip function which was removed starting in pip 10. But only when I’m running in a shell script, which is strange because the environment is the same.
Expected result
pip check
succeeds`
Actual result
See above
Steps to replicate
Pipfile:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
appdirs = "==1.4.3"
astroid = "==2.3.2"
attrs = "==19.1.0"
black = "==19.3b0"
boto3 = "==1.10.2"
botocore = "==1.13.2"
cachetools = "==3.1.1"
certifi = "==2019.6.16"
chardet = "==3.0.4"
click = "==7.0"
docutils = "==0.15.2"
google-api-core = "==1.14.3"
google-auth = "==1.6.3"
google-auth-oauthlib = "==0.4.0"
google-cloud-bigquery = "==1.15.0"
google-cloud-core = "==1.0.2"
google-cloud-kms = "==1.2.1"
google-resumable-media = "==0.3.2"
googleapis-common-protos = "==1.6.0"
grpc-google-iam-v1 = "==0.12.3"
grpcio = "==1.25.0"
idna = "==2.8"
isort = "==4.3.21"
jmespath = "==0.9.4"
lazy-object-proxy = "==1.4.2"
mccabe = "==0.6.1"
numpy = "==1.16.4"
oauthlib = "==3.0.1"
pandas = "==0.24.2"
pandas-gbq = "==0.10.0"
protobuf = "==3.8.0"
pyarrow = "==0.13.0"
pyasn1 = "==0.4.5"
pyasn1-modules = "==0.2.5"
pydata-google-auth = "==0.1.3"
pylint = "==2.4.3"
python-dateutil = "==2.8.0"
pytz = "==2019.1"
requests = "==2.22.0"
requests-oauthlib = "==1.2.0"
rsa = "==4.0"
s3transfer = "==0.2.1"
six = "==1.12.0"
toml = "==0.10.0"
typed-ast = "==1.4.0"
urllib3 = "==1.25.3"
wrapt = "==1.11.2"
PyYAML = "==5.2"
# We need to use this (very) old version of pip as pipenv uses an old pip function which no longer exists.
# See https://github.com/Miserlou/Zappa/issues/1471
pip = "*"
[requires]
python_version = "3.7"
code:
if [ ! -d env ]; then
python3 -m venv env
fi
source env/bin/activate
pipenv install
pipenv check
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
Please run $ pipenv --support
, and paste the results here. Don’t put backticks (`
) around it! The output already contains Markdown formatting.
Error: no such option: --support
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top GitHub Comments
I have this same problem on Ubuntu 20.04 while I don’t have this problem on MacBook.
To state the obvious, problem is old
pipenv
version. As latest available version ofpipenv
in Debian/Ubuntu repositories is too old:11.9.0-1
.Hence I would suggest you change preferable install method on Debian/Ubuntu from
sudo apt install pipenv
in pipenv Installation section to:Which addresses this issue in my case.
This should be resolved with
pipenv==2022.8.19
as we rely exclusively on the vendor’d version ofpip
.