-
Notifications
You must be signed in to change notification settings - Fork 14
Tutorial for Conda Migration using Miniforge #805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
iam4tune
wants to merge
6
commits into
uabrc:main
Choose a base branch
from
iam4tune:tutorial-conda-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1a36302
Created a tutorial to guide the migration of environments using Minif…
iam4tune b8b3994
Merge branch 'main' into tutorial-conda-migration
iam4tune a216c0d
Merged main into this branch following sync with fork, corrected typos
iam4tune d9e2bac
Made changes following review
iam4tune 5a5e70a
Merge branch 'main' into feat-globus-group-tutorial
iam4tune 4071c47
added page to nav
iam4tune File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
|
||
# Migrating Conda Environments using Miniforge | ||
|
||
This tutorial will guide you through the steps necessary for migrating Conda environments originally installed with the `default`, `anaconda` or `r` channels to use the Miniforge module and the `conda-forge` or `bioconda` channels. | ||
|
||
## Steps for Migrating your Conda Environment | ||
|
||
1. **Access to Terminal:** | ||
You will need access to a terminal (shell) on Cheaha. We encourage using a compute node on Cheaha when performing operations like this. You can access a Compute Node Terminal after creating an interactive job. Click on the highlighted part of the image below to access the terminal. | ||
|
||
 | ||
|
||
We encourage working on a compute node, to avoid clogging the cluster. You can find more information using and identifying nodes [here](../getting_started.md#why-you-should-avoid-running-jobs-on-login-nodes). | ||
|
||
1. **Load Anaconda Module:** You will need to load the Anaconda module using the `module load Anaconda3` command, in a terminal. | ||
|
||
1. **Activate the Original Conda Environment** | ||
Activate the conda environment you want to migrate: | ||
|
||
```bash | ||
conda activate <your_old_environment> | ||
|
||
``` | ||
|
||
Replace `<your_old_environment>` with the name of your existing Conda environment. As a best practice, you should use a name related to the environment's purpose. In this tutorial the environment `newtest` will be used as an example. | ||
|
||
```bash | ||
conda activate newtest | ||
|
||
``` | ||
|
||
 | ||
|
||
1. **Export the Environment to a .txt File:** | ||
Export the environment to a `.txt` file, which captures the list of installed packages and their versions: | ||
|
||
```bash | ||
conda list --export > <filename.txt> | ||
|
||
``` | ||
|
||
Name the file as you see fit. | ||
|
||
```bash | ||
conda list --export > migrate_env.txt | ||
|
||
``` | ||
|
||
When the file has been created, deactivate your Anaconda environment, and do a module reset using the `conda deactivate` and `module reset` commands respectively. | ||
|
||
1. **Load the Miniforge Module:** | ||
The next step is to load the Miniforge module on Cheaha using the `module load Miniforge3` command. | ||
|
||
1. **Create a New Conda Environment:** | ||
By default Miniforge creates a new environment using the `conda-forge` channel | ||
|
||
```bash | ||
conda create -n <environment_name> --file <migrate_env.txt> | ||
|
||
``` | ||
|
||
The above command will read from the `migrate_env.txt` file and install the packages from the specified channels like `conda-forge` and `bioconda` channels. Replace `<environment_name>` with your desired environment name, you may decide to use the same name as your previous environment, or rename the environment. If you decide to rename the environment, remember to edit scripts and workflows that have that environment name. You may also need to edit your script to `Module load Miniforge3` as against using the Anaconda module. | ||
|
||
```bash | ||
conda create -n new_env --file migrate_env.txt | ||
|
||
``` | ||
|
||
 | ||
|
||
After completing the above steps we will now need to update the environment using the Conda-Forge or Bioconda channels. | ||
|
||
 | ||
|
||
1. **Activate the New Environment:** | ||
Activate the new environment you created: | ||
|
||
```bash | ||
conda activate <new_environment_name> | ||
|
||
``` | ||
|
||
1. **Update All Packages to Use the Conda-Forge Channel:** | ||
|
||
Update all packages in the environment to ensure they are installed from the `conda-forge` or `bioconda` channels: | ||
|
||
```bash | ||
conda update --all -c conda-forge -c bioconda | ||
|
||
``` | ||
|
||
 | ||
|
||
Now we have created the environment and updated the packages inside the environment, we can verify packages within our environment by following the below steps. | ||
|
||
1. **Check Installed Packages:** | ||
Verify that all packages have been correctly installed using the `conda-forge` or `bioconda` channels: | ||
|
||
```bash | ||
conda list | ||
|
||
``` | ||
|
||
Look at the "channel" column to ensure most packages are from `conda-forge` or `bioconda`. | ||
|
||
 | ||
|
||
1. **Test the New Environment:** | ||
|
||
Run your scripts or workflows that depend on this environment to confirm that everything functions as expected. You may then decide to remove your old environments to free up space. | ||
|
||
1. **Remove the Old Environment (optional):** | ||
|
||
If everything works correctly with your new environment, you can remove the old environment: | ||
|
||
```bash | ||
conda env remove -n <your_old_environment> | ||
|
||
``` | ||
|
||
You may or may not switch modules to delete the environment, but we advise you switch modules to delete environments created with the Anaconda module. | ||
|
||
```bash | ||
conda env remove -n newtest | ||
|
||
``` | ||
|
||
 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.