huggingface / neuralcoref

✨Fast Coreference Resolution in spaCy with Neural Networks
https://huggingface.co/coref/
MIT License
2.85k stars 477 forks source link

No module named 'neuralcoref.neuralcoref' #220

Closed rrupam closed 4 years ago

rrupam commented 4 years ago

Hi, I'm trying to follow the readme to set up neuralcoref and spacy. But at 'Adding NeuralCoref to the pipe of an English SpaCy Language' step, I get an error which doesn't make any sense to me. I should also mention that I'm trying this on Google Colab. I get

`ModuleNotFoundError Traceback (most recent call last)

in () 1 import logging; 2 logging.basicConfig(level=logging.INFO) ----> 3 import neuralcoref /content/drive/My Drive/Colab Notebooks/WRI_Enivronmental_Conflicts/environmental-conflict-tracker/neuralcoref/neuralcoref/__init__.py in () 12 warnings.filterwarnings("ignore", message="spacy.strings.StringStore size changed") 13 ---> 14 from .neuralcoref import NeuralCoref 15 from .file_utils import NEURALCOREF_MODEL_URL, NEURALCOREF_MODEL_PATH, NEURALCOREF_CACHE, cached_path 16 ModuleNotFoundError: No module named 'neuralcoref.neuralcoref'` Any help would be greatly appreciated.
svlandeg commented 4 years ago

Hi @rrupam, I ran into similar issues when building the code from source. For me it was fixed by changing the paths in neuralcoref/init.py to neuralcoref.neuralcoref and neuralcoref.file_utils instead of just .neuralcoref and .file_utils, see here. These changes were commited to the master branch. Could you try cloning the repo and installing from source, as described here ? Hopefully that would fix your problems.

rrupam commented 4 years ago

Thanks for your response, @svlandeg . I ditched google colab and decided to install and run this locally because for instance, I don't know how to create a virtual environment there and access it (there might be a way, but I didnt want to get into that). So, with the solution you provided, this problem is solved. However, I am still running into some other issues regarding spacy. I will open up another issue for that if it persists.

By the way, a friend also tried google colab by installing without installing from source (so no need to create a virtual environment) and it worked for her. I tried the exact same code and it didn't work for me. I have no idea what the problem might be.

Finally, thanks for your help. :)

svlandeg commented 4 years ago

Ok - at least it's good to hear you found a workaround!