1 | initial version |

One can activate the existing "sage" conda environment and upgrade the relevant packages.

Or create a new environment with a different name, try it and it works well remove the old one.

**Example.**

Upgade option:

```
$ conda activate sage # or: mamba activate sage
$ mamba upgrade sage # or: mamba update sage
```

New environment option:

```
$ mamba create -n sage98 sage=9.8
```

To list existing conda environments:

```
$ conda env list
```

2 | No.2 Revision |

~~One can ~~Two options:

- activate
~~the~~existing "sage" conda environment and upgrade~~the~~relevant~~packages.~~packages - create
~~a~~new environment with~~a~~different~~name, try it and~~name; if it works well remove~~the~~old~~one.~~one

Or

**Example.**

Upgade option:

```
$ conda activate sage # or: mamba activate sage
$ mamba upgrade sage # or: mamba update sage
```

New environment option:

```
$ mamba create -n sage98 sage=9.8
```

To list existing conda environments:

```
$ conda env list
```

To rename a conda environment:

```
$ conda rename -n sage98 sage
```

which in fact creates a new environment and removes the old one, see Stack Overflow answer 42231765 .

3 | No.3 Revision |

~~Two ~~Three options:

- activate existing "sage" conda
~~environment and~~environment; upgrade relevant packages - create new environment with
~~different~~other name; if it works~~well~~well, remove old one - completely remove existing conda installation; start afresh

Details below for each of these options.

~~Example.~~Upgade existing environment

Upgade option:

```
$ conda activate sage # or: mamba activate sage
$ mamba upgrade sage # or: mamba update sage
```

~~New environment option:~~**Create new environment**

```
$ mamba create -n sage98 sage=9.8
```

To list existing conda environments:

```
$ conda env list
```

To rename a conda environment:

```
$ conda rename -n sage98 sage
```

which in fact creates a new environment and removes the old ~~one, ~~one,
see Stack Overflow answer 42231765 .

**Reinstall conda**

This assumes you were only using conda for Sage and you don't mind reinstalling it completely.

(Check with `conda env list`

if you have any other conda environments.)

The sagemath-forge distribution you installed might no longer be maintained.

Remove it:

```
$ rm -rf ~/sagemath-forge
$ rm -rf ~/.conda
```

Remove any conda traces from `~/.zshrc`

(in your favourite text editor).

Reinstall, taking inspiration from the "Install from conda-forge" instructions at

First, install mambaforge:

```
$ curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh
$ sh Mambaforge-$(uname)-$(uname -m).sh
```

This starts an installation scripts which guides you in installing Mambaforge. Follow the script's instructions, which sometimes involve typing "yes", or hitting Enter, etc. (if in doubt, use the suggested defaults).

Once this is done, the last few lines tell you to open a new terminal.

In this new terminal window, if the conda base environment gets auto-activated, and that annoys you, run

```
$ conda config --set auto_activate_base false
```

and open yet another terminal window to see that taken into account.

In this new terminal window, type one of the following, depending whether you want a specific Python version or are happy with any.

```
$ mamba create -n sage sage=9.8
$ mamba create -n sage sage=9.8 python=3.11
$ mamba create -n sage sage=9.8 python=3.10
```

Mamba will solve the constraints for installing the requested software, and propose a choice of package versions. Accept it and let it install.

Once that is done, I suggest installing a very recent version of JupyterLab into the "sage" conda environment.

The latest versions, and what conda-forge label to use to get them, are listed at

- https://anaconda.org/conda-forge/jupyterlab/labels

As of May 20, 2023, one might want to install JupyterLab 4.0.0rc1 as follows:

```
$ conda activate sage
$ mamba install -c conda-forge/label/jupyterlab_rc jupyterlab=4.0.0rc1
```

Install any other things you might want (with the sage conda environment active).

For instance the pari_jupyter package:

```
$ mamba install -c conda-forge pari_jupyter
```

which will allow you to use Jupyter sheets using a PARI/GP kernel.

Done installing.

To use your new installation, in any new terminal window, activate the sage conda environment:

```
$ conda activate sage
```

then run one of:

```
$ sage # to use the Sage REPL
$ jupyter lab # to use Sage in Jupyter
```

Happy computing!

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.