I am deploying my project, while deploying i am facing an error called import cv2

Please take a moment to search the forum and documentation before posting a new topic.
If you’re creating a debugging post, please include the following info:

My GitHub repository link : GitHub - Nadeem94858/banana-ripeness-detector: Smart Banana Ripeness Detector: Analyzes uploaded images to classify ripeness (Unripe, Ripe, Overripe) and predict estimated harvest days. Built with Python, OpenCV, and Streamlit. Features a custom HSV calibration logic that ensures accurate results despite common camera color inconsistencies.

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File “/mount/src/banana-ripeness-detector/app.py”, line 2, in

import cv2

Requirement.txt file :

numpy==2.3.5

opencv_contrib_python==4.8.0.76

opencv_python==4.12.0.88

streamlit==1.51.0

it looks like you have some dependency issues. opencv-python==4.12.0.88 depends on numpy>=2,<2.3.0 so is incompatible with numpy=2.3.5

You might try upgrading your dependencies, or using a package manager like UV to make sure everything is compatible. if you install opencv-python it will automatically downgrade numpy to a compatible version. Streamlit will read dependencies from the uv.lock file and pyproject.toml that are automatically generated by UV. You don’t need requirements.txt anymore so you can remove it if you like.

Really, the solution here is to just let UV sort it out for you.