Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be a best practice workflow for creating python environments with Anaconda?

I am trying to set up a standardized workflow for python development for data science. I came across, the popular, Anaconda distribution. But I could not find good documentation on how to setup the workspace.

I created an environment.yml file with the following contents in /workspace/aws-scripts

name: aws-scripts
dependencies:
  - python=3.*
  - boto3

When I created the environment,

conda env create -f environment.yml -p $PWD

the directory structure created is this:

.
├── bin
├── conda-meta
├── environment.yml
├── include
├── lib
├── share
└── ssl

6 directories, 1 file

Should the git ignore file include all the 6 directories that are created?

The default Anaconda prefix is ~/anaconda3/envs. When I changed the prefix for just this workspace, I no longer could list this as an environment using

conda info --envs

Appreciate any help!

like image 319
NaveenBabuE Avatar asked Dec 31 '25 16:12

NaveenBabuE


1 Answers

Conda environments are used to have isolated setup in terms of Python version and installed libraries. There are not the place to put your own source code. So keep them in the default location ~/anaconda3/envs and do not version control this third party code. Put our own code in the directory /workspace/aws-scripts and use version control there. You can always re-create a conda environment by exporting all settings as a yaml file and using this file to create a new conda environment somewhere else.

like image 180
Mike Müller Avatar answered Jan 03 '26 07:01

Mike Müller



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!