| Crates.io | conda_share |
| lib.rs | conda_share |
| version | 2.0.3 |
| created_at | 2026-01-05 20:04:00.710665+00 |
| updated_at | 2026-01-09 21:16:18.564124+00 |
| description | View and share conda environments in rust. |
| homepage | |
| repository | https://github.com/BruskaTech/conda-share |
| max_upload_size | |
| id | 2024483 |
| size | 33,203 |
Have you ever want to make conda environments sharable? Well this is the package for you!
After years of waiting for someone to build a tool that exports conda environments that can easily transfer across computers (and operating systems) while still keeping the package versions, I decided to build it myself.
There is (at time of writing) no conda command in existence that exports only the user installed packages, with their version numbers, and also includes the installed pip packages. This is what you need to share an environment consistently and effectively.
conda-share makes this easy.
There is even a single line you can add to your python files and jupyer notebooks to save an updated environment every time it is run (so you don't have to keep track of it).
The primary goal is to generate a shareable environment YAML that is closer to “what you explicitly installed” (via --from-history) while also including version
numbers and pip packages.
The secondary goal is to provide a programmatic API for Python and Rust applications to read and evaluate conda environments.
Well, it outputs all the operating system specific packages too!
So if you export on your lab server that runs Linux and try to install it on your MacBook, it won't be able to build. That is not because there is any difference in practice if you manually install the packages, but because of those extra operating system specific packages.
Guess how I know this...
Conda-share solves this problem by only including the packages you specifically installed, just like conda env export --from-history
Because that command doesn't return any version numbers that you didn't ask for at time of install. It also doesn't include any pip packages.
This means that if you were to conda install python=3.13 numpy at the beginning, then only the python package will have a version number in your export. If numpy has upgraded 5 major versions since then, then when the next person goes to recreate this environment, they will install the wrong version of numpy.
To solve this, conda-share only includes the packages in --from-history, but it includes the version numbers as well. Additionally, conda-share includes the pip packages.
There are other small benefits to using this software:
Go to the releases page in this GitHub repo and download the right executable for you.
There are two different executables for each OS:
Download it, unzip it, and use it.
The exception is of course MacOS with it's extra security settings. Since the app built in github actions is not a signed release, you will need to let MacOS know that the app is safe to run by running the following command:
# Make sure to replace <path_to_file> with the path to your downloaded and unzipped conda-share-gui file.
xattr -d com.apple.quarantine <path_to_file>/conda-share
Here are some examples on how to use it.
# Export environment to a file with the same name as the environment
./conda-share <env_name>
# ex: conda-share test_env
# creates test_env.yml in the current folder
# Export environment to a file with a different location/name
./conda-share <env_name> -p <new_file_path>
# ex: conda-share test_env -p ~/my_envs/env.yml
# creates my_test_env.yml inside the ~/my_envs folder
# Export environment and just display it to the screen
./conda-share <env_name> -d
# ex: conda-share test_env -d
# outputs the test_env yaml to screen
Download it, unzip it, and use it.
The exception is of course MacOS (again) with it's extra security settings. Since the app built in github actions is not a signed release, you will need to let MacOS know that the app is safe to run by running the following command:
# Make sure to replace <path_to_file> with the path to your downloaded and unzipped conda-share-gui file.
xattr -d com.apple.quarantine <path_to_file>/conda-share-gui
This makes it super easy to automatically keep your environment up to date for a python file or a jupyter notebook.
First, make sure conda-share is installed in your conda environment.
# Make sure to replace <env_name> with the environment name
conda activate <env_name>
pip install conda-share
Then, just add this one line to the top of your code.
import conda_share; conda_share.save_current_env()
# You can also save it to a different directory with a different name.
# import conda_share; conda_share.save_current_env("/path/to/my_envs/env.yml")
Voilà! That's it.
There are also other functions available in the python package for viewing and sharing conda environments.
Just do cargo add conda_share and start coding.
Good question. Make sure conda is installed on the computer and then just run the following command.
# Make sure to replace <env_file> with the yaml file path
conda env create -f <env_file>
If you want it to also show up in jupyter-lab, you will need to run the following commands as well. You may need to restart your jupyter-lab server after it is added.
# Make sure to replace <env_name> with the environment name
conda activate <env_name>
conda install ipykernel
python -m ipykernel install --user --name <env_name>
rustup default stable; rustup updatecargo build -r in the repo.conda-share executable from target/release/conda-share to your normal executable location.maturin build --release --sdist --manifest-path conda_share_py/Cargo.toml in the repo.target/wheels folder to see the newly build .whl files.pip install target/wheels/<my_whl_file>.whlIf you are building for an actual github release, please make sure to run these three commands locally BEFORE making the release!!!
cargo build
cargo publish --dry-run -p conda_share
maturin build --release --sdist --manifest-path conda_share_py/Cargo.toml