22

I am trying to use the One Million Song Dataset, for this i had to install python tables, numpy, cython, hdf5, numexpr, and so.

Yesterday i managed to install all i needed, and after having some troubles with hdf5, i downloaded the precompiled binary packages and saved them in my /bin folder, and the respective libraries in /lib , after that i tested this python script : http://labrosa.ee.columbia.edu/millionsong/sites/default/files/tutorial1.py.txt

and it worked fine, to be clear the way i made it work was to first run the script and start installing the needed dependencies, but today i restarted my laptop and it didn't work, now it throws me this error on the console :

python2.7 script.py 

returns :

import numpy as np # get it at: http://numpy.scipy.org/
from . import random
from .mtrand import *
ImportError: /home/francisco/.local/lib/python2.7/site-packages/numpy/random/mtrand.so: undefined symbol: PyFPE_jbuf

seems to me that there is a missing variable in such file, my guess is that the script is looking for the numpy library in the wrong place, since i made so many failed installations maybe i broke something and it only worked out because it was loaded in the temporal memory of the computer.

I tried installing Anaconda, and i created a new environment and installed the packaged with the anaconda package manager, and even thought i listed all packaged and it returns :

# packages in environment at /home/francisco/anaconda2/envs/Music:
#
biopython                 1.66                np110py27_0  
cython                    0.23.4                    <pip>
hdf5                      1.8.15.1                      2  
mkl                       11.3.1                        0  
numexpr                   2.5                 np110py27_0  
numpy                     1.10.4                   py27_1  
openssl                   1.0.2g                        0  
pillow                    3.1.1                     <pip>
pip                       8.1.1                    py27_0  
pytables                  3.2.2               np110py27_1  
python                    2.7.11                        0  
python-ldap               2.4.25                    <pip>
readline                  6.2                           2  
reportlab                 3.3.0                     <pip>
requirements              0.1                       <pip>
setuptools                20.3                     py27_0  
sqlite                    3.9.2                         0  
tables                    3.2.2                     <pip>
tk                        8.5.18                        0  
wheel                     0.29.0                   py27_0  
zlib                      1.2.8                         0  

i still get the same error. I really need help and don't know what else to try. Thanks.

frammnm
  • 537
  • 1
  • 5
  • 17

7 Answers7

33

I had the same problem, probably you have installed numpy without Anaconda, so there is a conflict because of this, which numpy to use: that one installed with pip or with conda. When I removed non-Anaconda numpy, error gone.

pip uninstall numpy
alperovich
  • 854
  • 1
  • 9
  • 14
11

For cython users:

This post was helpful. The post explains, that there is some flag (--with-fpectl), which is either set during the compilation of cpython or not. When a library has been compiled using a cpython without that flag, it is incompatible to a version with that flag being set. This effect does only show up when you use cython, as numpy itself does not use this extension.

As further stated in that post, my Ubuntu 16.04 has been created with this flag and Conda without it. For me, it was specifically the module hmmlearn throwing the undefined symbol error. This must be the case because it was shipped by Ubuntu with the flag being set and not by anaconda. So I uninstalled hmmlearn and manually installed it anew from sourcescode (Anaconda, unfortunately, does not offer hmmlearn). --> Works!

BaluJr.
  • 1,010
  • 2
  • 11
  • 25
5

irony at it's best, i restarted my laptop without doing nothing, and it worked. Can't understand why.

frammnm
  • 537
  • 1
  • 5
  • 17
5

I agree with previous posts that this seems to be caused by having multiple versions of numpy installed. For me, it wasn't enough to just use pip, as I also had multiple versions of pip installed.

Specifying the specific pip solved the problem:

/usr/bin/pip3 uninstall numpy
eatcrayons
  • 1,542
  • 15
  • 17
0

Initially, I installed cython using system /usr/bin/pip and anconda pip. I uninstalled system cython using system pip and reinstalled using conda install cython. Works now.

r3t2
  • 85
  • 6
0

First remove numpy from /usr/local/lib/python2.7/dist-packages/numpy-1.11.0-py2.7-linux-x86_64.egg and then use the following command

sudo pip install numpy scipy

I had solve this error in my case.

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
0

I ran into this problem in a particular situation. Using Anaconda (3 I think) I was creating a new environment. Previously I had created a py3 env with numpy, Not sure if related. But when creating my new py2.7 environment I went to install a particular package Ta-lib via pip, but then had this same Question's import error relating to numpy for the particular case of Ta-lib.

From this post Gaurav suggested the use of pip flag --no-cache-dir to ensure a rebuild during install of numpy. I uninstalled my Ta-lib and numpy and then reinstalled them with this flag via pip and everything worked great.

DMTishler
  • 501
  • 1
  • 6
  • 12