jdbrody
jdbrody

Reputation: 513

Numpy API version mismatch

I'm trying to install tensorflow from source on a Gentoo system (I think I need to do this to get it to use CUDA 9.1).

I'm able to build tensorflow, and then install it as a user with:

pip3 install --no-cache-dir --user /tmp/tensorflow_pkg/tensorflow-1.6.0rc1-cp35-cp35m-linux_x86_64.whl

When I try to import tensorflow I get:

>RuntimeError                         Traceback (most recent call last)
>RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
>
>ImportError                           Traceback (most recent call last)
>ImportError: numpy.core.multiarray failed to import
>
>ImportError                         Traceback (most recent call last)
>ImportError: numpy.core.umath failed to import
>
>ImportError                        Traceback (most recent call last)
>ImportError: numpy.core.umath failed to import

So my guess is that tensorflow was built against a different version of numpy than my system default (1.13.3).

The question is how to fix it? There's a lot about this process that's unfamiliar to me, so I would be grateful for any pointers in doing any of the following:

  1. Telling the tensorflow build to use the system-wide numpy. Tensorflow uses bazel for the build process
  2. Figure out what version of numpy tensorflow wants and change my system numpy to that.
  3. Something else??? I can't do much with pip on a system-wide level because pip and Gentoo don't get along. I tried installing via Anaconda but then tensorflow couldn't see my gpus. Installing in a virtualenv with pip (which used to work) didn't work, I think because I've got cuda 9.1 installed. Perhaps I should downgrade to 9.0???

Any help appreciated!

Upvotes: 4

Views: 4839

Answers (1)

jdbrody
jdbrody

Reputation: 513

Someone I always figure out how to do something the second after I post on SO! I installed into a virtualenv and did pip3 install --upgrade numpy in the virtualenv. All appears to be well...

Upvotes: 6

Related Questions