question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

openCV module not found

See original GitHub issue

Description

What steps will reproduce the problem?

I am trying to run a simple program to access my webcam and capture an image. While I can access it from the terminal but I have got a lot of problems in Spyder to do so. I have tried installing the library with miniconda but then I get the kernel error.

Versions

  • Spyder version: 5.3.1
  • Python version: 3.9.5
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.6
  • Operating System: Darwin 21.5.0

Dependencies

# Mandatory:
applaunchservices >=0.1.7            :  0.3.0 (OK)
atomicwrites >=1.2.0                 :  1.4.0 (OK)
chardet >=2.0.0                      :  4.0.0 (OK)
cloudpickle >=0.5.0                  :  2.1.0 (OK)
cookiecutter >=1.6.0                 :  1.7.3 (OK)
diff_match_patch >=20181111          :  20200713 (OK)
intervaltree >=3.0.2                 :  3.1.0 (OK)
IPython >=7.31.1;<8.0.0              :  7.33.0 (OK)
jedi >=0.17.2;<0.19.0                :  0.18.1 (OK)
jellyfish >=0.7                      :  0.9.0 (OK)
jsonschema >=3.2.0                   :  4.5.1 (OK)
keyring >=17.0.0                     :  23.5.1 (OK)
nbconvert >=4.0                      :  6.5.0 (OK)
numpydoc >=0.6.0                     :  1.3.1 (OK)
parso >=0.7.0;<0.9.0                 :  0.8.3 (OK)
pexpect >=4.4.0                      :  4.8.0 (OK)
pickleshare >=0.4                    :  0.7.5 (OK)
psutil >=5.3                         :  5.9.1 (OK)
pygments >=2.0                       :  2.12.0 (OK)
pylint >=2.5.0                       :  2.13.9 (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.4.1;<1.5.0                 :  1.4.1 (OK)
pylsp_black >=1.2.0                  :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0            :  3.0.3 (OK)
qstylizer >=0.1.10                   :  0.2.1 (OK)
qtawesome >=1.0.2                    :  1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0             :  5.3.0 (OK)
qtpy >=2.1.0                         :  2.1.0 (OK)
rtree >=0.9.7                        :  1.0.0 (OK)
setuptools >=49.6.0                  :  62.3.2 (OK)
sphinx >=0.6.6                       :  4.5.0 (OK)
spyder_kernels >=2.3.1;<2.4.0        :  2.3.1 (OK)
textdistance >=4.2.0                 :  4.2.2 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog >=0.10.3                    :  2.1.8 (OK)
zmq >=22.1.0                         :  23.0.0 (OK)

# Optional:
cython >=0.21                        :  0.29.30 (OK)
matplotlib >=3.0.0                   :  3.5.2 (OK)
numpy >=1.7                          :  1.22.4 (OK)
pandas >=1.1.1                       :  1.4.2 (OK)
scipy >=0.17.0                       :  1.8.1 (OK)
sympy >=0.7.3                        :  1.10.1 (OK)

# Spyder plugins:
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
avijit-89commented, Jul 18, 2022

FInally, it worked after I uninstalled everything from miniconda, python3.9 and python related folders inside the framework folder except python 2.7 (which is macos default).

Following would installed via the terminal

  1. Installed Homebrew and cleanedup
  2. Python3 - brew install python
  3. created the python environment named pyenv inside a directory other than /opt and I made sure this time I install all packages within this
  4. installed the numpy, opencv-python etc packages via pip
  5. installed spyder via terminal - pip install spyder

Viola! It works fine as I wanted.

Thanks for the support guys.

1reaction
Ildaroncommented, Jul 13, 2022

Set user environmental variables specially for Anaconda for FFMPEG utility

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module cv2 when using OpenCV - Stack Overflow
First do run these commands inside Terminal/CMD: conda update anaconda-navigator conda update navigator-updater.
Read more >
ModuleNotFoundError: No module named 'cv2' in Python
The Python "ModuleNotFoundError: No module named 'cv2'" occurs when we forget to install the opencv-python module before importing it or ...
Read more >
ModuleNotFoundError No module named cv2 - Edureka
Hi@akhtar,. This error may occur if you didn't install opencv module in your system. So first check this module is available or not....
Read more >
Importerror No Module Named cv2 : How to Fix
importerror no module named cv2 error occurs when cv2 module is not properly installed or its path is not properly set or configured....
Read more >
ModuleNotFoundError: No module named 'cv2' in Python
Let's first reproduce this error, and then we will see how to resolve ModuleNotFoundError No module named 'cv2' . We will run cv2...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found