Traceback (most recent call last): File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\tut2.py", line 8, in <module>
import imutils
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\imutils\__init__.py", line 8, in <module>
from .convenience import translate
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\imutils\convenience.py", line 6, in <module>
import cv2
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\cv2\__init__.py", line 181, in <module>
bootstrap()
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
File "C:\Program Files\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\tut2.py", line 8, in <module>
import imutils
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\imutils\__init__.py", line 8, in <module>
from .convenience import translate
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\imutils\convenience.py", line 6, in <module>
import cv2
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\cv2\__init__.py", line 181, in <module>
bootstrap()
File "C:\Users\mohit\OneDrive\Desktop\Front End\Flask\pythonProject1\.venv\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.
I was trying to make a flask app that uses cv2 and imutils libraries of python in Pycharm. But there seems to be a problem in Pycharm.
The error seems to be on the lines of import statement :
import imutils
import cv2
I watched a tutorial online about how to download cv2 and imutils , but even after downloading there seems to be a problem.
The error is about the upgraded version of Numpy which I don't understand why it is happening , as I am not using Numpy.
Still I upgraded the version of Numpy but It does not work. I have tried multiple things the people have suggested but nothing is working I think i am not sure how to make a docker.
The problem can be something related to Pycharm. I am not sure.
Try using:
pip uninstall numpy
pip install numpy==1.26.4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With