4

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

  • Did you executed ldconfig command after setting LD_LIBRARY_PATH so the changes get applied? I always forget to do it. – r1verside Jan 5 '18 at 3:45
  • 3
    File bugs with the anaconda Qt devs asking them to stop bundling stuff with their software. This hostility to the OS, the attitude that the system is nothing but a terrible obstruction to our glorious code which must be ignored, worked around, and subverted is the worst thing about python (and ruby and some other languages). Bundling is not only lazy and arrogant, it's actively harmful. – cas Jan 5 '18 at 3:47
0

Simple do not activate conda by default. Modify .bashrc to activate conda only if you want it to be activated. This way you fully separate it from the system... At least this works on Linux and osx. No idea about windows.

  • Welcome to Unix.SE! Could you edit your answer to show more details of how to go about what you’re describing? Since it’s simple, it shouldn’t be hard to explain ;-). – Stephen Kitt Mar 27 at 14:48
  • If I'm not mistaken, that corresponds to my solution 4 – Alechan Mar 28 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.