-
-
Save Mukei/604fb967015fc6c2d43ad1dbd342b038 to your computer and use it in GitHub Desktop.
Install Python dependency packages from requirements.txt using conda.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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