Kernelerror when matplotlib is installed

Interactive package management is fairly nightmarish above a certain level of complexity, especially in the case of mixing more than one of PyPI, conda-forge and the ToS-encumbered defaults.

As a minimal step, it’s recommended to starting with a fresh environment.yml and rebuild the env from the ground up with some “guideposts” for the solver, for example:

# environment-introduktion.yml
name: introduktion
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python ==3.11.*  # or a suitably-hard pin  
  - numpy ==1.*      # or 2 if feeling feisty
  - matplotlib-base  # likely fine to leave-unpinned, avoids `qt` from `matplotlib`
  # all the stuff

Then:

mamba env upgrade --name introduktion --file environment-introduktion.yml

As a more drastic measure, discussed in many other places:

  • fully remove anaconda
  • start with a brand-new, unencumbered miniforge installer to get a new base (e.g. ~/mf)
    • never install anything in base other than e.g. mamba, conda, etc.

Then start with full-managed, isolated environments.

For an entirely different approach, on can try yet-newer approaches like pixi which mostly avoid some of the issues caused by heavy global installations. My personal recommendation, however, is to still start with miniforge, and manage pixi through normal means there instead of the curl | bash and pixi selfupdate techniques.

2 Likes