# How to pin Conda

|   Source   |   Minimap

One interesting advance feature in Conda is the capacity to pin packages from your environments so they can not be updated at all. If you are interested in that specific version of some package and not the next one because it breaks your work completely or for some other reason, you are probably pinning that package. If you are adding the specific version in every command you run instead of pinning the package, you are doing it wrong and you should keep reading ;-)

But, is it possible to pin Conda itself so it does not get updated every time you try to install/update something else?

If you don't know what Conda is, you should probably go here and learn a little bit about it. For the lazy ones:

Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.

One interesting behavior in Conda is that it gets updated to the latest version every time you try to install/update something else. That is a reasonable behavior in the general context but, for some specific use cases, that can be undesirable. This motivates the main question I raised before: is it possible to pin Conda itself so it does not get updated every time you try to install/update something else?

I have heard a lot of people saying it is impossible to pin Conda, BUT that's not the case ;-)

You can pin Conda the same way you pin any other package.

Let me show you how you can do it... is really simple:

echo "conda ==4.0.0" >> ~/anaconda/conda-meta/pinned


This will create (or pass the string into) a file called pinned containing the conda package version you wish to keep (in this case, I choose the version 4.0.0). This pinned file should be located in the conda-meta directory of your anaconda (or miniconda) installation. Then, every time you try to install or update something, this pinned file is read by Conda and the line with the conda specific version is added to the list sent to the SAT solver, hence you will always have that specification enabled, preventing you from updating to a newer Conda. Nice, don't you think?

You can remove that file when you are ready to catch a new Conda version or alternatively you can run conda install/update commands with the --no-pin option.

Hope this helps others! If not, at least, it was fun to play a little bit with this feature!

See you next time!

PS1: Thanks Will for reviewing my wording!

PS2: Starting Conda version 4.0.9, you have a new config option called auto_update_conda to disable the self update nature in Conda.

Did you like the content? Great!