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.

Python 2.7 Compatibility

See original GitHub issue

Hey folks,

It looks like I’m unable to import altair and I think it may be related to my version of python. I’m stuck using legacy python (python 2.7), and whenever I try and import it I get the following error:

TypeError: 'ellipsis' object is not iterable

I can appreciate that I should be using python 3 but that isn’t an option here. My question is, is this error unique to my python version? and if so what version of altair should I roll back to for the time being?

altair v2.3.0 py27_1001 conda-forge

ipython trace:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-43bef06448fc> in <module>()
----> 1 import altair as alt

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/__init__.py in <module>()
      2 __version__ = '2.3.0'
      3
----> 4 from .vegalite import *
      5 from . import examples
      6

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/vegalite/__init__.py in <module>()
      1 # flake8: noqa
----> 2 from .v2 import *

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/vegalite/v2/__init__.py in <module>()
      1 # flake8: noqa
      2 from .schema import *
----> 3 from .api import *
      4
      5 from ...datasets import (

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/vegalite/v2/api.py in <module>()
     13 from .data import data_transformers, pipe
     14 from ... import utils, expr
---> 15 from .display import renderers, VEGALITE_VERSION, VEGAEMBED_VERSION, VEGA_VERSION
     16 from .theme import themes
     17

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/vegalite/v2/display.py in <module>()
      2
      3 from ...utils.mimebundle import spec_to_mimebundle
----> 4 from ..display import Displayable
      5 from ..display import default_renderer_base
      6 from ..display import json_renderer_base

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/vegalite/display.py in <module>()
----> 1 from ..utils.display import Displayable, default_renderer_base, json_renderer_base
      2 from ..utils.display import RendererRegistry, HTMLRenderer
      3
      4
      5 __all__ = (

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/altair/utils/display.py in <module>()
     17
     18
---> 19 class RendererRegistry(PluginRegistry[RendererType]):
     20     entrypoint_err_messages = {
     21         'notebook': textwrap.dedent(

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/typing.pyc in __getitem__(self, params)
   1040                     "Too %s parameters for %s; actual %s, expected %s" %
   1041                     ("many" if alen > elen else "few", repr(self), alen, elen))
-> 1042             tvars = _type_vars(params)
   1043             args = params
   1044         return self.__class__(self.__name__,

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/typing.pyc in _type_vars(types)
    277 def _type_vars(types):
    278     tvars = []
--> 279     _get_type_vars(types, tvars)
    280     return tuple(tvars)
    281

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/typing.pyc in _get_type_vars(types, tvars)
    272     for t in types:
    273         if isinstance(t, TypingMeta):
--> 274             t._get_type_vars(tvars)
    275
    276

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/typing.pyc in _get_type_vars(self, tvars)
    800     def _get_type_vars(self, tvars):
    801         if self.__args__:
--> 802             _get_type_vars(self.__args__, tvars)
    803
    804     def _eval_type(self, globalns, localns):

/locus/home/nazamy/test_env/miniconda3/envs/clin_ifx/lib/python2.7/site-packages/typing.pyc in _get_type_vars(types, tvars)
    270
    271 def _get_type_vars(types, tvars):
--> 272     for t in types:
    273         if isinstance(t, TypingMeta):
    274             t._get_type_vars(tvars)

TypeError: 'ellipsis' object is not iterable```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jakevdpcommented, Jan 31, 2019

To prevent this in the future, we should require typing>=3.6 in requirements.txt.

1reaction
jakevdpcommented, Jan 31, 2019

I can reproduce the error with typing version 3.5.2 on python 2.7.15. If you upgrade the package to a newer version, I think it should fix your problem:

$ python -m pip install -U typing
Read more comments on GitHub >

github_iconTop Results From Across the Web

Porting Python 2 Code to Python 3 — Python 3.11.1 ...
Another way to help port your code is to use a static type checker like mypy or pytype on your code. These tools...
Read more >
Cheat Sheet: Writing Python 2-3 compatible code
This notebook shows you idioms for writing future-proof code that is compatible with both versions of Python: 2 and 3. It accompanies Ed...
Read more >
Python 2.7 support table for most popular Python packages
This site shows Python 2.7 support for the 360 most downloaded packages on PyPI: 208 green packages (57.8%) have dropped support for Python...
Read more >
Best way to write Python 2 and 3 compatible code using ...
I would recommend writing for py2 or py3 in your projects's modules, but not mix them together and not include any sort of...
Read more >
Supporting Python 2 and 3 without 2to3 conversion
Python 2.7 has some small improvements on Python 3 compatibility, but it's likely that if you want to run the same code under...
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