-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add some info about how to transition from Anaconda's default channel #2107
Merged
beckermr
merged 14 commits into
conda-forge:main
from
hmaarrfk:add_info_about_transition
Sep 17, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8f37fab
Add some info about how to transition from Anaconda's default channel
hmaarrfk 2b11290
Add user/transitioning_from_defaults to sidebar
hmaarrfk e1e5879
Update docs/user/transitioning_from_defaults.md
hmaarrfk 6aa6f22
Update docs/user/transitioning_from_defaults.md
hmaarrfk 30d85ee
cleanup
hmaarrfk 50944a9
Remove
hmaarrfk 4d9c50b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f95d42f
Update _sidebar.json
jaimergp 3beed55
add my suggestions
jaimergp 8ec94d4
change title in sidebar
jaimergp 0cd2be4
pre-commit
jaimergp 6815a9a
link to announcement
jaimergp 0b2e421
more pre-commit
jaimergp 59e0751
Update docs/user/transitioning_from_defaults.md
hmaarrfk 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
This file contains 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 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,144 @@ | ||
--- | ||
title: Transitioning from defaults | ||
--- | ||
|
||
# Transitioning from Anaconda's `defaults` channels | ||
|
||
Users wishing to transition from Anaconda's `defaults` (i.e. those hosted under | ||
https://repo.anaconda.com/pkgs) channels should do so with care so as not to | ||
break their working environments. The first thing to realize | ||
is that in 2024 conda-forge is incompatible with the packages provided in | ||
`defaults`. Often, the packages on conda-forge will require | ||
newer versions of a particular package, or, may simply be organized in a | ||
different fashion. The only workflow we can support as a community is one where | ||
the conda-forge channel takes priority over all other channels. | ||
|
||
If you were using Miniconda or Anaconda Distribution and wish to move to use | ||
conda-forge, we outline two workflows. The first allows you to try packages from | ||
conda-forge without uninstalling your previous installation, the second | ||
involves uninstalling Miniconda or Anaconda Distribution, and then installing | ||
Miniforge. | ||
|
||
## Trying conda-forge in an isolated environment | ||
|
||
1. Create a conda environment with very few dependencies. The following | ||
command will only use packages from `conda-forge` to install Python 3.11. You | ||
may adjust the version of Python to the one of your liking: | ||
|
||
```bash | ||
conda create --name conda-forge-env python=3 --channel conda-forge --override-channels | ||
``` | ||
|
||
2. Activate your environment and add `conda-forge` with strict priority to | ||
that particular environment: | ||
|
||
```bash | ||
conda activate conda-forge-env | ||
conda config --env --add channels conda-forge | ||
# optional: | ||
# conda config --env --remove channels defaults | ||
conda config --env --set channel_priority strict | ||
``` | ||
|
||
3. Check the configuration of your conda environment: | ||
|
||
```bash | ||
conda config --show | ||
``` | ||
|
||
This should report that `conda-forge` is the top most channel in your list. | ||
|
||
4. You are now in a position to use command like: | ||
|
||
```bash | ||
conda install my_desired_package_from_conda_forge | ||
``` | ||
|
||
## Uninstalling Anaconda and installing Miniforge | ||
|
||
If you are ready to fully switch to conda-forge, we recommend uninstalling | ||
Anaconda / Miniconda and then installing [Miniforge](/download). The following steps | ||
are guidelines on how to go about this, while backing up your work and your environments. | ||
|
||
1. Clean your existing conda installation. This should remove unused files from | ||
your Anaconda / Miniconda installation and make for smaller sized backup. | ||
|
||
```shell | ||
# The conda build purge command may fail if you don't have conda-build installed. | ||
# this is expected | ||
conda build purge | ||
conda clean --all | ||
``` | ||
|
||
2. Create a zip archive of your conda installation. Use your favorite graphical tool | ||
to right click on the Anaconda / Miniconda installation folder. Check if you have | ||
created additional environments outside the installation root by running | ||
`conda info --envs`. Back those up too, if necessary. | ||
|
||
- Alternatively, you can also export lockfiles for all your environments, if preferred: | ||
|
||
```shell | ||
conda list --explicit --md5 --prefix /path/to/environment-name > environment-name.txt | ||
``` | ||
|
||
Note these lockfiles will only include the conda packages. If you `pip install`ed packages | ||
on top, those won't be captured. Check [`conda-lock`](https://conda.github.io/conda-lock/) | ||
for those use cases. | ||
|
||
- Another useful file to create is the input `environment.yml` for each environment: | ||
```shell | ||
conda env export --from-history --prefix --prefix /path/to/environment-name > environment-name.yml | ||
``` | ||
This file won't capture the exact same state you had in your environment. Instead it | ||
will tell `conda` what packages to look for and then find a solution that satisfies | ||
the request. | ||
|
||
3. On Windows, use the uninstaller suggested by the system control panel. | ||
On Linux and macOS, you can delete the folder called `anaconda3`, or `miniconda3` | ||
(usually located in your home directory). | ||
|
||
4. Find the file called `.condarc` in your home directory, and back it up somewhere safe. | ||
Then, delete your old `.condarc` file. A new one specific to conda-forge will be | ||
created when we install Miniforge. | ||
|
||
5. On Linux and macOS, your shell profile (`~/.bashrc`) might contain initialization code | ||
from the previous installation. Locate the block guarded by `# >>> conda initialize >>>` | ||
comments and delete it. | ||
|
||
6. Download and install the Miniforge installer that matches your platform from | ||
the [Miniforge download](/download) page. | ||
|
||
7. Once installed, you should be able to use the `Miniforge3 Prompt` on | ||
Windows, or the terminal on Linux and macOS, to run the command: | ||
|
||
```shell | ||
conda info | ||
``` | ||
|
||
Notice that the conda-forge is the channel with the topmost priority. | ||
|
||
You should now be in a position to use conda-forge packages. | ||
|
||
## A historical note | ||
|
||
Until roughly 2021, conda-forge held strong compatibility with Anaconda's | ||
default channel. However, as [announced in September 2021][defaults-announcement], | ||
we decided toultimately move away from dependency on Anaconda's `defaults` packages. | ||
Over the years, this has led for more divergence between package versions, and names | ||
between conda-forge and Anaconda's `defaults` channel. | ||
|
||
In 2024, the workflow that has packages co-installed from Anaconda's channel and | ||
conda-forge is no longer supported. | ||
|
||
To check if you have packages installed from both sources, use the command | ||
|
||
```bash | ||
conda list --show-channel-urls | ||
``` | ||
|
||
All packages should specify that they have been installed from the conda-forge | ||
channel. In 2024, there still exist a few bugs where conda packages will | ||
claim that they have been installed from PyPI even though they have been | ||
installed from conda-forge. | ||
|
||
[defaults-announcement]: /news/2021/09/30/defaults-channel-is-now-dropped-when-building-conda-forge-packages/ |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can also use
ls ~/.conda/environments.txt
(and/orconda info --envs
) to show their environments, so they canmv
them somewhere safe and then put them back in place. Or we could list how to generate platform-specific lockfiles withconda list --explicit --md5
that they can then use to regenerate those envs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm mostly trying to keep it as simple as possible.
Many of these users are true users of conda, and not reallly developers of it, so these "tricks" make it seem more scary than anything.
Trying to "keep an environment alive" like this, and changing the the default environment, is likely going to be a huge problem when they type
conda install ...
any other package.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is worth mentioning
conda env export --from-history
. It is probably a simple way to get a close-ish env file for existing environments without much magic or advanced directory/file browsing/moving.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a little paragraph for both things without sacrificing the simplicity of the zip archive. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!