I prefer using the MKL toolchain from the usual defaults
channel provided by Continuum. Like many people, though, I find myself installing quite a few packages from the conda-forge channel.
Consider, for example, the python-graphviz package. The install command is
conda install -c conda-forge python-graphviz
which results in some undesired changes to dependencies
The following packages will be UPDATED:
cvxopt: 1.1.7-py27_0 --> 1.1.9-py27_blas_openblas_201 conda-forge [blas_openblas]
gsl: 2.2.1-h8267d9d_2 --> 2.2.1-blas_openblas_2 conda-forge [blas_openblas]
numpy: 1.13.3-py27hbcc08e0_0 --> 1.13.3-py27_blas_openblas_200 conda-forge [blas_openblas]
scikit-learn: 0.19.1-py27h445a80a_0 --> 0.19.1-py27_blas_openblas_200 conda-forge [blas_openblas]
scipy: 0.19.1-py27h1edc525_3 --> 0.19.1-py27_blas_openblas_202 conda-forge [blas_openblas]
I don't want to change to the OpenBlas numpy
, so I manually handle all the dependencies and then
conda install -c conda-forge --no-deps python-graphviz
which works fine but is laborious and invites mistakes.
I had thought that if I added conda-forge
as a low priority channel with
conda config --append channels conda-forge
then it would stop trying to override the numpy
installation, but this turned out to be untrue. The output of conda config --show
now contains, as expected,
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
- defaults
- conda-forge
but if I try installing something (without the command-line switch) with, say, conda install pycwt
, then I still get
Package plan for installation in environment /conda:
The following NEW packages will be INSTALLED:
pycwt: 0.3.0a22-py_0 conda-forge
tqdm: 4.19.4-py27hdfef72e_0
The following packages will be UPDATED:
cvxopt: 1.1.7-py27_0 --> 1.1.9-py27_blas_openblas_201 conda-forge [blas_openblas]
gsl: 2.2.1-h8267d9d_2 --> 2.2.1-blas_openblas_2 conda-forge [blas_openblas]
numpy: 1.13.3-py27hbcc08e0_0 --> 1.13.3-py27_blas_openblas_200 conda-forge [blas_openblas]
scikit-learn: 0.19.1-py27h445a80a_0 --> 0.19.1-py27_blas_openblas_200 conda-forge [blas_openblas]
scipy: 0.19.1-py27h1edc525_3 --> 0.19.1-py27_blas_openblas_202 conda-forge [blas_openblas]
Is there a way to prefer defaults
over conda-forge
updates when I install conda-forge
packages?
Edit: Added more information about conda config
output and non-switch behavior
About conda-forge Miniforge is an effort to provide Miniconda-like installers, with the added feature that conda-forge is the default channel. Unlike Miniconda, these support ARMv8 64-bit (formally known as `aarch64`).
If you installed the Anaconda distribution of Python, NumPy comes pre-installed and no further installation steps are necessary. If you use a version of Python from python.org or a version of Python that came with your operating system, the Anaconda Prompt and conda or pip can be used to install NumPy.
NumPy can be installed with conda , with pip , with a package manager on macOS and Linux, or from source. For more detailed instructions, consult our Python and NumPy installation guide below.
Press command (⌘) + Space Bar to open Spotlight search. Type in Terminal and press enter. 2. In the terminal, use the pip command to install numpy package.
You might want to use pinned_packages
feature of conda config.
Either manually edit your .condarc
file (it's location can be seen in the output of conda config --show-sources
) by changing/adding these lines:
pinned_packages:
- defaults::numpy
Or from command line:
conda config --add pinned_packages defaults::numpy
This will ensure that numpy
will be only installed / updated from defaults channel and not from conda-forge.
A literal translation of the expression
prefer defaults over conda-forge while installing the
python-graphviz
package from conda-forge
would be
conda install -c defaults -c conda-forge conda-forge::python-graphviz
This works because conda
accepts multiple -c
arguments, given priority according to order (first is highest, last is lowest).1 The conda-forge::
overrides the priority and only looks for python-graphviz
on the conda-forge channel.
It may also be sufficient to simply do:
conda install conda-forge::python-graphviz
which should respect the user's configured channels, except for using conda-forge for the specified package.
[1] You may need to have conda config --set channel_priority strict
for this to behave.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With