Opencv suddenly has importError

I’ve suddenly started getting errors with opencv when I run my Repl. Here’s the log

  File "/home/runner/Flixr-Subtitles/", line 4, in <module>
    from funcs import *
  File "/home/runner/Flixr-Subtitles/", line 5, in <module>
    import cv2 as cv
ImportError: cannot open shared object file: No such file or directory

This was not an issue prior to a couple of weeks ago.

I noticed this template from @NuclearPasta0:

Have already got these settings in place on my Repl and still get the error. Was there a change to system level packages that caused this issue maybe?

Hello, it seems that replit recently fixed a bug that previously necessitated a workaround, and now the defunct workaround is causing problems.

I have updated my template to fix this, and also saved some storage by only using the nix package. Please try the template now, or copy the .replit configuration to your repl.


This worked great for a few days until today/yesterday when it seems Replit may have made another update and I get a new error (without me having updated anything)

Traceback (most recent call last):
  File "/home/runner/Flixr-Creative-Server/", line 1, in <module>
    import functools, os, cv2, openai, urllib.request, random, time
ImportError: /nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/ version `GLIBC_2.38' not found (required by /nix/store/4ww0ykrgvp0syh8za5131ncy08h9gcbc-opencv-4.7.0/lib/python3.10/site-packages/

Hello, I have updated my template to fix this strange new bug.
It is just one modification:
change the channel variable in .replit to any channel below 23.11 (so, preferably 23.05, "stable-23_05").

I am not entirely sure what has changed to cause this error.
The error does not occur when running program from the shell (or equivalently, using a run variable in .replit file).
I suspect something changes with the builtin library paths. In replit, there are many nix packages provided by default (from REPLIT_LD_LIBRARY_PATH), such as glibc. The glibc version or even path inside this library path does not change, however.

(Please mark a post as solution if it has solved your problem.)


Interestingly, using stable-23_11 works today. They must have fixed something overnight.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.