Installing Python Package - opencv-python

Answered

Hi,

I have a problem installing OpenCV in pycharm.

I get an error during installation that is thousands of lines long (I will not paste it here, only if someone ask for it).

I have used the terminal (I am using an intel mac running MacOS Catalina):

pip install opencv-python

I have uninstalled it as well and reininstalled it.

I have updated pip and numpy to the latest versions.

I am running python 3.8, 3.9 and 3.10.

When I type `import cv2` in VS Code the library is recognised and I can use it using python 3.8. In PyCharm cv2 is highlighted in red when I try to import it in a python file.

This is extremely annoying error.

0
14 comments

Hello, 

>I have used the terminal (I am using an intel mac running MacOS Catalina): pip install opencv-python

 

I am wondering if the venv has been activated? ( source /path/to/the/venv/bin/activate, see the suggested command in the error output) If you just open terminal and run installation command, the package will be installed to the system interpreter ( " which python" will show the path to the interpreter).  You may use that system interpreter in PyCharm, see how to add it here https://www.jetbrains.com/help/pycharm/configuring-local-python-interpreters.html

 

 

 

0

Hi,

I also seem to be having this issue. I am on windows 11. I have installed opencv on the command line. But when I try to install on pycharm. I get the wheel of death, and after about 30 minutes, it says there was an error installing opencv.

0

Hi,

I also seem to be having this issue. I am on windows 11. I have installed opencv on the command line. But when I try to install on pycharm. I get the wheel of death, and after about 30 minutes, it says there was an error installing opencv.

0

What error do you get exactly?

0

It says, "Error occurred when installing package 'opencv'. This is after about 30 minutes of wheel spinning. When I hit the "details" link, it shows me this really long text of code.

0

It looks like there are dependencies conflicts. You will most likely get the same error if you try installing it in the command line, so the issue is not related to PyCharm.

Try creating a new venv and see if it installs there.

0

It actually installs on the command line pretty easily

0

Did you install it into the same interpreter that you use in PyCharm?

0

Oh, I'm not sure if I did that. I don't know how to do it tbh.

0

The command line uses the system interpreter by default, while in PyCharm, you most likely use a virtualenv.
You run `where python` in cmd to see which interpreter is used and compare it to the one in File | Settings | Project | Python Interpreter

If you can't fix the issue with the virtualenv, you can configure the system interpreter in PyCharm instead.

0

ok, first thanks for helping this far.

It seems the interpreters might be different?

How do I configure the system


0

thanks. I followed the instructions and it seems like it worked. I guess I was using the conda interpreter all this while and some packages cannot be installed there? Dunno... Anyway, thanks for your help. Maybe one day I can pay it forward.

0

thanks for helping this far.

get-mobdro.com

0

Please sign in to leave a comment.