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

💫 Incompatibilities & support on later versions of spaCy #197

Open
rrrepos opened this issue Aug 20, 2019 · 30 comments
Open

💫 Incompatibilities & support on later versions of spaCy #197

rrrepos opened this issue Aug 20, 2019 · 30 comments
Labels
compat Cross-platform and cross-Python compatibility install upgrade

Comments

@rrrepos
Copy link

rrrepos commented Aug 20, 2019

Is there any plan/ date to get neuralcoref to work on the latest version of spaCy (ver 2.1.8)? Thanks

@svlandeg
Copy link
Collaborator

svlandeg commented Sep 23, 2019

Yes, the plan with @honnibal and @ines is to help @thomwolf maintain this awesome spaCy extension and to make sure it can stay in-sync when there are new releases for spaCy. No timeline yet, but stay tuned ;-)

For now, you can work with neuralcoref and spaCy>2.1 if you first install your required version of spaCy, and then build neuralcoref from source. If that doesn't work, you can also try compiling spaCy from source first (in a clean environment), then compile neuralcoref from source.

If you are running into incompatibility issues and prefer not to build from source, the other option is to downgrade spaCy to 2.1.0, which is compatible with neuralcoref 4.0.

@svlandeg svlandeg pinned this issue Oct 16, 2019
@svlandeg svlandeg changed the title support on later versions of spaCy Incompatibilities & support on later versions of spaCy Oct 16, 2019
@svlandeg svlandeg added compat Cross-platform and cross-Python compatibility install labels Oct 16, 2019
@svlandeg svlandeg changed the title Incompatibilities & support on later versions of spaCy 💫 Incompatibilities & support on later versions of spaCy Oct 17, 2019
@svlandeg svlandeg mentioned this issue Oct 25, 2019
@stale
Copy link

stale bot commented Dec 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 16, 2019
@svlandeg svlandeg removed the wontfix label Dec 16, 2019
@dborncamp
Copy link

I believe this is still an issue. Is there another workaround that does not require building from source? Also, I don't want the bot to close this without a fix.

@svlandeg
Copy link
Collaborator

No, there's no other workaround for the moment, and yes this issue will be addressed - which is why I removed the wontfix label ;-)

@AlJohri
Copy link

AlJohri commented Dec 19, 2019

For some reason I was having trouble building neuralcoref from source unless I copied the spacy folder into site-packages.

I've attached my reproducible example getting it working with the latest version of spaCy.

Any tips on doing this better / more easily?

all:
	python3 -m venv .venv
	.venv/bin/pip install cython boto3
	git clone https://github.com/explosion/spaCy.git || true
	.venv/bin/pip install -r spaCy/requirements.txt
	.venv/bin/python spaCy/setup.py build_ext --inplace
	cp -R spaCy/spacy .venv/lib/python3.8/site-packages/
	git clone https://github.com/huggingface/neuralcoref.git || true
	.venv/bin/python neuralcoref/setup.py build_ext --inplace
	cp -R neuralcoref/neuralcoref .venv/lib/python3.8/site-packages/
	.venv/bin/python -m spacy download en

test:
	.venv/bin/python -c "import spacy; nlp = spacy.load('en'); import neuralcoref; neuralcoref.add_to_pipe(nlp); doc = nlp(u'My sister has a dog. She loves him.'); print(doc._.coref_clusters)"

clean:
	rm -rf .venv spacy neuralcoref

I really wish I could do something like:

pip install --no-binary --global-option=build_ext --global-option="--inplace" -e spaCy

but that wasn't working for me.

@svlandeg
Copy link
Collaborator

svlandeg commented Dec 19, 2019

The way I do it, after pulling both from github and creating a new venv :

cd spacy
pip install -r requirements.txt
python setup.py build_ext --inplace
pip install -e .

cd ../neuralcoref
python setup.py build_ext --inplace
pip install -e .

@AlJohri
Copy link

AlJohri commented Dec 19, 2019

ahh, I didn't realize you're suppose to pip install after build_ext. thanks!

@svlandeg
Copy link
Collaborator

We're currently working hard on getting spaCy v.3 out, which will use the revamped thinc. Once all that is done, the next priority will be to get neuralcoref integrated with the new spaCy.

ColdTeapot273K added a commit to ColdTeapot273K/bert-extractive-summarizer that referenced this issue Mar 28, 2020
To fix neuralcoref compatability problems (see huggingface/neuralcoref#197)
@aaaailuj
Copy link

aaaailuj commented Apr 15, 2020

Is it possible to build Spacy > 2.2.0 from source, and then neuralcoref from source, but without using pip install -e?

Ideally, the end goal is to have a wheel distributable neuralcoref which was built against spacy 2.2.3 and which I can deploy to other systems.

I know the following commands work:

cd spacy
pip install -r requirements.txt
python setup.py build_ext --inplace
pip install -e .

cd ../neuralcoref
python setup.py build_ext --inplace
pip install -e .

But how could I correctly accomplish getting a neuralcoref wheel? I'm thinking something like this maybe:

cd spacy
pip install -r requirements.txt
python setup.py build_ext --inplace
python setup.py bdist_wheel
<install the wheel?>

cd ../neuralcoref
python setup.py build_ext --inplace
python setup.py bdist_wheel
<install the wheel?>

Would greatly appreciate any help.

I did this with

cd ../neuralcoref
python setup.py sdist --formats=gztar

and then

pip install neuralcoref-4.0.tar.gz

@ym-han
Copy link

ym-han commented Jul 7, 2020

just a quick fyi: I personally still got the
<frozen importlib._bootstrap>:219: RuntimeWarning: spacy.morphology.Morphology size changed, may indicate binary incompatibility. Expected 104 from C header, got 112 from PyObject <frozen importlib._bootstrap>:219: RuntimeWarning: spacy.vocab.Vocab size changed, may indicate binary incompatibility. Expected 96 from C header, got 112 from PyObject
error, when doing import neuralcoref, even after trying to first install spacy from source and then neuralcoref from source.
I'm on a mac, and I think I was on python 3.8.3.
The only thing that worked for me was switching to python 3.7 and using spacy 2.1.0

@jsalbr
Copy link

jsalbr commented Jul 25, 2020

Hi, it seems to work fine with spaCy 2.3.0 without building spaCy from source.

# installed spacy 2.3.0 then
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref; pip install -r requirements.txt; pip install -e .

But I had to change the requirements.txt to make it work, because here it says spacy>=2.1.0,<2.2.0

Could you please update the requirements.txt

I'd like to use neuralcoref in a book and therefore easy setup would be great!

@bodak
Copy link

bodak commented Jul 30, 2020

The approach that works for us in a CI setting is installing spacy, cython and numpy strictly before neuralcoref. Afterwards you can just pip install directly from Github (i.e. pip handles the cloning to tmp).

Example Makefile:

...
build:
	pip3 install numpy==1.19.0 cython==0.29.20 spacy==2.3.0
        pip3 install git+https://github.com/huggingface/neuralcoref.git
...

Note if you have it part of larger NLP stack, you can also add git+https://github.com/huggingface/neuralcoref.git to requirements.txt and pip3 install -r requirements.txt.

@svlandeg
Copy link
Collaborator

svlandeg commented Sep 7, 2020

Hi, it seems to work fine with spaCy 2.3.0 without building spaCy from source.

# installed spacy 2.3.0 then
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref; pip install -r requirements.txt; pip install -e .

But I had to change the requirements.txt to make it work, because here it says spacy>=2.1.0,<2.2.0

Could you please update the requirements.txt

The requirements are now updated. There was a bug in spaCy 2.2 which meant that the pip-installed version of spaCy did not distribute the pxd files which neuralcoref builds against. But this is now fixed in newer versions of spaCy, so you don't have to build spaCy from source anymore.

Thanks for the confirmation!

@morrisalp
Copy link

The requirements are now updated. There was a bug in spaCy 2.2 which meant that the pip-installed version of spaCy did not distribute the pxd files which neuralcoref builds against. But this is now fixed in newer versions of spaCy, so you don't have to build spaCy from source anymore.

I just got a segfault when trying to use neuralcoref with spacy 2.3.2 and had to downgrade to spacy 2.1.3 for it to work, even though the requirements file allows spacy>=2.1.0,<3.0.0.

@svlandeg
Copy link
Collaborator

Hm, that's odd. Did you build neuralcoref from source after installing spaCy 2.3.2 ?

@morrisalp
Copy link

I installed neuralcoref via pip after installing spaCy 2.3.2.

@svlandeg
Copy link
Collaborator

Yea, that explains the segfault. You'll need to build neuralcoref from source if you want to use spacy > 2.1.

@fhamborg
Copy link

fhamborg commented Jun 10, 2021

thanks for the great tool. though, im wondering, is neuralcoref actually under active development or what's the overall status? for example, this issue is almost 2 years old. further, in the dev branch the latest commit is 2 months old (and it's only regarding some typos). also, spacy 3.0 has been out for a while and still there's no support.

@svlandeg
Copy link
Collaborator

svlandeg commented Jun 10, 2021

Hi @fhamborg! Since my original post in September 2019, quite a bit has changed. We initially intended to bring this code base up-to-date with the latest spaCy, but then we ended up revamping the internals of spaCy quite a bit for its 3.0 release.

Long story short, at Explosion we're working on a built-in coreference module that will be part of the core spaCy library. You can follow its development here: explosion/spaCy#7264. You'll see that we've been actively working on this. Most of the code is written, but it needs some more debugging and fine-tuning.

I can't speak for HuggingFace and what they intend to do with neuralcoref going forward, though either way this library will always be useful for older versions of spaCy :-)

@fhamborg
Copy link

That's great to hear, thank you a lot for the update :)

ds-astroboy added a commit to ds-astroboy/bert-extractive-summarizer that referenced this issue Jun 12, 2023
To fix neuralcoref compatability problems (see huggingface/neuralcoref#197)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Cross-platform and cross-Python compatibility install upgrade
Projects
None yet
Development

Successfully merging a pull request may close this issue.