ImportError: cannot import name 'hash_unicode'

944 Views Asked by At

While importing spacy using "import spacy", I am getting this error.

ImportError                               Traceback (most recent call last)
<ipython-input-1-76a01d9c502b> in <module>
----> 1 import spacy

~/.local/lib/python3.6/site-packages/spacy/__init__.py in <module>
      8 
      9 # These are imported as part of the API
---> 10 from thinc.api import prefer_gpu, require_gpu, require_cpu  # noqa: F401
     11 from thinc.api import Config
     12 

~/.local/lib/python3.6/site-packages/thinc/api.py in <module>
     20 from .backends import use_pytorch_for_gpu_memory, use_tensorflow_for_gpu_memory
     21 
---> 22 from .layers import Dropout, Embed, expand_window, HashEmbed, LayerNorm, Linear
     23 from .layers import Maxout, Mish, MultiSoftmax, Relu, softmax_activation, Softmax, LSTM
     24 from .layers import CauchySimilarity, ParametricAttention, Logistic

~/.local/lib/python3.6/site-packages/thinc/layers/__init__.py in <module>
     52 from .padded2list import padded2list
     53 from .remap_ids import remap_ids
---> 54 from .strings2arrays import strings2arrays
     55 from .with_array import with_array
     56 from .with_array2d import with_array2d

~/.local/lib/python3.6/site-packages/thinc/layers/strings2arrays.py in <module>
      1 from typing import Tuple, List, Callable, Sequence
----> 2 from murmurhash import hash_unicode
      3 
      4 from ..model import Model
      5 from ..config import registry

ImportError: cannot import name 'hash_unicode'

System is ubuntu and GPU is not available. How to solve this.

Also, Is there way to reinstall spacy completely by removing all the packages of spacy as I suppose that might solve the problem.

1

There are 1 best solutions below

0
On

I fixed this by reinstall murmurhash. It upgraded from 0.28.0 to 1.0.5.