Skip to content

Neuralcoref on Windows

valtron edited this page Mar 10, 2019 · 2 revisions

Using latest spaCy (2.0.18), there's this problem:

ValueError: cymem.cymem.Pool has the wrong size, try recompiling. Expected 64, got 48

(This is because of this change.)

Downgrading to 2.0.12 didn't work either; I got can't retrieve string for hash '35848228568803' when loading the model. So, time to build everything from source.

  1. Download everything
    1. Start in empty folder $DIR
    2. git clone -b v2.0.2 https://github.com/explosion/cymem.git
    3. git clone -b v2.0.18 https://github.com/explosion/spaCy.git
    4. git clone -b master https://github.com/huggingface/neuralcoref.git
    5. Download whichever pretrained model you want, and untar the files so that setup.py ends up in $DIR/en_coref_xx
  2. In each folder (cymem, spaCy, neuralcoref, en_coref_xx), edit setup.py to add define_macros = [('MS_WIN64', None)] as an argument to the Extension(...)
  3. Edit $DIR/spaCy/strings.pyx to add self.keys = []; self.hits = [] after self.mem = Pool(). (This is to fix a different "wrong size" problem; maybe a bug in Cython.)
  4. Build/install everything (the slashes are important!)
    1. pip install cymem/
    2. pip install spaCy/
    3. pip install neuralcoref/
    4. pip install en_coref_xx/