Skip to content

Instantly share code, notes, and snippets.

@krokrob
Last active August 6, 2021 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krokrob/f833e9fd734bc9a4cdd0c6a9cd0b545b to your computer and use it in GitHub Desktop.
Save krokrob/f833e9fd734bc9a4cdd0c6a9cd0b545b to your computer and use it in GitHub Desktop.
REQUIRED=('pytest' 'pylint' 'ipdb' 'PyYAML' 'nbresult' 'autopep8' 'flake8' 'yapf' 'lxml' 'requests' 'bs4' 'jupyterlab' 'pandas' 'matplotlib' 'seaborn' 'plotly' 'scikit-learn' 'tensorflow' 'nbconvert' 'xgboost' 'statsmodels' 'pandas-profiling' 'jupyter-resource-usage' 'dtale')
PACKAGES=$(pip freeze)
PACKS=()
while read -r line; do
PACKS+=("$line")
done <<< "$PACKAGES"
missing=()
for r in ${REQUIRED[@]}; do
present=0
for p in ${PACKS[@]}; do
if (($present == 0)); then
q=${p//==[0-9|\.]*/}
if [ $r = ${q} ]; then
present=1
fi
fi
done
if (($present == 0))
then
missing="${missing} ${r}"
fi
done
if (( ${#missing[@]} )); then
sentence='Try to `pip install '
sentence+=$missing
sentence+='` again.'
echo '❌ Some packages are missing:'
echo $sentence
else
echo '✅ Everything is fine, continue the setup intructions.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment