@@ -77,6 +77,30 @@ detect_installed_packages() {
7777}
7878
7979
80+ # Determine whether we have a Conda environment with mixed packages
81+ #
82+ # Users of Anaconda have the Anaconda channels set by default, and if they then add
83+ # conda-forge and start installing packages will too often end up with some packages
84+ # from one source and some from the other. This leads to some very weird errors.
85+ #
86+ # This checks whether everything is installed either from conda-forge or by pip, and
87+ # sets MIXED_CONDA_PACKAGES to a list of packages that are not from conda-forge or pip.
88+ # If we're not in a conda environment or everything is fine, then MIXED_CONDA_PACKAGES
89+ # will be an empty string.
90+ check_mixed_conda_packages () {
91+ MIXED_CONDA_PACKAGES=" "
92+ if [ " a${ENV_TYPE} " = " aconda" ] ; then
93+ ALIEN_PACKAGES=" $( echo " ${CONDA_LIST} " | tr ' ^' ' \n' | grep -v ' ^#.*\|conda-forge\|pypi' | cut -d ' ' -f 1,4) "
94+ if [ " a${ALIEN_PACKAGES} " != " a" ] ; then
95+ MIXED_CONDA_PACKAGES=' '
96+ for p in ${ALIEN_PACKAGES} ; do
97+ MIXED_CONDA_PACKAGES=" ${MIXED_CONDA_PACKAGES} ${p} "
98+ done
99+ fi
100+ fi
101+ }
102+
103+
80104# Determine if we have the required features to build the framework
81105#
82106# This uses the following variables:
@@ -212,6 +236,7 @@ find_packages() {
212236analyse_environment () {
213237 detect_environments
214238 detect_installed_packages
239+ check_mixed_conda_packages
215240 check_build_framework
216241 check_build_sapporo_light
217242 find_packages
0 commit comments