Skip to content

Issue running pipenv lock in python 3.6 #4865

Closed
@monkeyman192

Description

Issue description

When running pipenv lock on the latest pipenv version (v2021.11.15) there is an error raised.

Expected result

No error to be raised and pipfile to be locked.

Actual result

PS C:\Users\monkeyman192\AppData\Local\Programs\Python\Python36\test> ../python -m pipenv lock
Locking [dev-packages] dependencies...
 Locking...Building requirements...
Resolving dependencies...
Locking Failed!

Traceback (most recent call last):
  File "C:/Users/monkeyman192/AppData/Local/Programs/Python/Python36/lib/site-packages/pipenv/resolver.py", line 766, in <module>
    main()
  File "C:/Users/monkeyman192/AppData/Local/Programs/Python/Python36/lib/site-packages/pipenv/resolver.py", line 762, in main
    dev=parsed.dev)
  File "C:/Users/monkeyman192/AppData/Local/Programs/Python/Python36/lib/site-packages/pipenv/resolver.py", line 743, in _main
    resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
  File "C:/Users/monkeyman192/AppData/Local/Programs/Python/Python36/lib/site-packages/pipenv/resolver.py", line 711, in resolve_packages
    requirements_dir=requirements_dir,
  File "C:/Users/monkeyman192/AppData/Local/Programs/Python/Python36/lib/site-packages/pipenv/resolver.py", line 693, in resolve
    req_dir=requirements_dir
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 1378, in resolve_deps
    req_dir=req_dir,
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 1100, in actually_resolve_deps
    hashes = resolver.resolve_hashes()
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 974, in resolve_hashes
    self.hashes[ireq] = self.collect_hashes(ireq)
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 959, in collect_hashes
    hashes = self._get_hashes_from_pypi(ireq)
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 917, in _get_hashes_from_pypi
    session = _get_requests_session(self.project.s.PIPENV_MAX_RETRIES)
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 66, in _get_requests_session
    import requests
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\requests\__init__.py", line 48, in <module>
    from pipenv.vendor.charset_normalizer import __version__ as charset_normalizer_version
  File "c:\users\monkeyman192\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\charset_normalizer\__init__.py", line 30, in <module>
    import pipenv.vendor.charset_normalizer.api as CharsetDetector
AttributeError: module 'pipenv.vendor' has no attribute 'charset_normalizer'

Steps to replicate

Just used a very minimal pipfile (contents don't matter, but I have included anyway)

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[pipenv]
allow_prereleases = true

[dev-packages]
flake8 = "*"

[packages]
jsonschema = "==3.2.0"

[requires]
python_version = "3.6"

$ pipenv --support

Pipenv version: '2021.11.15'

Pipenv location: 'C:\\Users\\monkeyman192\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\pipenv'

Python location: 'C:\\Users\\monkeyman192\\AppData\\Local\\Programs\\Python\\Python36\\python.exe'

Python installations found:

  • 3.9.0: C:\Users\monkeyman192\AppData\Local\Programs\Python\Python39\python.exe
  • 3.6.8: C:\Users\monkeyman192\AppData\Local\Programs\Python\Python36\python.exe
  • 2.7.16: C:\Python27\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.8',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.19041',
 'python_full_version': '3.6.8',
 'python_version': '3.6',
 'sys_platform': 'win32'}

System environment variables:

  • ALLUSERSPROFILE
  • APPDATA
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPOSE_CONVERT_WINDOWS_PATHS
  • COMPUTERNAME
  • COMSPEC
  • DRIVERDATA
  • FPS_BROWSER_APP_PROFILE_STRING
  • FPS_BROWSER_USER_PROFILE_STRING
  • HOMEDRIVE
  • HOMEPATH
  • LOCALAPPDATA
  • LOGONSERVER
  • NUMBER_OF_PROCESSORS
  • ONEDRIVE
  • OS
  • PATH
  • PATHEXT
  • PIP_CONFIG_FILE
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PSMODULEPATH
  • PUBLIC
  • SESSIONNAME
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TMP
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • VBOX_INSTALL_PATH
  • VBOX_MSI_INSTALL_PATH
  • WINDIR
  • __PSLOCKDOWNPOLICY
  • 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: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\Oracle\VirtualBox\;C:\Program Files (x86)\WinSCP\;C:\Program Files\nodejs\;C:\Program Files\Amazon\AWSCLIV2\;C:/Hashicorp/Consul;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\monkeyman192\Documents\nomad;;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\monkeyman192\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\monkeyman192\AppData\Local\Programs\Python\Python39\;C:\Users\monkeyman192\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\monkeyman192\AppData\Local\Programs\Python\Python36\;C:\Users\monkeyman192\AppData\Local\Microsoft\WindowsApps;C:\Users\monkeyman192\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\monkeyman192\AppData\Roaming\npm;

Contents of Pipfile ('C:\Users\monkeyman192\AppData\Local\Programs\Python\Python36\test\Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[pipenv]
allow_prereleases = true

[dev-packages]
flake8 = "*"

[packages]
jsonschema = "==3.2.0"

[requires]
python_version = "3.6"

I have debugged and had a dig around and I have found that by reverting a recent change (2d2a0fa#diff-04fedfa48090328a63525cffd8618360182863732a278fb17c4c8d224888de88R30) causes pipenv lock to work again.
I am guessing this break occurs because of a change in python 3.7 (https://bugs.python.org/issue30024)
Also, I notice that while pipenv claims to support python 3.6, the CI build matrix doesn't include 3.6, which is probably why this change slipped through the cracks...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions