cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

Issues importing mediapipe TypeError: 'numpy._DTypeMeta' object is not subscriptable

StephanieRivera
Valued Contributor II
Valued Contributor II

TypeError: 'numpy._DTypeMeta' object is not subscriptable

Screenshot 2023-08-16 at 8.10.59 AM.png

Screenshot 2023-08-16 at 7.38.45 AM.png

I have tried upgrading pip and installing newer and older versions of NumPy.

Screenshot 2023-08-16 at 7.39.06 AM.png

1 ACCEPTED SOLUTION

Accepted Solutions

StephanieRivera
Valued Contributor II
Valued Contributor II

Turns out that detaching and reattaching the notebook from the cluster does not do it. My journey is detailed here https://stackoverflow.com/a/76923874/1290485

TLDR; With notebook-scoped libraries, use 

dbutils.library.restartPython() 

numpy==1.23 works.

View solution in original post

5 REPLIES 5

Jenny123456
New Contributor II

Got the same issue. Tried to install numpy 1.19.3 but got below errors:
ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

Kaniz
Community Manager
Community Manager

Hi @Jenny123456 , The error you're encountering might be due to a number of reasons such as:

• A problem with your Python or pip installation.
• A problem with the numpy package itself.
• A problem with the build tools on your system. You may want to try updating your Python and pip to the latest version, or possibly try installing numpy in a virtual environment. However, without more specific information or context, it's difficult to provide an exact solution. 

Kaniz
Community Manager
Community Manager

Hi @StephanieRiveraIf you encounter any issues after upgrading or modifying packages, you can reset the environment by detaching and re-attaching the notebook or restarting the cluster.

StephanieRivera
Valued Contributor II
Valued Contributor II

Turns out that detaching and reattaching the notebook from the cluster does not do it. My journey is detailed here https://stackoverflow.com/a/76923874/1290485

TLDR; With notebook-scoped libraries, use 

dbutils.library.restartPython() 

numpy==1.23 works.

madengr00
New Contributor II

I ran into the same issue.  Before installing OpenCV I was on Numpy 1.21.5 in my notebook.  After upgrading to 1.23, the error went away for me.  

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.