I'm trying to deploy a flask app on a debian server using Machine Learning libs, i managed that so far with most ML libraries but i got this error thanks to TensorFlow which i researched a lot about it with no working solution for me.
PS : I'm using a 3.7 python venv for my app
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /flask/wstest/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so) Mar 01 15:32:11 django gunicorn[8803]: Failed to load the native TensorFlow runtime.
I'm clearly missing the GLIBCXX 3.4.21 because strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
shows 3.4.20 as the latest version.
Tried this fix add-apt-repository ppa:ubuntu-toolchain-r/test
Gives this :
result of the toolchain add attempt
Tried apt-get update, Got this
W: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
Also tried to update libgcc and libstdc++6, says i have the latest version.
EDIT : I'm suspecting that Debian 8 Jessie doesn't support a higher glibcxx version than the 3.4.20.
Here's a solution for this problem in Ubuntu 16.04
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
You can check if you get GLIBCXX desired version like this:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
If you're using Anaconda/Miniconda, you can also get your OS to use the libstdc++.so.6
provided with your installation by setting your LD_LIBRARY_PATH
environment variable. Say you have Miniconda installed in /home/whatever/miniconda3
and you're using bash
. Then add this to your ~/.bashrc
:
export LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/:/home/whatever/miniconda3/lib
or
export LD_LIBRARY_PATH=/home/whatever/miniconda3/lib
source ~/.bashrc
or restart your shell and you should be good to go.
See also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths and How to update libstdc++.so.6 or change the file to use on Tensorflow, Python .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With