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.

vendored version of six.py in pypi wheel breaks newer versions of pip

See original GitHub issue

The wheel that gets installed when you say pip install pysmt replaces the global version of six:

$ python -c 'import six; print(six, six.__version__)'
<module 'six' from '/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/six.py'> 1.14.0                                                                                                            
$ pip install pysmt
Collecting pysmt                                                                                                                                                                                           
  Using cached PySMT-0.9.0-py2.py3-none-any.whl (317 kB)                                                                                                                                                   
Requirement already satisfied: six in /home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages (from pysmt) (1.14.0)                                                                                    
Installing collected packages: pysmt                                                                 
Successfully installed pysmt-0.9.0                                                                   
$ python -c 'import six; print(six, six.__version__)'
<module 'six' from '/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/six.py'> 1.10.0 

This breaks newer versions of pypi, which depend on six>=1.11:

$ pip install sqlalchemy
Traceback (most recent call last):
  File "/home/audrey/.virtualenvs/angr3/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
    from pip._internal.operations.prepare import RequirementPreparer
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 16, in <module>
    from pip._internal.distributions import (
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py", line 2, in <module>
    from pip._internal.distributions.wheel import WheelDistribution
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py", line 5, in <module>
    from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel
  File "/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/pip/_internal/utils/wheel.py", line 12, in <module>
    from pip._vendor.six import PY2, ensure_str
ImportError: cannot import name 'ensure_str' from 'six' (/home/audrey/.virtualenvs/angr3/lib/python3.8/site-packages/six.py)

(it looks like there is an additional bug in that pip’s “vendored” import of six is in fact importing the global version, but that’s a problem for another day)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcogariocommented, May 28, 2022

I published a stable version 0.9.5 that includes this fix.

0reactions
Scherlaccommented, May 6, 2022

Symptom for me was:

from azure.mgmt.datafactory import DataFactoryManagementClient
...
  File "/opt/pipvenv/lib/python3.7/site-packages/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py", line 29, in <module>
    class AvroCompressionCodec(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
  File "/usr/local/lib/python3.7/enum.py", line 135, in __prepare__
    member_type, first_enum = metacls._get_mixins_(bases)
  File "/usr/local/lib/python3.7/enum.py", line 472, in _get_mixins_
    raise TypeError("new enumerations should be created as "
TypeError: new enumerations should be created as `EnumName([mixin_type, ...] [data_type,] enum_type)`

Read more comments on GitHub >

github_iconTop Results From Across the Web

`pip install --upgrade pip` breaks pip · Issue #26900 - GitHub
Following the instructions to brew python, I've upgraded pip and setuptools. After that, pip is broken because the pip binaries require the old...
Read more >
How to install pip on Python 2.7 in 2021 - Stack Overflow
If you're running a version < 2.7.9 and you cannot upgrade to a newer version of Python then your only option is to...
Read more >
Changelog - pip documentation v22.3.1
Fix a bug causing pip to not select a wheel compiled against an OSX SDK later than what Python itself was compiled against...
Read more >
How to install, download and build Python wheels - ActiveState
Make sure Wheel and the latest version of setuptools is installed on your system by running: python -m pip install -U wheel setuptools...
Read more >
pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
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