question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`pipenv check` in a shell script errors from using outdated pip functionality

See original GitHub issue

Be 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
AdnanHodziccommented, Apr 24, 2020

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 of pipenv 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:

pip3 install pipenv

Which addresses this issue in my case.

1reaction
matteiuscommented, Aug 22, 2022

This should be resolved with pipenv==2022.8.19 as we rely exclusively on the vendor’d version of pip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Encountered Pipenv Problems - Read the Docs
This is usually a result of mixing Pipenv with system packages. We strongly recommend installing Pipenv in an isolated environment.
Read more >
Why is pipenv telling me the wrong version of python?
If there is no Pipfile yet, pipenv will create one and set python_version correctly.
Read more >
Common Pipenv Errors
The command pipenv install first attempts to build a virtual environment from the Pipfile. lock. If the Pipfile. lock is unavailable, Pipenv ......
Read more >
pipenv Documentation
The problems that Pipenv seeks to solve are multi-faceted: ... If you experience issues with $ pipenv shell, just check the PIPENV_SHELL environment ......
Read more >
Basic Usage of Pipenv - Python Packaging Authority
Shells are typically misconfigured for subshell use, so $ pipenv shell --fancy may produce unexpected results. If this is the case, try $...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found