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.

BlobServiceClient ImportError: cannot import name 'ParamSpec' from 'typing_extensions'

See original GitHub issue
  • Package Name: azure.storage.blob
  • Package Version: 12.10.0
  • Operating System: Azure Databricks Cluster, DataBricks Runtime 10.3 ML
  • Python Version: 3.8

Describe the bug An ImportError from typing_extensions package shows up when I run from azure.storage.blob import BlobServiceClient. I run the commands from a Notebook inside the Azure Databricks cluster.

To Reproduce Steps to reproduce the behavior:

  1. start up a VM with Python3.8 and create a new notebook.
  2. create a new cell and run ! pip3 install azure-storage-blob
  3. create a new cell and run from azure.storage.blob import BlobServiceClient

Expected behavior Be able to import and use the package without any import errors from typing_extensions or any other dependent package.

Screenshots Adding some screenshots of the stack trace

image image

Additional context I fixed the problem in one notebook by doing

%rm -r /databricks/python3/lib/python3.8/site-packages/typing_extensions-4.1.1.dist-info /databricks/python3/lib/python3.8/site-packages/typing_extensions.py

This did not work on a second notebook where I tried it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
solidcloudiocommented, Nov 22, 2022

That seems to have resolved it. I can’t call reload(typing_extensions) or it seems to reset some things. But, it is loading the azure python and pip packages now… awesome! Thank you!!

1reaction
kristapraticocommented, Apr 25, 2022

@xiaoyongzhu moving the chat from the PR to this issue:

@kristapratico seems this PR introduces some import issue in databricks ML runtime (see this issue: linkedin/feathr#154). Also seems like ParamSpec is added in 3.10 (https://docs.python.org/3/library/typing.html#typing.ParamSpec) so maybe we should also have a way to relax this limitation?

And can be repoduced by this (in databricks ML 10.2): !pip install azure-core==1.23.1 from azure.core.tracing.decorator import distributed_trace

and will throw out this error:


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<command-3599966980702568> in <module>
----> 1 from azure.core.tracing.decorator import distributed_trace

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
    160             # Import the desired module. If you’re seeing this while debugging a failed import,
    161             # look at preceding stack frames for relevant error information.
--> 162             original_result = python_builtin_import(name, globals, locals, fromlist, level)
    163 
    164             is_root_import = thread_local._nest_level == 1

/databricks/python/lib/python3.8/site-packages/azure/core/tracing/decorator.py in <module>
     29 
     30 from typing import Callable, Any, TypeVar, overload
---> 31 from typing_extensions import ParamSpec
     32 from .common import change_context, get_function_and_class_name
     33 from ..settings import settings

ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (/databricks/python/lib/python3.8/site-packages/typing_extensions.py)

@xiaoyongzhu thanks for bringing to my attention, as it is still an issue I’m going to re-open this. Can you provide more details on how to set up your Databricks environment? I had previously tried to repro this error in a Databricks notebook with no luck (see above). Are you running this in a notebook? Also which version of typing-extensions is getting installed?

typing.ParamSpec was added in Python 3.10, but typing-extensions should backport it to as early as 3.6 (looks like you’re using 3.8). While this import works outside of Databricks, I’ll need to investigate why it’s a problem in the Databricks runtime and follow up with the service team.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import name 'ParamSpec' from 'typing_extensions'
The "ImportError: cannot import name 'ParamSpec' from 'typing_extensions'" occurs when we have an outdated version of the typing-extensions ...
Read more >
No Module named 'typing_extensions' 'from azure.storage ...
I have installed and uninstalled azure.storage.blob multiple times, but this error persist. I have also tried installing typing-extensions ...
Read more >
cannot import name 'paramspec' from 'typing_extensions ...
Describe the bug An ImportError from typing_extensions package shows up when I run from azure.storage.blob import BlobServiceClient . I run the commands from...
Read more >
ImportError: cannot import name 'ParamSpec' from ... - Ray
Hello. I'm having a bit of trouble getting the cluster to work on Azure. The cluster is created successfully and I can attach...
Read more >
PIP library won't load in 2021.1.2 - NVIDIA Developer Forums
... 14:42:42 [Error] [omni.ext.impl.custom_importer] Failed to import python module myplugin.test.ext. Error: cannot import name 'ParamSpec' ...
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