0

I've seen 2 ways of installing OpenCV (there might be more ways which I don't know):

  1. Installing from the source
  2. Installing with pip: pip install opencv-python

My question is, why we need to install OpenCV from the source while we can simply install it using pip? Since people are using both of them, both must be useful. If so, there are any conditions for selecting one of them?

5
  • 3
    How do you know pip install doesn't clone the source, then compile it? Commented Mar 3, 2020 at 8:34
  • In some cases, pypi is maintained by external developers, or there are beta branches not released. In which case, you'd clone and install the official source. Same applies for any open source project without automated releases. Commented Mar 3, 2020 at 8:35
  • I had experienced a problem installing it from pip. Not all the functionalities were available. Thus, installed it from source code, and it worked well. But this was about a year ago which might not be the same now. Commented Mar 3, 2020 at 8:42
  • Isn't because by installing from source you can make the installation more configurable? For example I installed opencv 3.4.2 a while back and used libjpeg-turbo as the JPEG codec. I'm not sure you can do that by using pip install. Commented Mar 3, 2020 at 8:45
  • 1
    @cricket_007 Maybe it took less than a minute to install instead of one hour? It is pretty easy to spot the difference. Commented Mar 3, 2020 at 10:22

2 Answers 2

3

I will list out the differences between both

1.

Installation using pip

Installation is done at the default location where all the python packages resides.

Installation from Source

Installation location is provided by the developer.

2.

Installation using pip

In terms of performance, the packages installed might run slower because of the hidden conflicts between features.

Installation from Source

The developer can select the optimization flags during the compilation of packages which are responsible for the fast performance of library.

3.

Installation using pip

The developers can neither add nor remove features provided in the installation done by pip.

Installation from Source

The developer has all the rights to add or remove the features during the installation of library.

4.

Installation using pip

The package manager will do the work on behalf of developer. Package Manager is also responsible for taking care of library updation.

Installation from Source

The developers are responsible for feature selection and updation of library. They must be aware of new package updates, latest security patches etc, to keep themselves updated about the library.

Hope this helps you!

Sign up to request clarification or add additional context in comments.

1 Comment

Main reason why packaged one is slower is not because of hidden conflicts and stuff (I don't even know what you mean by those), but because packaged one is compiled for an (below?) average computer so that it can run on most computers. When you compile opencv yourself, you can enable more optimizations that use AVX, GPU(CUDA) etc... if your computer is capable. Also it can use some math libraries if you have them.
1

OpenCV is always under development, and the thing is some parts of the library is not going to published, due to compatibility and copyright issues, but if you use the source then you can have all the capabilities that you need. SURF & SIFT are examples of this problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.