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