Migrating Your Analysis Repository to Pixi
The steps top migrate your analysis repository to Pixi are:
Initialize your repository as a Pixi workspace
Test a notebook
Clean up the default environment
Commit and push
pixi.toml,pixi.lock, and removal ofnotebooks/environment.yamlImport any other environment you may have
Remove conda if you have removed all your environments
The steps above assume that you have already Installed Pixi
Initialize Your Repository as a Pixi Workspace
These command assume that you are working on salish or a Waterhole workstation.
They use analysis-casey/ as the analysis repository.
Yours,
of course,
will use your name.
$ cd /ocean/$USER/MOAD/analysis-casey/
$ pixi init --import notebooks/environment.yaml
$ pixi add \
--git https://github.com/SalishSeaCast/tools.git \
--pypi \
--subdir SalishSeaTools \
SalishSeaTools
Note
Depending on when you set up your analysis repository,
it is possible that its path is different to /ocean/$USER/MOAD/analysis-<your-name>/.
Test a Notebook
If you run Jupyter from the commandline:
$ pixi run jupyter lab notebooks/my_notebook.ipynb
If you us VS Code:
Install the Pixi Code extension
The Select Kernel button in VS Code should show the kernel in your workspace as a choice, probably
.pixi/envs/default/bin/python
Clean Up the Default Environment
You no longer need the notebooks/environment.yaml file,
note the analysis-casey conda environment.
So,
remove them:
$ rm notebooks/environment.yaml
$ conda env remove -n analysis-casey
Commit and Push
The steps above will have created 3 new files:
pixi.toml- the Pixi manifestpixi.lock- the Pixi lockfile.gitattributes- settings to control how Git managespixi.lock
removed 1 file:
notebooks/environment.yaml- conda environment description file
and modified 1 file:
.gitignore
Stage and commit those files in the VS Code Commit side-panel or at the commandline, and push them to GitHub:
$ git add pixi.toml pixi.lock .gitattributes .gitignore notebooks/environment.yaml
$ git commit -m "Change to Pixi for dependency and environment management"
$ git push
Import Any Other Environments
Please see the Importing a Conda Environment Into a Pixi Workspace section.
Maybe Remove Conda
If the output of:
$ conda env list
shows only the base environment like:
follow the Uninstall instructions for Miniforge to remove it.
If you have environments in addition to base left,
migrate them to Pixi before you remove conda.
Please contact Doug if you need help.