Getting TypeError after upgrading to Python 3.12.0

  1. Are you running your app locally or is it deployed? - App is locally deployed
  2. Share the full text of the error message (not a screenshot).

TypeError Traceback (most recent call last)
c:\Users\ResearchDev\PYTHON\code\Research\WORKING.ipynb Cell 1 line 5
3 import datetime
4 import os
----> 5 import streamlit as st
6 import plotly.graph_objects as go

File c:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\streamlit_init_.py:48
17 “”“Streamlit.
18
19 How to use Streamlit in 3 seconds:
(…)
42 For more detailed info, see https://docs.streamlit.io.
43 “””
45 # IMPORTANT: Prefix with an underscore anything that the user shouldn’t see.
46
47 # Must be at the top, to avoid circular dependency.
—> 48 from streamlit import logger as _logger
49 from streamlit import config as _config
50 from streamlit.deprecation_util import deprecate_func_name as _deprecate_func_name

File c:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\streamlit\logger.py:21
18 import sys
19 from typing import Dict, Union
—> 21 from typing_extensions import Final
23 DEFAULT_LOG_MESSAGE: Final = "%(asctime)s %(levelname) -7s " “%(name)s: %(message)s”
25 # Loggers for each name are saved here.

File c:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\typing_extensions.py:1167
1163 self.default = None
1166 # Add default and infer_variance parameters from PEP 696 and 695
→ 1167 class TypeVar(typing.TypeVar, _DefaultMixin, _root=True):
1168 “”“Type variable.”“”
1170 module = ‘typing’

TypeError: type ‘typing.TypeVar’ is not an acceptable base type
5. Share the Streamlit and Python versions.
streamlit version
Traceback (most recent call last):
File “”, line 198, in run_module_as_main
File “”, line 88, in run_code
File "C:\Users\ResearchDev\PYTHON\venv\Scripts\streamlit.exe_main
.py", line 4, in
File "C:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\streamlit_init
.py", line 48, in
from streamlit import logger as _logger
File “C:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\streamlit\logger.py”, line 21, in
from typing_extensions import Final
File “C:\Users\ResearchDev\PYTHON\venv\Lib\site-packages\typing_extensions.py”, line 1167, in
class TypeVar(typing.TypeVar, _DefaultMixin, _root=True):
TypeError: type ‘typing.TypeVar’ is not an acceptable base type

python --version
Python 3.12.0

Resolved.After rebuilding the venv.
Streamlit, version 1.28.2
Python 3.12.0

1 Like

Glad you found a fix @icalgo! :raised_hands:

Best,
Charly

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.