OpenCV import error. Missing config file

Hi,

I’ve just begun moving one of my ML/OpenCV repos to ReplIt to host as a REST API, but am getting errors as soon as I import OpenCV/cv2.

The full error message is:

OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.

I’m not sure if this is a python issue-only, or site-wide for OpenCV usage in general, but appreciate any help or tips I get.

Thanks!

1 Like

Hi @flancast90 thanks for your message and welcome to the community!

Can you share a link to your repl please so users can suggest some ideas?

Currently, the repl is hosting the dev branch of a closed-source tech, so I cannot share it. However, there is really no code issue; the error is thrown on line 3 of the file, which is only “import cv2”

The issue seems to be with how OpenCV-Python is installed. I’ve tried in both Python and Nix repos without success.

hi @flancast90 can you describe how you install OpenCV-Python? Are you using the packages tab or just import cv2 ?

I installed opencv-Python using pip, which is how I first got the issue. I next tried the packages tab, and finally using poetry. All of these gave the error described.

I’ve actually now got it working by forking another OpenCV repl, and adding my code there. Doing more research, I’m thinking the bug was caused since my entry point wasn’t in the project root, so maybe OpenCV had issues with that…

Yeah it’s really weird the example works but fresh Repls don’t. I’ve logged it with support regardless as it shouldn’t be displaying that error.

Glad that you are managing to use a workaround in the meantime!

1 Like

Hi @IanAtReplit - did this issue ever get resolved?

I’m encountering a similar issue with my repl:

https://replit.com/@ChrisChivetta/TextExtractionfromImage#pyproject.toml

Hi @chrisc thanks for your message.

I think the issue is related to the change of Python template. If you fork an older OpenCV project it seems to work - or at least it gets you further into the code before there is an issue.

Try this Repl which is just your code copied into the OpenCV tutorial Repl
https://replit.com/@IanAtReplit/TextExtractionfromImage-Port#main.py

I’ll raise it again as an issue.

A post was split to a new topic: Issue with rembg

hi, when I forked it, it still doesn’t work, I think it broke again…

when will it get solved

still having the issue

still have same error

1 Like

The template did not work for me

What kind of error do you encounter using this template?

1 Like