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

StephanieAlba
Databricks Employee
Databricks Employee

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

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

StephanieAlba
Databricks Employee
Databricks Employee

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

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.