Numpy: ImportError: libopenblasp-r0-39a31c03.2.18.so: cannot open shared object file: No such file or directory

Created on 21 Sep 2016  ·  18Comments  ·  Source: numpy/numpy

I can use numpy before, but suddenly it broke down. I don't know why. Can somebody help me? I recently installed tensorflow using anaconda
`
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import numpy
Traceback (most recent call last):
File "", line 1, in
File "/home/chentao/software/anaconda2/lib/python2.7/site-packages/numpy/init.py", line 180, in
from . import add_newdocs
File "/home/chentao/software/anaconda2/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/home/chentao/software/anaconda2/lib/python2.7/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/home/chentao/software/anaconda2/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/home/chentao/software/anaconda2/lib/python2.7/site-packages/numpy/core/__init__.py", line 14, in
from . import multiarray
ImportError: libopenblasp-r0-39a31c03.2.18.so: cannot open shared object file: No such file or directory
`

Other

Most helpful comment

For me @cjsg 's solution didn't work, but 1 of the following did (on Ubuntu 16.04):
conda install -c conda-forge numpy or
conda install -c anaconda numpy

https://anaconda.org/conda-forge/numpy
https://anaconda.org/anaconda/numpy

All 18 comments

Can you post this to the list? That is the proper place to ask questions. You might also ask the anaconda folks.

@charris what do you mean by list?

I suspect this is the problem that Stefan vdW was referring to here : https://github.com/scipy/scipy.org/pull/179#issuecomment-247179912

Maybe try reinstalling numpy with conda?

Thanks, @charris @matthew-brett I have solved this by replacing the numpy folder anaconda2/lib/python2.7/site-packages with numpy folder in anaconda2/envs/tensorflow/lib/python2.7/site-packages

I suspect there is some issue here for us to fix... the problem is that they installed the official wheel we distribute and somehow it's broken -- AFAIK it shouldn't be possible to get that error message, so something mysterious is going on.

Of course installing the numpy wheel into an anaconda environment is generally going to break that environment in the long run because of conda limitations (and I guess it's some kind of anaconda bug if pip install tensorflow inside an anaconda environment gets confused and thinks numpy isn't installed?), but after installing the wheel then importing numpy _ought_ to work without missing files, and if multiple people are hitting it then we probably will have to figure it out eventually...

I'm having the same problem in conda environments, and they started only when I installed tensorflow with gpu support.

Weirdly, if you install numpy with pip first, then conda installs it again if you install something that requires it (like matplotlib) and everything works fine.

I am having the same problem when i upgraded to gpu tensorflow, did anyone solve this problem?

I suspect there is some issue here for us to fix... the problem is that they installed the official wheel

@njsmith how did you deduce that it was a wheel install? The conda-forge numpy seems more likely, that's also built against OpenBLAS.

All, can you check exactly which numpy version you have installed and if it was installed by conda or pip?

@rgommers: because libopenblasp-r0-39a31c03.2.18.so is a mangled name generated by auditwheel, and I don't think conda-forge uses auditwheel. AFAIK the only way to get that error message is by trying to import the official numpy wheel builds.

@rgommers: because libopenblasp-r0-39a31c03.2.18.so is a mangled name generated by auditwheel, and I don't think conda-forge uses auditwheel

Ah, makes sense. Indeed, no auditwheel usage in the conda-forge build.

Mixing numpy wheels with conda should never be done. Conda special-cases numpy and builds all packages against the numpy version that is going to be installed. For pip wheels that's not the case, so that has the potential for serious breakage.

Ah, this must be the problem: https://github.com/conda-forge/tensorflow-feedstock/blob/master/recipe/build.sh. The conda package is a repackaged wheel rather than a build from source. So that's linked to a numpy that's then not available. Not sure exactly how to get the traceback reported here, but it looks unhealthy.

That does look suspicious, but I still don't understand how it could cause numpy's numpy/core/multiarray.so to become disconnected from numpy/.libs/libopenblasp-r0-39a31c03.2.18.so. And I just downloaded the tensorflow 1.1.0 py36 wheel, and it doesn't seem to have any auditwheel-generated imports in it...

I suspect that conda first installs numpy in anaconda2/lib/python2.7/site-packages/numpy, and pip then overwrites that same location, putting .libs/libopenblasp-r0... there, then conda puts the right numpy version back. Or some variant of that - they're installing to the same location.

@JohnnyRisk @acbellini can you please give us the exact install commands you used before the issue occurred?

Any news on this problem and how to solve it?
I have the same problem after having installed tensorflow1 with gpu as recommended on the official installation guidelines here , section 'Installing with Anaconda'.
I created a new conda environment, opened it, and then did:
pip install --ignore-installed --upgrade $TF_BINARY_URL
where I set TF_BINARY_URL to https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp34-cp34m-linux_x86_64.whl .
Since then, I can't import numpy outside of the conda environment. (Though I can import numpy inside the environment. I guess that inside the environment, i am importing the pip version of numpy, and outside, the conda version somehow got broken by the installation of the pip version, which came with the installation of tensorflow).

I had the same issue--installed tensorflow in a new conda environment, and then numpy in my old environment quit working. What fixed the old environment for me was removing numpy in that environment (conda uninstall numpy), reinstalling it with pip (pip install numpy), then installing over top of that with conda (conda install numpy). I'm not entirely clear why that worked, but it does. Simply uninstalling with conda and then reinstalling with conda did not work.

Thanks @devonbrackbill , it worked!
For the record: I actually did a second iteration of uninstalling/reinstalling, because I suspected python to use the pip numpy package. So, after doing what you said, here is what I did, and the somewhat weird outputs that I got:
pip uninstall numpy, which somehow uninstalled:
.../anaconda3/lib/python3.6/site-packages/numpy
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1-py3.6.egg-info
(numpy packages right?) and broke numpy. Then
conda uninstall numpy which still removed
numpy: 1.13.1-py36_0
'pip uninstall numpy' , which removed:
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/DESCRIPTION.rst
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/INSTALLER
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/METADATA
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/RECORD
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/WHEEL
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/metadata.json
.../anaconda3/lib/python3.6/site-packages/numpy-1.13.1.dist-info/top_level.txt
conda install numpy
and now it works!

For me @cjsg 's solution didn't work, but 1 of the following did (on Ubuntu 16.04):
conda install -c conda-forge numpy or
conda install -c anaconda numpy

https://anaconda.org/conda-forge/numpy
https://anaconda.org/anaconda/numpy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ricardoV94 picture ricardoV94  ·  53Comments

khinsen picture khinsen  ·  88Comments

mrava87 picture mrava87  ·  53Comments

olebole picture olebole  ·  60Comments

jakirkham picture jakirkham  ·  55Comments