Skip to content

Instantly share code, notes, and snippets.

@Mukei
Forked from luiscape/install_packages.sh
Last active November 27, 2017 01:56
Show Gist options
  • Save Mukei/604fb967015fc6c2d43ad1dbd342b038 to your computer and use it in GitHub Desktop.
Save Mukei/604fb967015fc6c2d43ad1dbd342b038 to your computer and use it in GitHub Desktop.
Install Python dependency packages from requirements.txt using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
#
conda install --yes --file requirements.txt
#
# To go around issue above, one can
# iterate over all lines in the
# requirements.txt file.
#
while read requirement; do conda install --yes $requirement; done < requirements.txt
#
# Error often occurs when a package is not available.
# Below, in case a package is not available through conda,
# it will take it through pip
#
while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment