This may be a very noobish question but I did my best to research it and I’m stuck. I have not used a lot of Python in my life.
I’m on MacOs Ventura (14.6) and I’m trying to run dvr-scan. When I invoke dvr-scan it fails with:
File “/Users/patrickmcclanahan/Library/Application Support/pipx/venvs/dvr-scan/lib/python3.12/site-packages/dvr_scan/opencv_loader.py”, line 34, in <module>
raise ModuleNotFoundError(
ModuleNotFoundError: OpenCV could not be found, try installing opencv-python:
However, running that install command says that cv is installed already. So I went into the specific file being run (opencv_loader.py). It has these commands:
import importlib
import importlib.util
import os
[snip]
# OpenCV is a required package, but we don’t have it as an explicit dependency since we
# need to support both opencv-python and opencv-python-headless. Include some additional
# context with the exception if this is the case.
if not importlib.util.find_spec(“cv2”):
raise ModuleNotFoundError(
“OpenCV could not be found, try installing opencv-python:nnpip install opencv-python”,
name=”cv2″,
)
So that looks like the part that’s failing. But when I do this from the command line:
python3
: import importlib
: import importlib.util
: importlib.util.find_spec(“cv2”)
.. it runs correctly!
>>> importlib.util.find_spec(“cv2”)
ModuleSpec(name=’cv2′, loader=<_frozen_importlib_external.SourceFileLoader object at 0x104ec51c0>, origin=’/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2/__init__.py’, submodule_search_locations=[‘/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2’])
So it looks, to my untrained eyes, like importlib.util is working when I invoke it directly in python3 via the command line but failing when called indirectly via dvr-scan during its startup. Is there something that could cause this? Environment variable differences?
submitted by /u/wild_b_cat
[link] [comments]
r/learnpython This may be a very noobish question but I did my best to research it and I’m stuck. I have not used a lot of Python in my life. I’m on MacOs Ventura (14.6) and I’m trying to run dvr-scan. When I invoke dvr-scan it fails with: File “/Users/patrickmcclanahan/Library/Application Support/pipx/venvs/dvr-scan/lib/python3.12/site-packages/dvr_scan/opencv_loader.py”, line 34, in <module> raise ModuleNotFoundError( ModuleNotFoundError: OpenCV could not be found, try installing opencv-python: However, running that install command says that cv is installed already. So I went into the specific file being run (opencv_loader.py). It has these commands: import importlib import importlib.util import os [snip] # OpenCV is a required package, but we don’t have it as an explicit dependency since we # need to support both opencv-python and opencv-python-headless. Include some additional # context with the exception if this is the case. if not importlib.util.find_spec(“cv2”): raise ModuleNotFoundError( “OpenCV could not be found, try installing opencv-python:nnpip install opencv-python”, name=”cv2″, ) So that looks like the part that’s failing. But when I do this from the command line: python3 : import importlib : import importlib.util : importlib.util.find_spec(“cv2”) .. it runs correctly! >>> importlib.util.find_spec(“cv2”) ModuleSpec(name=’cv2′, loader=<_frozen_importlib_external.SourceFileLoader object at 0x104ec51c0>, origin=’/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2/__init__.py’, submodule_search_locations=[‘/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2’]) So it looks, to my untrained eyes, like importlib.util is working when I invoke it directly in python3 via the command line but failing when called indirectly via dvr-scan during its startup. Is there something that could cause this? Environment variable differences? submitted by /u/wild_b_cat [link] [comments]
This may be a very noobish question but I did my best to research it and I’m stuck. I have not used a lot of Python in my life.
I’m on MacOs Ventura (14.6) and I’m trying to run dvr-scan. When I invoke dvr-scan it fails with:
File “/Users/patrickmcclanahan/Library/Application Support/pipx/venvs/dvr-scan/lib/python3.12/site-packages/dvr_scan/opencv_loader.py”, line 34, in <module>
raise ModuleNotFoundError(
ModuleNotFoundError: OpenCV could not be found, try installing opencv-python:
However, running that install command says that cv is installed already. So I went into the specific file being run (opencv_loader.py). It has these commands:
import importlib
import importlib.util
import os
[snip]
# OpenCV is a required package, but we don’t have it as an explicit dependency since we
# need to support both opencv-python and opencv-python-headless. Include some additional
# context with the exception if this is the case.
if not importlib.util.find_spec(“cv2”):
raise ModuleNotFoundError(
“OpenCV could not be found, try installing opencv-python:nnpip install opencv-python”,
name=”cv2″,
)
So that looks like the part that’s failing. But when I do this from the command line:
python3
: import importlib
: import importlib.util
: importlib.util.find_spec(“cv2”)
.. it runs correctly!
>>> importlib.util.find_spec(“cv2”)
ModuleSpec(name=’cv2′, loader=<_frozen_importlib_external.SourceFileLoader object at 0x104ec51c0>, origin=’/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2/__init__.py’, submodule_search_locations=[‘/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cv2’])
So it looks, to my untrained eyes, like importlib.util is working when I invoke it directly in python3 via the command line but failing when called indirectly via dvr-scan during its startup. Is there something that could cause this? Environment variable differences?
submitted by /u/wild_b_cat
[link] [comments]