Skip to content Skip to sidebar Skip to footer

Tensorflow Import Causing Numpy Calculation Errors

I'm learning the basics of TensorFlow thru an example of linear regression. Performing the linear regression with scikit-learn works well: import numpy as np from sklearn.datasets

Solution 1:

The Anaconda distribution uses Intel's Math Kernel Libraries (MKL) by default which seems to result in multiple issues with Numpy and SciPy when used in conjunction with TensorFlow as reported in this issue and in other referenced issues.

Re-installing Numpy and SciPy from pip resolves the issue:

First, create a new environment with the required packages using conda:

$ conda create--name env_name python=3.5 tensorflow-gpu scikit-learn

Activate the environment:

$ source activate env_name

Re-install Numpy and SciPy using pip:

$ pip install --ignore-installed--upgrade numpy scipy

The drawback to this is that you cannot benefit from the performence increase provided by the MKL. As an example, a support vector machine built with Scikit-Learn that takes 6 minutes to train with MKL trained in 11 minutes in an environment without MKL. You can however create another environment that has MKL (by default) to use when TensorFlow is not required.

Post a Comment for "Tensorflow Import Causing Numpy Calculation Errors"