Conda interfering with system libraries

January 29, 2020


Every now and then I get very strange errors saying libraries are not found when they are when attempting to build a project.


The latest variant of this was pkg-config giving errors saying that library x could not be found when apt was claiming it was installed (and it was).


Since I've had conda mess with stuff in the past I had a hunch this was the case now. A quick check of shows why:


~$ pkg-config --cflags gtkmm-3.0
-pthread -I/usr/lib/include/gtkmm-3.0 -I/usr/lib/lib/x86_64-linux-gnu/gtkmm-3.0/include -I/usr/lib/include/atkmm-1.6 -I/usr/lib/include/gtk-3.0/unix-print -I/usr/lib/include/gdkmm-3.0 -I/usr/lib/lib/x86_64-linux-gnu/gdkmm-3.0/include -I/usr/lib/include/giomm-2.4 -I/usr/lib/lib/x86_64-linux-gnu/giomm-2.4/include -I/usr/lib/include/pangomm-1.4 -I/usr/lib/lib/x86_64-linux-gnu/pangomm-1.4/include -I/usr/lib/include/glibmm-2.4 -I/usr/lib/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/lib/include/gtk-3.0 -I/usr/lib/include/at-spi2-atk/2.0 -I/usr/lib/include/at-spi-2.0 -I/usr/lib/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/lib/include/gtk-3.0 -I/usr/lib/include/gio-unix-2.0/ -I/usr/lib/include -I/usr/lib/include/cairo -I/usr/lib/include -I/usr/lib/include/pango-1.0 -I/usr/lib/include/harfbuzz -I/usr/lib/include/pango-1.0 -I/usr/lib/include/atk-1.0 -I/usr/lib/include/cairo -I/usr/lib/include/cairomm-1.0 -I/usr/lib/lib/x86_64-linux-gnu/cairomm-1.0/include -I/usr/lib/include/cairo -I/usr/lib/include/pixman-1 -I/usr/lib/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/lib/include -I/usr/lib/include/freetype2 -I/usr/lib/include/libpng16 -I/usr/lib/include -I/usr/lib/include/sigc++-2.0 -I/usr/lib/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/lib/include/gdk-pixbuf-2.0 -I/usr/lib/include/libpng16 -I/usr/lib/include -I/usr/lib/include/glib-2.0 -I/usr/lib/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/include -I/home/myuser/miniconda3/include


The last include there -I/home/myuser/miniconda3/include meant that it was mixing system libs and conda's root env libs.


A hackish yet quick and easy workaround is to temporarily move miniconda3 to a different folder so any include / lib paths then become invalid then move it back when the build is finished.


Hope it helps, Cheers!