Why conda install instead of pip install?

Siddhesh Gunjal
Analytics Vidhya
Published in
3 min readFeb 5, 2019

We all are familiar with pip, because we all have used it at some point to install libraries, dependencies and packages required to test and train our models. But very few of us know that there is a problem with pip.

In this post I will discuss about the problem with using pip install and what is an alternative to the same.

What’s that Problem?

When installing TensorFlow using pip, the CUDA and CuDNN libraries needed for GPU support must be installed separately, adding a burden on getting started.

Especially while working with tensorflow-gpu pip gives some problems. The pip packages only supports the CUDA 9.0 library. This can be important when working on systems which do not support the newer version of the CUDA libraries.

Why conda install is better than pip install?

Installing TensorFlow using conda packages offers a number of benefits, including a complete package management system, wider platform support, a more streamlined GPU experience, and better CPU performance. Here are the 2 important reasons to convince you:

Simpler installation of tensorflow-gpu

When TensorFlow is installed using conda, conda installs all the necessary and compatible dependencies as well and this is done automatically. where as in pip we have to install all the dependencies and packages manually, which in-turn consumes a lot of time. When installing TensorFlow using pip, the CUDA and CuDNN libraries needed for GPU support must be installed separately.
Packages for CUDA 8.0, 9.0, and 9.2 are available for the latest release at this time, version 1.10.0. The pip packages only supports the CUDA 9.0 library. This can be important when working on systems which do not support the newer version of the CUDA libraries.

Faster CPU performance

The conda Tensorflow packages leverage the Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) starting with version 1.9.0. This library gives us the huge performance boost when we are working with computationally demanding deep learning applications. You can observe the huge improvement in performance (more than 8X faster) in the following chart!

Chart taken from https://www.anaconda.com/tensorflow-in-anaconda/

Not only does the MKL library speed up your Tensorflow packages, it also speeds up other widely used libraries like NumPy, SciPy, and Scikit-Learn!
You can learn more about MKL Optimization here.

In my personal experience, I usually test and train my model on my Laptop CPU on a smaller set of data to check whether my model is working properly or not (if not, then I can debug) before taking it to my Workstation, So that I can train my model without any interruption. This boost up in speed allowed me to complete this process at much higher speed.

Then what you are waiting for?

pip uninstall tensorflow

Now install Anaconda or miniconda on your machine and then hit

conda install tensoflow

for tensorflow-gpu

conda install tensorflow-gpu

Hope this helps you to improvise performance of your machine when working on Deep Learning Problems!

--

--

Siddhesh Gunjal
Analytics Vidhya

ML Engineer | Creator of Slackker (PyPi pakage) | Former Adjunct Faculty @upGrad | Former Professor @BSE (Bombay stock exchange)