# Kernelerror when matplotlib is installed

**URL:** <https://discourse.jupyter.org/t/kernelerror-when-matplotlib-is-installed/28309>\
**Category:** Notebook\
**Tags:** help-wanted\
**Created:** [September 12, 2024, 9:33am UTC](https://discourse.jupyter.org/t/kernelerror-when-matplotlib-is-installed/28309 "2024-09-12T09:33:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bollwyvl](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/bollwyvl/32/904_2.png) [@bollwyvl](https://discourse.jupyter.org/u/bollwyvl)\
**Post date:** [September 12, 2024, 1:50pm UTC](https://discourse.jupyter.org/t/kernelerror-when-matplotlib-is-installed/28309/3 "2024-09-12T13:50:59Z")

</div>

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:

```yaml
# 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:

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

```

As a more drastic measure, [discussed](https://discourse.jupyter.org/t/conda-licensing-for-enterprise-use/20124/2) in many other places:

- fully remove anaconda
- start with a brand-new, unencumbered [miniforge](https://conda-forge.org/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`](https://pixi.sh) 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.

---

_[View the full topic](https://discourse.jupyter.org/t/kernelerror-when-matplotlib-is-installed/28309)._
