python-guide icon indicating copy to clipboard operation
python-guide copied to clipboard

'Conda' or 'pip'

Open baif666 opened this issue 7 years ago • 10 comments

Which one do you think is better for beginners? And you don't talk about Conda in this book, so dose Conda have some problems? (P.s: This book is really useful.)

baif666 avatar Dec 06 '16 00:12 baif666

pip is best

kennethreitz avatar Dec 06 '16 17:12 kennethreitz

conda is for scientific use, and is covered in this guide, i believe. perhaps is needs more mention for those users

kennethreitz avatar Dec 06 '16 17:12 kennethreitz

Thanks for your answer. I'll look for it again.

baif666 avatar Dec 06 '16 23:12 baif666

Trying to manage an environment for machine learning by pip alone is difficult due to delicate dependencies involved among the many necessary packages. Conda does an excellent job, especially where binary libraries are involved -- and the support for the IPython console and Jupyter notebook is superb.

For scientific replication purposes, consider using pip or conda within a Docker container to truly maintain an environment which can include your own particular data files. Here is an example for financial economics: https://hub.docker.com/r/rsvp/fecon235 where Anaconda and Jupyter are ready to run on any machine (Mac, Windows, Linux) instantly without going through dependency hell. Utilities like git are also pre-installed so you can experiment, then simply discard the container.

cc: #714

rsvp avatar Dec 07 '16 17:12 rsvp

yeah, many person recommend it to me

baif666 avatar Dec 07 '16 23:12 baif666

but many developers use pip to install their projections instead of conda, so I use pip again.

baif666 avatar Dec 07 '16 23:12 baif666

pip is straightforward and is easy to understand. I have seen a lot of people get confused by conda. My vote is for pip. :)

arunavkonwar avatar Dec 23 '16 17:12 arunavkonwar

Blog about Conda myths may be interesting reading for you :)

miso-belica avatar Jan 07 '17 11:01 miso-belica

@miso-belica : +1: on your previous link.

Roughly speaking, I think of pip as a configuration manager where its text source may not adequately capture necessary dependencies, for example:

For scientific users, conda also allows things like linking builds to optimized linear algebra libraries, as Continuum does with its freely-provided MKL-enabled NumPy/SciPy. Conda can even distribute non-Python build requirements, such as gcc, which greatly streamlines the process of building other packages on top of the pre-compiled binaries it distributes. If you try to do this using pip's wheels, you better hope that your system has compilers and settings compatible with those used to originally build the wheel in question.

Having the correct binaries is crucial, for example, MKL which is the Math Kernel Library produced by Intel.

The blog concludes by:

If you want to install Python packages within an Isolated environment, pip+virtualenv and conda+conda-env are mostly interchangeable.

But an important aspect of "environment" may be its full reproducibility (say for research or for debugging purposes). This may encompass specific versions of compilers and system utilities. So this is the primary reason why Docker containers would be relevant to our discussion -- they can serve to freeze an specific environment, but its components can also be updated by pip, conda, or even, apt-get, and git pull.

rsvp avatar Jan 07 '17 18:01 rsvp

I've had good experiences so far with new users who have used conda over pip. My opinion is that new users should absolutely understand pip and be comfortable with it, but that conda is easier to get up and running as a first step.

As new users gain competency, it's extremely common for them to end up installing multiple Python interpreters and end up both very confused and with an environment that's difficult to understand. On macOS this progression usually goes "system Python" > "brewed Python" > "virtualenvs based on the brewed Python". Conda seems to help avoid the mess by keeping everything in one directory during this stage of the learning process and put off learning how to deal with the system path, multiple installed Python binaries, and broken virtualenvs until they need to deploy their application in a self-hosted environment.

lyndsysimon avatar Jan 19 '17 19:01 lyndsysimon