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.

2021.11.5.post0, ubuntu 20.04: pipenv broken

See original GitHub issue

On Ubuntu the pip version is… special. In a way that breaks the new pipenv release:

$ pipenv lock
/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
Creating a Pipfile for this project...
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/cli/command.py", line 322, in lock
    ensure_project(
  File "/usr/local/lib/python3.9/dist-packages/pipenv/core.py", line 560, in ensure_project
    ensure_pipfile(
  File "/usr/local/lib/python3.9/dist-packages/pipenv/core.py", line 269, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/project.py", line 710, in create_pipfile
    from .vendor.pip_shims.shims import InstallCommand
ImportError: cannot import name 'InstallCommand' from 'pipenv.vendor.pip_shims.shims' (/usr/local/lib/python3.9/dist-packages/pipenv/vendor/pip_shims/shims.py)

On our CI environment, we run pipenv lock [--dev-only] --requirements which breaks in a similar manner, loading the shim for Link; the end of that traceback looks like this:

  File "/usr/local/lib/python3.9/dist-packages/pipenv/core.py", line 1255, in do_init
    do_install_dependencies(
  File "/usr/local/lib/python3.9/dist-packages/pipenv/core.py", line 790, in do_install_dependencies
    deps_list = list(lockfile.get_requirements(dev=dev, only=dev_only))
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 275, in get_requirements
    yield Requirement.from_pipfile(k, v)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2745, in from_pipfile
    r = FileRequirement.from_pipfile(name, pipfile)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1794, in from_pipfile
    link_info = cls.get_link_from_line(uri)
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1551, in get_link_from_line
    link = create_link(
  File "/usr/local/lib/python3.9/dist-packages/pipenv/vendor/requirementslib/models/utils.py", line 120, in create_link
    return Link(link)
TypeError: 'NoneType' object is not callable

Up until version 2021.5.29, things were working without issue.

Steps to replicate

I can reproduce the issue the easiest in a docker container; the following commands pull Ubuntu 20.04 and install python 3.9 from deadsnakes. It’ll ask to set up a timezone in the process:

docker run --rm -it ubuntu:20.04 /bin/bash
apt update
apt install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt update
apt install -y python3.9 python3.9-distutils python3-pip
python3.9 -m pip install pipenv

This sets you up with:

# python3.9 -m pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.9)
# pipenv --version
/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
pipenv, version 2021.11.5.post0

and running pipenv lock at that point raises the exception.


$ pipenv --support

Pipenv version: '2021.11.5.post0'

Pipenv location: '/usr/local/lib/python3.9/dist-packages/pipenv'

Python location: '/usr/bin/python3.9'

Python installations found:

  • 3.9.7: /usr/bin/python3.9
  • 3.9.7: /bin/python3.9
  • 3.8.10: /usr/bin/python3.8
  • 3.8.10: /usr/bin/python3
  • 3.8.10: /bin/python3.8
  • 3.8.10: /bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.9.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.10.47-linuxkit',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Sat Jul 3 21:51:47 UTC 2021',
 'python_full_version': '3.9.7',
 'python_version': '3.9',
 'sys_platform': 'linux'}

System environment variables:

  • HOSTNAME
  • PWD
  • HOME
  • LS_COLORS
  • TERM
  • SHLVL
  • PATH
  • _
  • LC_CTYPE
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • PWD: /

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
mjpieterscommented, Nov 6, 2021

Also of note: the RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version! output only appears with this version of pipenv; it is gone when downgrading to 2021.5.29.

2reactions
frostmingcommented, Nov 9, 2021

Fixed by 4d1df95

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compare Packages Between Distributions - DistroWatch.com
Complete summaries of the Gentoo Linux and ArcoLinux projects are available. Note: In case where multiple versions of a package are shipped with...
Read more >
2021-December.txt - Python mailing list
I will reply back when it's finished and post the code so you can see ... hp > I have build an executable...
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