0

I want to host my pc as a local server for a firebase application. But when executing "moduleNotFoundError". Packages installed:

pip3 install firebase-admin opencv-contrib-python opencv-python

I uninstalled opencv and renstalled throught: opencv-contrib-python and opencv-python. tried both pip install and pip3 install without success.

When i run script in Visual Studio everything works fine, but when i try to run the script from terminal : python main.py or python3 main.py i get following error:

Traceback (most recent call last):
  File "analyzer/script.py", line 4, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

Tried to make a new installation in a virtual enviroment but results are the same.

Image of installed package and error connected to it

Image of installing packages

Thanks for help with sys.path.append. Though this results in

ERROR:root:Failure. During fetching photos was occurred an exception. Additional info: 'utf-8' codec can't decode byte 0xe5 in position 29: invalid continuation byte

And results of print (sys.stdin.encoding) is utf8

Community
  • 1
  • 1
  • 1
    Does this answer your question? [Cannot find module cv2 when using OpenCV](https://stackoverflow.com/questions/19876079/cannot-find-module-cv2-when-using-opencv) – Nir Alfasi Apr 14 '21 at 09:30
  • What does the output of pip list return? Is OpenCV there? – Henry James Apr 14 '21 at 09:36
  • i have tried adding sys.path.append, which results in another error. ERROR:root:Failure. During fetching photos was occurred an exception. Additional info: 'utf-8' codec can't decode byte 0xe5 in position 35: invalid continuation byte – Karl Lindborg Apr 14 '21 at 09:41
  • 1
    OpenCV is there. Installed in right site packages @Henry James – Karl Lindborg Apr 14 '21 at 09:50
  • Super silly question, but are you calling the right python when running the script? In your command line prompt make sure your running the python that your running in your Visual studio terminal. – Henry James Apr 14 '21 at 09:50
  • No silly questions, grateful for all questions and help. Im sorry, do you mean "python main.py"/ "python3 main.py" or is there something else i could check? In visual studio i run python 3.7.6 – Karl Lindborg Apr 14 '21 at 09:55

1 Answers1

0

Can you try just running

pip install firebase-admin opencv-contrib-python opencv-python
Henry James
  • 143
  • 3
  • 14