CSTR-Edinburgh / merlin

This is now the official location of the Merlin project.
http://www.cstr.ed.ac.uk/projects/merlin/
Apache License 2.0
1.31k stars 442 forks source link

TypeError: No loop matching the specified signature and casting was found for ufunc add #470

Open Hallicopter opened 5 years ago

Hallicopter commented 5 years ago

I saw another issue (#466 ) with the same problem, but that fix did not work for me. Here is the error dump

Traceback (most recent call last):
  File "/home/advait/Documents/Merlin/merlin/src/run_merlin.py", line 1320, in <module>
    main_function(cfg)
  File "/home/advait/Documents/Merlin/merlin/src/run_merlin.py", line 1020, in main_function
    valid_dur_rmse, valid_dur_corr = calculator.compute_distortion(valid_file_id_list, ref_data_dir, gen_dir, cfg.dur_ext, cfg.dur_dim)
  File "/home/advait/Documents/Merlin/merlin/src/utils/compute_distortion.py", line 206, in compute_distortion
    dur_corr = self.compute_corr(ref_all_files_data, gen_all_files_data)
  File "/home/advait/Documents/Merlin/merlin/src/utils/compute_distortion.py", line 257, in compute_corr
    corr_coef = pearsonr(ref_data, gen_data)
  File "/home/advait/.local/lib/python3.6/site-packages/scipy/stats/stats.py", line 3410, in pearsonr
    xmean = x.mean(dtype=dtype)
  File "/usr/local/lib/python3.6/dist-packages/numpy/core/_methods.py", line 75, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims)
TypeError: No loop matching the specified signature and casting
was found for ufunc add
mirfan899 commented 4 years ago

Okay, I got the issue fixed on another VM by doing the following steps. I've installed these globally.

# for Python 3
sudo apt-get install csh
sudo apt-get install python3-numpy python3-scipy
# Install bandmat for Python3
sudo pip3 install bandmat

Create virtualenv

virtualenv --system-site-packages merlin
source merlin/bin/activate
pip install numpy==1.16
pip install matplotlib scipy keras theano tensorflow
TakedaHiromasa commented 4 years ago

Hi, I recently encountered the same problem. I tried the method suggested in #466, but it did not work. The method proposed here (#470) has not been successful in my case.

I solved it using another method in the following environment. Ubuntu 18.04 Python 3.6.10

pip list

Package            Version          
------------------ -----------------
bandmat            0.7              
cycler             0.10.0           
Cython             0.29.15          
kiwisolver         1.1.0            
lxml               4.5.0            
Mako               1.1.2            
MarkupSafe         1.1.1            
matplotlib         3.1.3            
nose               1.3.7            
nose-parameterized 0.6.0            
numpy              1.17.5           
pip                20.0.2           
pygpu              0.7.6+20.g9cec614
pyparsing          2.4.6            
python-dateutil    2.8.1            
scipy              1.2.3            
setuptools         40.6.2           
six                1.14.0           
Theano             1.0.4  

The important thing here is the version of scipy. It did not work with scipy==1.4.1 installed usingpip install scipy, but seems to work with scipy <1.3.0! I have confirmed that it works correctly with the latest version of scipy 1.2.x, scipy==1.2.3. So a good thing may happen if you run pip install scipy==1.2.3 : )

If it doesn't work, try adding pip install numpy==1.17.5 as well.

mapfiable commented 4 years ago

I know this is technically not a fix, but at least it is a workaround that worked for me. I encountered this problem trying to run np.mean() of an array of floats, although the dtype of the array was object and not float. So all I did was make a new array from the old one with dtype=float. np.asarray(dtype=float) did not do the trick for me. Of course this is extra computational time down the drain.

BeastyZ commented 4 months ago

Hi, I recently encountered the same problem. I tried the method suggested in #466, but it did not work. The method proposed here (#470) has not been successful in my case.

I solved it using another method in the following environment. Ubuntu 18.04 Python 3.6.10

pip list

Package            Version          
------------------ -----------------
bandmat            0.7              
cycler             0.10.0           
Cython             0.29.15          
kiwisolver         1.1.0            
lxml               4.5.0            
Mako               1.1.2            
MarkupSafe         1.1.1            
matplotlib         3.1.3            
nose               1.3.7            
nose-parameterized 0.6.0            
numpy              1.17.5           
pip                20.0.2           
pygpu              0.7.6+20.g9cec614
pyparsing          2.4.6            
python-dateutil    2.8.1            
scipy              1.2.3            
setuptools         40.6.2           
six                1.14.0           
Theano             1.0.4  

The important thing here is the version of scipy. It did not work with scipy==1.4.1 installed usingpip install scipy, but seems to work with scipy <1.3.0! I have confirmed that it works correctly with the latest version of scipy 1.2.x, scipy==1.2.3. So a good thing may happen if you run pip install scipy==1.2.3 : )

If it doesn't work, try adding pip install numpy==1.17.5 as well.

Using scipy==1.2.3 works for me. Thanks!