Installing Python with Miniforge

In a previous post, I described a method to install Python on Windows using the standard distribution, to cope with Anaconda firewalling academic institutions. Unfortunately, this distribution suffers from the same problem as the Linux ones, which is that Numpy on PyPI is linked against OpenBLAS. This library, on my current computers, has a 100% time overhead in many heavy computations with respect to Intel MKL, which is the default library used by Numpy both on Anaconda and Conda-forge packages.

In this post I describe yet another method to use the free Conda-forge repositories by means of another package installer, Mamba, which is open-source and does not depend on Anaconda Inc.'s repositories.

Step 1: Install Miniforge

You need to download and install the Miniforge distribution from GitHub. Working on Linux over an x8664 architecture, you need to download the latest installation script, which will have a name like, using We are going to install pyenv-win, a small tool to install Python releases and switch between versions of the interpreter. Following the instructions from the web, we will open a PowerShell window and type

$ wget
$ chmod +x
$ ./

These steps will show you some license information. Use q to exit the documentation and say "yes" to the following questions. This will create a very simple package distribution under the directory $HOME/miniforge3, and ideally also activate this minimal environment every time you enter the Linux terminal.

Just to be sure, exit the terminal and update the installation once

$ conda update --all

Step 2: Create a Python environment

When working with python software, it is customary to create a unique environment that contains only the libraries and tools the software needs. This allows you as a developer to keep track of the requirements of your software and which versions of the libraries are used, making the process more reproducible for other users and for yourself, should you move to a different computer.

Unlike standard python, Miniforge and conda-based installers keep the environments in some centralized location. This should not discourage from using these temporary environments, ensuring some unique names. In my case, I have a project under myproject which requires Numpy, Scipy and other tools:

$ cd c:\Users\me\src\myproject
$ conda create -n myproject-env python numpy scipy matplotlib-base libblas=*=*mkl

Note the following peculiarities of the Conda-forge packages:

  1. Since I am working in a text-based Linux image and do not care about showing graphical plots, I just install matplotlib-base instead of the full package matplotlib.
  2. We can select which BLAS library Numpy works with by using any of the following options
conda install "libblas=*=*mkl"
conda install "libblas=*=*openblas"
conda install "libblas=*=*blis"
conda install "libblas=*=*accelerate"
conda install "libblas=*=*netlib"

Step 3: Install and use Visual Code

The previous recommendations still hold, nothing changing: Visual Code will recognize your Miniforge environments and allow you to use the same tools as described in the previous post.