Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a conda environment file without local development packages?

Tags:

pip

conda

I have a conda environment with packages installed via conda install. I also have two local development packages that were each installed with pip install -e .. Now, conda env export shows everything, including both local development packages. However, I don't want conda to include them when creating the same environment on other machines - I want to keep doing it via pip install -e ..

So how can I exclude both local packages when creating the environment.yml file? Do I need to manually remove them or is there a way to this from the command line?

like image 266
olamarre Avatar asked Dec 20 '25 19:12

olamarre


1 Answers

While there are some alternative flags for conda env export that change output behavior (e.g., --from-history is most notable), there really isn't anything as specific as OP describes. Instead, manually remove the offending lines.

Note that YAMLs do support all pip install commands, so the editable installs can also be included. For example, https://stackoverflow.com/a/59864744/570918.

Consider Prioritizing the YAML Specification

In a software engineering setting, I would expect that users should not even be hitting development environments with conda install or pip install commands. Instead, the team should have a maunally-written, version-controlled YAML to begin with and all installations/changes to the environment are managed through editing the YAML file and using conda env update to propagate changes in the YAML to the environment.

That is, conda env export should not be necessary because the environment already has a well-defined means of creation.

like image 116
merv Avatar answered Dec 23 '25 22:12

merv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!