libGL.so.1: cannot open shared object file: No such file or directory

when i run my py script i get below error,
Please help

~/automate$ python main.py 
TgCrypto is missing! Pyrogram will work the same, but at a much slower speed. More info: https://docs.pyrogram.org/topics/speedups
Traceback (most recent call last):
  File "/home/runner/automate/main.py", line 16, in <module>
    from forward import user
  File "/home/runner/automate/forward.py", line 21, in <module>
    from cv2 import imread
  File "/home/runner/automate/.pythonlibs/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/runner/automate/.pythonlibs/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Hey, @abhisheklodha13! Welcome to the forums!

Running OpenCV requires some extra configuration. Because of this, the staff have released a template that has everything configured and OpenCV installed here: https://replit.com/@scottatreplit/Python-OpenCV?v=1

after using this template, I get below error

TgCrypto is missing! Pyrogram will work the same, but at a much slower speed. More info: https://docs.pyrogram.org/topics/speedups
Traceback (most recent call last):
  File "main.py", line 16, in <module>
    from forward import user
  File "/home/runner/Python-OpenCV/forward.py", line 89
    match message.media:
          ^
SyntaxError: invalid syntax

is this available in python > 3.10 my changed need python > 3.10

Hello,

Running OpenCV requires some extra configuration. Because of this, staff have released a template, but it is probably outdated, so I made another:
https://replit.com/@NuclearPasta0/OpenCV-Python

It has python 3.10.11

1 Like

is there anything else i need to do to install specific packages, i have installed pyrogram but it says module missing

~/OpenCV-Python$ pip install pyrogram
Collecting pyrogram
  Downloading Pyrogram-2.0.106-py3-none-any.whl (3.6 MB)
     |████████████████████████████████| 3.6 MB 2.8 MB/s 
Collecting pysocks==1.7.1
  Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Collecting pyaes==1.6.1
  Downloading pyaes-1.6.1.tar.gz (28 kB)
Using legacy 'setup.py install' for pyaes, since package 'wheel' is not installed.
Installing collected packages: pysocks, pyaes, pyrogram
    Running setup.py install for pyaes ... done
Successfully installed pyaes-1.6.1 pyrogram-2.0.106 pysocks-1.7.1
~/OpenCV-Python$ source /home/runner/OpenCV-Python/virtualenv/bin/activate^C
~/OpenCV-Python$ python main.py 
Traceback (most recent call last):
  File "/home/runner/OpenCV-Python/main.py", line 6, in <module>
    from pyrogram import Client, filters, idle
ModuleNotFoundError: No module named 'pyrogram'

Try using poetry add pyrogram instead of pip.

I am able to install using pip successully but when i run my app it says not found.

when i run poetry add pyrogram it gives me below error

~/OpenCV-Python-1$ poetry add pyrogram
Using version ^2.0.106 for pyrogram

Updating dependencies
Resolving dependencies... (0.0s)

The current project's Python requirement (>=3.10.0) is not compatible with some of the required packages Python requirement:
  - pyrogram requires Python ~=3.7, so it will not be satisfied for Python >=4.0

Because no versions of pyrogram match >2.0.106,<3.0.0
 and pyrogram (2.0.106) requires Python ~=3.7, pyrogram is forbidden.
So, because python-template depends on pyrogram (^2.0.106), version solving failed.

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
    
    For pyrogram, a possible solution would be to set the `python` property to ">=3.10.0,<4.0"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

Could you go to the pyproject.toml and chamge the python property to ">=3.10.0,<4.0" as suggested by the error above?

done that but and than did poetry add pyrogram but still getting same error

~/OpenCV-Python-1$ poetry add pyrogram
Using version ^2.0.106 for pyrogram

Updating dependencies
Resolving dependencies... (18.6s)

Package operations: 3 installs, 0 updates, 0 removals

  • Installing pyaes (1.6.1)
  • Installing pysocks (1.7.1)
  • Installing pyrogram (2.0.106)

Writing lock file
~/OpenCV-Python-1$ python main.py 
Traceback (most recent call last):
  File "/home/runner/OpenCV-Python-1/main.py", line 6, in <module>
    from pyrogram import Client, filters, idle
ModuleNotFoundError: No module named 'pyrogram'

https://replit.com/@abhisheklodha13/OpenCV-Python-1 this is the repl, if you can please check. The same thing works in my local like a charm

Try entering upm add pyrogram in the Shell.
Then, go to poetry.lock and press CTRL+F to search and search pyrogram and see if it exists.
Then, go to Tools > System Dependencies and search pyrogram. Install the second one and see if it works.

I tried above but still same error. is it possible for you to check, i have given you the access

I have tried a few things, none seem to help. Sorry.

Could you share a public fork of the repl?

Given you the access

Can you check if .pythonlibs/lib contains pyrogram?

Okay, I’m looking at the repl and it seems that your PYTHONPATH environment variable has been corrupted somehow and is missing the .pythonlibs/... path.
This could have been caused by using pip, possibly.

I’m not entirely sure how this happened. I’ve seen it before though. (Got any ideas?)

The bandaid solution is to explicitly add the path in the configuration.

Show hidden files, open .replit file and add this anywhere near the bottom (if the [env] section already exists, just add the variable):

[env]
PYTHONPATH = "${HOME}/${REPL_SLUG}/.pythonlibs/lib/python3.10/site-packages:${PYTHONPATH}"

Refresh. Now, packages should be correctly imported.

Possibly related PYTHONPATH problem topics (cause still unknown):
Pytorch on replit
Error installing dependencies
ModuleNotFoundError: No module named 'flask' (unsolved)

it resolved earlier error but now when i run python main.py it throws this error

File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/sewar/full_ref.py", line 3, in <module>
    from scipy import signal
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/__init__.py", line 189, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/signal/__init__.py", line 311, in <module>
    from . import _sigtools, windows
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/signal/windows/__init__.py", line 42, in <module>
    from ._windows import *
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/signal/windows/_windows.py", line 7, in <module>
    from scipy import linalg, special, fft as sp_fft
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/__init__.py", line 189, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/linalg/__init__.py", line 225, in <module>
    from ._sketches import *
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/linalg/_sketches.py", line 9, in <module>
    from scipy.sparse import csc_matrix
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/sparse/__init__.py", line 274, in <module>
    from ._csr import *
  File "/home/runner/OpenCV-Python-1/.pythonlibs/lib/python3.10/site-packages/scipy/sparse/_csr.py", line 11, in <module>
    from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory