Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installation using spaCy from source code #209

Closed
swicaksono opened this issue Oct 13, 2019 · 8 comments
Closed

Error installation using spaCy from source code #209

swicaksono opened this issue Oct 13, 2019 · 8 comments

Comments

@swicaksono
Copy link

swicaksono commented Oct 13, 2019

I got an error when tried to install neuralcoref using spaCy which I install via source code. I modified the neuralcoref/neuralcoref.pyx to import spacy from the path I was installed the spaCy instead from the library. The following error was the cython module. In fact, the cython was correctly installed as well as the spaCy from the source.

Any help? Thanks.

@svlandeg
Copy link
Collaborator

Hi @swicaksono , can you try downgrading spaCy to 2.1.0. and check again?

If it still doesn't work - could you provide the details of your installation (+ version numbers of spaCy and neuralcoref) and the exact error you're getting?

@swicaksono
Copy link
Author

swicaksono commented Oct 14, 2019

So my project folder structure is like this.

.
├── spaCy
│   └── spacy
├── neuralcoref
│   └── neuralcoref 
│       ├── neuralcoref.pyx

In the README installation guidelines, we install spaCy by using pip, on this occasion, I want to install it from source. So before run the

pip install -e .

I modified the neuralcoref.pyx to read the spacy from the path I install it by adding theses lines before importing the spacy

path_this = os.path.dirname(os.path.abspath(__file__))
path_spacy = os.path.abspath(os.path.join(path_this, '..', '..', 'spaCy'))

sys.path.append(path_this)
sys.path.append(path_spacy)

import spacy
....

But then I run the pip install again, I got this following error:

ERROR: Complete output from command python setup.py egg_info:
    ERROR: /home/theavenger/anaconda3/envs/ner_spacy/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/theavenger/Documents/Research/coref/neuralcoref/neuralcoref/neuralcoref.pxd
      tree = Parsing.p_module(s, pxd, full_module_name)
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from spacy.tokens.doc cimport Doc
    ^
    ------------------------------------------------------------
    
    neuralcoref.pxd:1:0: 'spacy/tokens/doc.pxd' not found
    Processing neuralcoref.pyx
    Traceback (most recent call last):
      File "/home/theavenger/Documents/Research/coref/neuralcoref/bin/cythonize.py", line 157, in <module>
        run(args.root)
      File "/home/theavenger/Documents/Research/coref/neuralcoref/bin/cythonize.py", line 148, in run
        process(base, filename, db)
      File "/home/theavenger/Documents/Research/coref/neuralcoref/bin/cythonize.py", line 114, in process
        preserve_cwd(base, process_pyx, root + '.pyx', root + '.cpp')
      File "/home/theavenger/Documents/Research/coref/neuralcoref/bin/cythonize.py", line 79, in preserve_cwd
        func(*args)
      File "/home/theavenger/Documents/Research/coref/neuralcoref/bin/cythonize.py", line 61, in process_pyx
        raise Exception('Cython failed')
    Exception: Cython failed
    Cythonizing sources
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/theavenger/Documents/Research/coref/neuralcoref/setup.py", line 245, in <module>
        setup_package()
      File "/home/theavenger/Documents/Research/coref/neuralcoref/setup.py", line 176, in setup_package
        generate_cython(root, 'neuralcoref')
      File "/home/theavenger/Documents/Research/coref/neuralcoref/setup.py", line 165, in generate_cython
        raise RuntimeError('Running cythonize failed')
    RuntimeError: Running cythonize failed
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /home/theavenger/Documents/Research/coref/neuralcoref/

The source code versions:
spaCy: 2.2.1
neuralcoref: 4.0.0

So what suggests to solve this problem?
Many thanks.

@masonedmison
Copy link

masonedmison commented Oct 15, 2019

Hi, I am having a same error as @swicaksono when trying to install nueralcoref from source.
At same step of pip install -e . and with the cython.py script

My source code versions:
Spacy: 2.2.1
nueralcoref: well not installed yet as its failing on the pip command above, but the version I am attempting to install is- 4.0

In the meantime I will downgrade spacy to version 2.1.0

Full stack trace:


    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from spacy.tokens.doc cimport Doc
    ^
    ------------------------------------------------------------

    neuralcoref.pxd:1:0: 'spacy\tokens\doc.pxd' not found
    Processing neuralcoref.pyx
    Traceback (most recent call last):
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\bin\cythonize.py", line 157, in <module>
        run(args.root)
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\bin\cythonize.py", line 148, in run
        process(base, filename, db)
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\bin\cythonize.py", line 114, in process
        preserve_cwd(base, process_pyx, root + '.pyx', root + '.cpp')
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\bin\cythonize.py", line 79, in preserve_cwd
        func(*args)
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\bin\cythonize.py", line 61, in process_pyx
        raise Exception('Cython failed')
    Exception: Cython failed
    Cythonizing sources
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\setup.py", line 245, in <module>
        setup_package()
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\setup.py", line 176, in setup_package
        generate_cython(root, 'neuralcoref')
      File "C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\setup.py", line 165, in generate_cython
        raise RuntimeError('Running cythonize failed')
    RuntimeError: Running cythonize failed

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\EDMISML\PycharmProjects\coref\neuralcoref\

@svlandeg
Copy link
Collaborator

It looks like spaCy > 2.1.8 is currently incompatible with neuralcoref 4.0.

There are two options:

  • Install spacy==2.1.0 and then install neuralcoref with pip
  • Install spacy==2.1.8 and then install neuralcoref from source

Merging with Issue #197

@mustafaKus
Copy link

Is there any plan to make it compatible with the 2.1.8 ?

@parzival0037
Copy link

Went back and used spacy=2.1.0 and neuralcoref

!pip install spacy==2.1.0
!pip install neuralcoref
!pip install https://github.com/explosion/spacy-models/releases//download/en_core_web_lg-2.1.0/en_core_web_lg-2.1.0.tar.gz

import spacy
import neuralcoref
import en_core_web_lg

nlp = en_core_web_lg.load()
neuralcoref.add_to_pipe(nlp)

Everything runs fine now.

@vedangj044
Copy link

"spacy>=2.1.0"],

changing this to
"spacy>=2.1.0,<3.0.0"],

worked for me.

@g3saranath
Copy link

This worked for me:

pip install spacy==2.1.0
pip install neuralcoref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants