Astronomy icon indicating copy to clipboard operation
Astronomy copied to clipboard

environment.yml vs requirements.txt

Open meevans1 opened this issue 5 years ago • 5 comments

Is there a reason you use an environment.yml file? A requirements.txt might build the binder image quicker. Bare in mind I haven't been through your whole repo to check!

meevans1 avatar Aug 06 '20 20:08 meevans1

@meevans1 I'm not sure exactly what the differences are apart from that the yml file is specific to anaconda. I made the yml to make sure the binder image looks exactly like my local conda env so not sure how a txt would work. Found this https://tdhopper.com/blog/my-python-environment-workflow-with-conda which seems to suggest yml is better? I feel like the build time would decrease if I was able to get a dedicated server! (Maybe one day) Do you have experience with requirement.txt files?

astroDimitrios avatar Aug 07 '20 19:08 astroDimitrios

Yes it does look like environment.yml is better. However, I think a requirements.txt could be quicker, and I think this could be more important in your case. I really wouldn't want a student to lose interest and give up if it's taking too long to load. requirements.txt simply pip installs the packages you want, whereas environment.yml creates a whole environment, which is why I think it takes longer. Additionally, do you really need every single package in your current environment.yml? (more packages = more build time). The minimum you need is the packages you import in your notebooks. Any dependencies are installed if needed automatically. Of course, what you do in the end is totally up to you. Yes I have requirements.txt e.g. https://github.com/atlas-outreach-data-tools/notebooks-collection-opendata/blob/no-root/requirements.txt

meevans1 avatar Aug 08 '20 09:08 meevans1

I will look at maybe making requirements.txt files for each activity then (when I'm back in the UK) with only the packages needed for that activity.

The yml at the moment has packages needed to run all the activities at once (it is the bare minimum which I test on Linux and is not the same as my bloated Windows env). Maybe I will keep the yml but try not building the binder with it and see what happens using separate requirements.txt files.

astroDimitrios avatar Aug 08 '20 16:08 astroDimitrios

I don't think you'd need to make a separate requirements.txt file for each activity, only one for the whole Code folder. Do you really need all those packages in your yml? For example, I can't find anywhere you "import seaborn" (I could be wrong, I haven't looked through your whole repo). Like I said, you should only need the packages you "import" within notebooks.

meevans1 avatar Aug 15 '20 16:08 meevans1

Hmm you're right I seem to have added some plotting libraries that I can remove. Seaborn, bokeh, bqplot...

astroDimitrios avatar Aug 16 '20 06:08 astroDimitrios