Skip to content

2021.11.5.post0, ubuntu 20.04: pipenv broken #4833

Closed
@mjpieters

Description

@mjpieters

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: /

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions