Forums

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found

Hi all,

I've managed to install the latest Miniconda (with Python 3.7.5) on my account, and I've managed to set it as a virtualenv for my web app.

I've installed RDKit, which I want to use with my web app, but get the following ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /home/timmonspatrick/miniconda3/lib/python3.7/site-packages/rdkit/DataStructs/../../../../libRDKitDataStructs.so.1)

RDKit works ok and calculates things as required when started in the console, but only fails when imported in the web app. Any suggestions on how to get it working?

Thanks in advance!

Your web app is not running in the miniconda environment, so it cannot access the libraries available there. We do not have a way to use miniconda environments in web apps.

Are you certain? I've managed to install some packages with conda, and they import fine and are available through the web app. It's only the libstdc++ library that is causing an issue.

Sorry, let me restate what @glenn was saying more precisely -- we're not aware of any way in which a website running on PythonAnywhere could pick up stuff that is written in C from a Miniconda environment. Pure Python packages may well work if you have the sys.path set correctly, but C libraries are loaded using the value of the LD_LIBRARY_PATH variable (and other OS-level library-location configuration) at the time the process is started. When you have a website running on PythonAnywhere, we don't have any hooks in place to configure that so that it could point to your conda environment. Additionally, the Python version that you're using is loaded via a plugin that we have to build as part of your system image, so if you had a different version of Python itself installed in your conda environment, it would (I believe) not be used, so even if we could load up the C extensions, they might not be compatible with the version of Python that is actually running.

So, assuming that I'm not mistaken about the above, I'd expect that what you'd see is that pure Python modules would be loading OK, and so would ones that happen to have their C libraries installed into the global system library directories (eg. /usr/lib). But ones that depend on C libraries that conda has installed would not work. Does that match up with what you're seeing?

I actually managed to get things working the way I need them to work. I'm not really a computer science guy, so my terminology on environments etc isn't very precise, but I'll give it a shot to describe what's happening.

I've set the virtualenv parameter in the Web Apps tab to direct to /home/timmonspatrick/miniconda3, which is my miniconda installation directory. I've installed RDKit and other modules with conda, which makes them available to Anaconda python interpreter. I haven't changed the PATH settings; if I unset the virtualenv parameter and revert to using the system python, the conda installed modules are not found.

The problem lay with getting the C libraries to work. The system version of libstdc++.so.6 was a simlink which pointed to libstdc++.so.6.0.19, which does not provide CXXABI_1.3.11, which is required by libRDKitDataStructs.so.1. The miniconda installation provides its own libstdc++.so.6, which simlinks to its own libstdc++.so.6.0.26, but the system one located in /usr/lib/x86_64-linux-gnu is discovered ahead of the one in the miniconda installation.

I downloaded libRDKitDataStructs.so.1, (well actually the file that this simlinked to), opened it with Notepad++, replaced all references to libstdc++.so.6 with references to libstdd++.so.6 (important to retain the same number of bytes in the file, hence just changed one letter), and created libstdd++.so.6 as a simlink inside the miniconda3 directory to the miniconda provided libstdc++.so.6.0.26. Because the system itself does not provide a file named libstdd++, the one I created in the miniconda directory gets discovered instead, and links to the anaconda version of libstdc++, and the code works. (Well, technically I had to replace the libstdc++ references in 50 other .so files, but then it worked).

I'm pretty sure that the python interpreter is still the system one, as the output of sys.version gives a different result than the anaconda python invoked from Bash, but as long as the conda packages work I'm happy.

Thanks for your help @glenn and @giles, really appreciated it :)

Great! Glad you worked out a solution.

@timmonspatrick Could you give me instruction for miniconda3 installation on the account and setting it as a virtualenv. I'm going to use RDKit package for my django app to work with SMILES string and other chemical properties. But RDkit installation is only done by using 'conda'. Thanks in advance!

I see a RDKit on pypi- seems like you can pip install it?

Thank you! @conrad. I think I should use alternative packages that can be installed with pip.