Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: attribute '__default__' of 'typing.TypeVar' objects is not writable #3692

Closed
benjamin5988 opened this issue Nov 22, 2024 · 4 comments · Fixed by #3591
Closed
Labels

Comments

@benjamin5988
Copy link

benjamin5988 commented Nov 22, 2024

What happened?

I am using AutoEIS, which uses impedance.py, which calls altair - the following error happens:


> Traceback (most recent call last):
>   File "/home/bketter/csteis_working/11012024_NA2SO40pt1_FESO40pt001_NpH4_no6/autoeis_runscript_11012024_NA2SO40pt1_FESO40pt001_NpH4_no6.py", line 7, in <module>
>     import autoeis as ae
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/autoeis/__init__.py", line 6, in <module>
>     from .utils import Settings as _Settings
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/autoeis/utils.py", line 46, in <module>
>     from impedance.models.circuits import CustomCircuit
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/impedance/models/circuits/__init__.py", line 2, in <module>
>     from .circuits import *  # noqa: F401, F403
>     ^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/impedance/models/circuits/circuits.py", line 3, in <module>
>     from impedance.visualization import plot_altair, plot_bode, plot_nyquist
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/impedance/visualization.py", line 1, in <module>
>     import altair as alt
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/__init__.py", line 650, in <module>
>     from altair.vegalite import *
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/vegalite/__init__.py", line 2, in <module>
>     from .v5 import *
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/vegalite/v5/__init__.py", line 2, in <module>
>     from altair.expr.core import datum
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/expr/__init__.py", line 7, in <module>
>     from altair.expr.core import ConstExpression, FunctionExpression
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/expr/core.py", line 6, in <module>
>     from altair.utils import SchemaBase
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/utils/__init__.py", line 14, in <module>
>     from .plugin_registry import PluginRegistry
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/altair/utils/plugin_registry.py", line 13, in <module>
>     T = TypeVar("T")
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/typing_extensions.py", line 1418, in __new__
>     _set_default(typevar, default)
>     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
>   File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/typing_extensions.py", line 1375, in _set_default
>     type_param.__default__ = None
>     ^^^^^^^^^^^^^^^^^^^^^^
> AttributeError: attribute '__default__' of 'typing.TypeVar' objects is not writable/

What would you like to happen instead?

I would like altair to import successfully. I am not capable of understanding the issue or articulating it further, but I'm sure this would be very simple for the developers to understand. Pardon the lack of information.

Which version of Altair are you using?

5.4.1

@dangotbanned dangotbanned linked a pull request Nov 22, 2024 that will close this issue
4 tasks
@benjamin5988
Copy link
Author

benjamin5988 commented Nov 22, 2024

downgrading to altair 5.3.0 made the issue go away - i chose this version because it was the version prior to the last release of impedance.py

@jonmmease
Copy link
Contributor

Hi @benjamin5988, what version of Python are you using? There is known incompatibility with Python 3.13. We'll be doing an altair 5.5.0 release that will support Python 3.13 soon.

@dangotbanned
Copy link
Member

dangotbanned commented Nov 23, 2024

Hi @benjamin5988, what version of Python are you using? There is known incompatibility with Python 3.13. We'll be doing an altair 5.5.0 release that will support Python 3.13 soon.

@jonmmease I linked this one in a bit of a rush yesterday after noticing 3.13 in the error output:

  File "/home/bketter/csteis_working/11012024_NA2SO40pt1_FESO40pt001_NpH4_no6/autoeis_runscript_11012024_NA2SO40pt1_FESO40pt001_NpH4_no6.py", line 7, in <module>
    import autoeis as ae
  File "/home/bketter/.conda/envs/csteis_4/lib/python3.13/site-packages/autoeis/__init__.py", line 6, in <module>
```                                            ^^^^^^^^^^

Also the latest version of typing_extensions looks different to the traceback:

https://github.com/python/typing_extensions/blob/b7d63534658b01c3b24e45a34dbf9c38a3ce8ae9/src/typing_extensions.py#L1478-L1480

So my guess is that since the constraint we had set wasn't triggered while updating an environment or another package had a pin for an earlier version:

altair/pyproject.toml

Lines 14 to 18 in 1ad3648

[project]
name = "altair"
authors = [{ name = "Vega-Altair Contributors" }]
dependencies = [
"typing_extensions>=4.10.0; python_version<\"3.13\"",

Either way, 5.5.0 will fix the issue as of

@dangotbanned
Copy link
Member

Closing, following #3699

@benjamin5988 please update to https://github.com/vega/altair/releases/tag/v5.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants