cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

ImportError: cannot import name 'override' from 'typing_extensions'

Carl_B
New Contributor II

Hello,

I'm facing an ImportError when trying to run my OpenAI-based summarization script in.

The error message is:
ImportError: cannot import name 'override' from 'typing_extensions' (/databricks/python/lib/python3.10/site-packages/typing_extensions.py)

This error is created when I run a simple line of code:

import openai
 
#openai #typing_extensions 




1 REPLY 1

mark_ott
Databricks Employee
Databricks Employee

This error is caused by a version mismatch between the OpenAI Python package and the typing_extensions library in your Databricks environment. The 'override' symbol is relatively new and only exists in typing_extensions version 4.5.0 and above; some environments (including Databricks) may still have an older version installed by default, even after installing or updating openai.โ€‹

How to Fix

  • Upgrade typing_extensions directly in your Databricks cluster using:

    text
    %pip install --upgrade typing_extensions

    or, if you want to ensure a specific compatible version:

    text
    %pip install typing_extensions==4.7.1
  • After upgrading, restart your Python kernel (or your Databricks notebook cluster) for the change to take effect.โ€‹

Notes

  • This issue is common in cloud notebook environments, where library management can lag behind current package requirements.

  • If you have done this already and still encounter the issue, force reinstall with:

    text
    %pip install --force-reinstall typing_extensions

These steps should resolve your ImportError so you can use the latest OpenAI package without issue.โ€‹

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now