wav2mid(<https://github.com/jsleep/wav2mid>)  
preprocess.pyを実行しようとしているのですがTypeError: expected string or
bufferというエラーを吐いてどうしても前に進めません

```

    $ python preprocess.py
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site- 
    packages/scipy/linalg/basic.py:17: RuntimeWarning: numpy.dtype size 
    changed, may indicate binary incompatibility. Expected 96, got 88
      from ._solve_toeplitz import levinson
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/linalg/__init__.py:207: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._decomp_update import *
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/special/__init__.py:640: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._ufuncs import *
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/special/_ellip_harm.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/interpolate/_bsplines.py:10: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from . import _bspl
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/lil.py:19: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from . import _csparsetools
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/csgraph/__init__.py:165: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._shortest_path import shortest_path, floyd_warshall, dijkstra,\
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/csgraph/_validation.py:5: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._tools import csgraph_to_dense, csgraph_from_dense,\
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/csgraph/__init__.py:167: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._traversal import breadth_first_order, depth_first_order, \
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/csgraph/__init__.py:169: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._min_spanning_tree import minimum_spanning_tree
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/sparse/csgraph/__init__.py:170: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from ._reordering import reverse_cuthill_mckee, maximum_bipartite_matching, \
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/spatial/__init__.py:95: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from .ckdtree import *
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/spatial/__init__.py:96: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from .qhull import *
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/spatial/_spherical_voronoi.py:18: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from . import _voronoi
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/spatial/distance.py:122: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from . import _hausdorff
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/scipy/ndimage/measurements.py:36: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from . import _ni_label
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/_libs/__init__.py:4: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/__init__.py:26: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import (hashtable as _hashtable,
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/dtypes/common.py:6: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import algos, lib
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/util/hashing.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import hashing, tslib
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/indexes/base.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import (lib, index as libindex, tslib as libts,
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/tseries/offsets.py:21: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      import pandas._libs.tslibs.offsets as liboffsets
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/ops.py:16: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import algos as libalgos, ops as libops
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/indexes/interval.py:32: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs.interval import (
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/internals.py:14: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import internals as libinternals
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/sparse/array.py:33: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      import pandas._libs.sparse as splib
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/window.py:36: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      import pandas._libs.window as _window
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/groupby/groupby.py:68: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import (lib, reduction,
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/core/reshape/reshape.py:30: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import algos as _algos, reshape as _reshape
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/io/parsers.py:45: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      import pandas._libs.parsers as parsers
    /Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pandas/io/pytables.py:50: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      from pandas._libs import algos, lib, writers as libwriters
    Traceback (most recent call last):
      File "preprocess.py", line 11, in <module>
        import librosa
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/__init__.py", line 12, in <module>
        from . import core
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/core/__init__.py", line 104, in <module>
        from .time_frequency import *  # pylint: disable=wildcard-import
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/core/time_frequency.py", line 10, in <module>
        from ..util.exceptions import ParameterError
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/util/__init__.py", line 67, in <module>
        from .utils import *  # pylint: disable=wildcard-import
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/util/utils.py", line 111, in <module>
        def valid_audio(y, mono=True):
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/librosa/cache.py", line 49, in wrapper
        if self.cachedir is not None and self.level >= level:
      File "/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-packages/joblib/memory.py", line 847, in cachedir
        DeprecationWarning, stacklevel=2)
    TypeError: expected string or buffer
    
```

環境  
python2.7.9  
os：mac os high sierra10.13.4  
numpy：1.15.0  
pretty midi：多分最新  
tensorflow:多分１.５  
です。プログラミングも機械学習も初心者同然なのでどなたかご教授いただければ幸いです。
CC BY-SA 4.0
2018-07-24T13:23:35.307
46914
2018-07-24T23:29:19.727
2018-07-24T13:48:01.380
29443
29443
question
python
wav2mid（deep neural networkを用いた採譜モデル）のpreprocess.pyでTypeError: expected string or bufferと怒られる
wav2mid が依存している [librosa](https://github.com/librosa/librosa)
がエラーを出しています。これはライブラリの依存関係が原因のエラーであり、librosa の issue トラッカーで以下のように報告されています。

  * [Librosa doesn't work with python2.7](https://github.com/librosa/librosa/issues/732) #732 -- librosa/librosa

> I suspect something is amiss in your install/environment then. If you have
> the current master branch installed, and joblib 0.12, you shouldn't see this
> error. Our tests pass on py2.7 in this config, so I'm pretty sure whatever's
> wrong isn't internal to librosa.
>
> If you have the stable version installed (via pip), then joblib with 0.11
> should also work. (Notwithstanding any llvm install errors, which you should
> definitely not see, but are also upstream of us.)
>
> If you have current master with joblib 0.11, or pip stable with joblib 0.12,
> it will break in ways listed above.
>
> If all else is failing, I suggest uninstalling librosa and joblib and
> starting fresh. You might need to `pip uninstall librosa` multiple times if
> there are conflicting installations in your environment.
>
> ([bmcfee](https://github.com/bmcfee)
> さんによる[投稿](https://github.com/librosa/librosa/issues/732#issuecomment-401050154),
> 2018 年 6 月 28 日)

このやり取りを見ると、librosa が依存しているライブラリである joblib が 0.12
へバージョンアップされたことに伴うエラーが発生したようです。指示されているように、2 つの解決策があります。

  * 方法1: joblib をダウングレードして 0.11 にする。何経由でライブラリのバージョンを管理されているかにもよりますが、たとえば `pip install 'joblib==0.11' --force-reinstall` を実行する。ただし他に joblib を使っているパッケージがある場合は依存関係に注意する。
  * 方法2: joblib は 0.12 のままに、librosa を現在の master 最新版にする。つまり一度 librosa を `pip uninstall librosa` 等でアンインストールした後、librosa の [README.md](https://github.com/librosa/librosa/blob/master/README.md) に従って librosa のリポジトリを clone し、ソースコードから `pip install` する。

私の Ubuntu + Anaconda Python 2.7 環境ではどちらの方法でも当該のエラーが出なくなることを確認しました。

### 補足: 解決法の見つけ方

  1. エラーメッセージを見るに `import librosa` が失敗しているので、一度それ単体で試してみて、確かに失敗することを確認する。
  2. librosa の issue トラッカーにおいてエラーメッセージの一部で検索し、関連しそうな issue を見つける。今回の場合 "string or buffer" で検索しました。
  3. issue の内容を読み、解決法を探る。
CC BY-SA 4.0
2018-07-24T14:03:47.640
46917
2018-07-24T14:16:18.097
2018-07-24T14:16:18.097
19110
19110
46914
answer
「/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-  
packages/scipy/linalg/basic.py:17: RuntimeWarning: numpy.dtype size  
changed, may indicate binary incompatibility. Expected 96, got 88」  
（直訳：”/Users/nogaminofolder/.pyenv/versions/2.7.9/lib/python2.7/site-  
packages/scipy/linalg/basic.py"の１７行目において、実行時ワーニング： 96のはずのnumpy.dtype
のサイズが88だったので、バイナリに互換性がないのかもしれません）  
というエラーが出ていますから、お使いのパッケージのバージョンを確認してください。

古いバージョンのnumpyを使ってコンパイルされたパッケージが混入している疑いがありそうです。
CC BY-SA 4.0
2018-07-24T23:29:19.727
46923
2018-07-24T23:29:19.727
217
46914
answer