Failed to Load the Native TensorFlow Runtime: The Unofficial Troubleshooting Guide

Sometimes TensorFlow will seem to be installed correctly with pip only to fail when you try to import the package with the message:

Failed to load the native TensorFlow runtime.

There are a few common reasons for this error.

Built from source

Sometimes you see this error when TensorFlow is built from source incorrectly. You might be able to work around it by starting your Python interpreter in the folder you built from.

Otherwise, I recommend the following steps:

  1. Uninstall TensorFlow
  2. Re-install the pre-built package in a separate environment

Incompatible libraries

Other times, this error occurs because some library on your system doesn’t fit the TensorFlow requirements. A couple common culprits are:

Hardware requirements

You will also get this error if you use an older CPU that doesn’t support AVX instructions.

In this case, your options are basically to do one of the following:

  1. Use an older version of TensorFlow: pip install tensorflow<1.6 (this requires Python 3.6 or lower)
  2. Build TensorFlow from source without AVX instructions

Was this error caused by something else for you? Leave a comment below and I’ll try to help you work through it!

Hello, my name is Ben Cook

I help data scientists deploy their code. If there's any way I can serve you, don't hestitate to reach out. You can also find out a little more about me or download my free guide: 8 Best Practices for Building Machine Learning Pipelines.

Thanks for stopping by!


Get in touch


Free Guide

Download my free guide: 8 Best Practices for Building Machine Learning Pipelines