The anaconda python framework includes its own Qt shared libraries, among other ones. Because of the nature of the framework, it must appear first in the PATH
environment variable so its python binaries have preference over the system's ones.
This creates a conflict when one would like to use the system's Qt shared libraries for projects having nothing to do with python. When compiling a Qt project, it will use the qmake
binary from anaconda along with its shared libraries.
One can force to use the qmake
binary by prepending its path to the PATH
variable, but this doesn't work with the shared libraries. I tried changing the LD_LIBRARY_PATH
but it keeps choosing the anaconda ones.
"Solutions" I found:
- LD_PRELOAD: Force the .so that uses the Qt shared libs to use the system ones by adding them one by one to the LD_PRELOAD env var. This ended up being tedious and time consuming.
- Mess with Anaconda: Delete everything Qt related from anaconda as advised here. This seems too dirty and error prone in the future if one wants to develop GUI applications in python.
- Anaconda Qt > System Qt: Use the anaconda Qt instead of the system Qt. This seems like a wrong assignment of responsibilities. My Qt project that has nothing to do with python should not be coupled to my anaconda install. They should be independent of one another.
- Change modus operandi: Instead of all my shells having the anaconda path prepended to the
PATH
variable, have an easily available script that prepends it whenever I need it, as advised here. The problems are that I'm used to having my python binaries always readily available and that it's prone to mistakes when I'm using the system's python binaries unknowingly. - Move anaconda: Temporarily moving the anaconda folder so it can't be found in the path. It's the quickest one but it relies too much on my memory to fix everything after I finish using the system Qt libraries.
Qt is not the only "not python" package included by anaconda by default, so any "real" solution a priori may be applied to any other conflicting ones.
ldconfig
command after settingLD_LIBRARY_PATH
so the changes get applied? I always forget to do it.