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

ValueError: cymem.cymem.Pool has the wrong size, try recompiling. #2852

Closed
agentofreality opened this issue Oct 15, 2018 · 29 comments
Closed
Labels
install Installation issues more-info-needed This issue needs more information ✨ prodigy Issues related to using spaCy with the Prodigy annotation tool

Comments

@agentofreality
Copy link

Hello,

I have been running prodigy in Docker and it worked yesterday using the Dockerfile example from github.

Today, I cannot build my docker image, I get an error when i try to download a language model.

If I log into my docker container and run this command:
python -m spacy download en_core_web_sm

Or even this command:
python -m spacy validate

I get this error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/local/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/usr/local/lib/python3.6/site-packages/spacy/init.py", line 8, in
from thinc.neural.util import prefer_gpu, require_gpu
File "/usr/local/lib/python3.6/site-packages/thinc/neural/init.py", line 1, in
from ._classes.model import Model
File "/usr/local/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 12, in
from ..train import Trainer
File "/usr/local/lib/python3.6/site-packages/thinc/neural/train.py", line 3, in
from .optimizers import Adam, SGD, linear_decay
File "optimizers.pyx", line 13, in init thinc.neural.optimizers
File "cymem.pxd", line 1, in init thinc.neural.ops
ValueError: cymem.cymem.Pool has the wrong size, try recompiling. Expected 64, got 48

There is an old issue with the same problem from 2015 that was caused by code version incompatibility. Could this be caused by prodigy code being out of sync with spacy?

@honnibal
Copy link
Member

Hi,

Apologies for this, but it's a consequence of pip's compromises between efficiency and fidelity in version resolution. Pip processes dependencies in order, and doesn't backtrack if it comes to a dependency conflict.

We'll be releasing a version 1.6.0 of Prodigy tomorrow, which will resolve the version conflict. While we understood that this update could cause problems, it was necessary to support Python 3.7, and also to upload binary wheels for spaCy and its dependent packages.

@honnibal honnibal added install Installation issues ✨ prodigy Issues related to using spaCy with the Prodigy annotation tool labels Oct 15, 2018
@agentofreality
Copy link
Author

Thanks for the clarification. Will you be emailing upgrade instructions for 1.6.0 to current license holders?

@honnibal
Copy link
Member

@agentofreality Yes, you'll receive an email today.

@ines
Copy link
Member

ines commented Oct 16, 2018

In the meantime, you should be able to just downgrade spaCy to 2.0.12!

@lemoncalamitous
Copy link

Hi @ines. I am trying to install spaCy offline having all its dependencies (installed using wheel files). However, I am facing the same issue as this.

Python version: 3.5.4
Cymem version: 2.0.2
spaCy version: 2.0.12

@ines
Copy link
Member

ines commented Oct 28, 2018

@lemoncalamitous If you want to install spaCy v2.0.12, you'll also need the old version of cymem, e.g. the latest on the 1.x branch, 1.31.2. Cymem only has wheel starting with version 2 (which is also part of the reason we had to release new versions of all our dependencies).

@folterj
Copy link

folterj commented Oct 30, 2018

Hi, I've just installed spaCy, and additionally installed it with [CUDA10] support (I'm not using Prodigy - unless this is included in spaCy). I received the same memory size errors during model installation, and now when trying to import spacy. As non hard core Python expert, I'm confused about: A. does spaCy support CUDA 10 as the website implies? B. is this unrelated to CUDA, if so which version of spaCy will work with the models on your website? C. If I need a specific set of spaCy/models, how do I install this?

I'm using Python 3.7

@honnibal
Copy link
Member

@folterj Unfortunately the website is in error at the moment. I hadn't realised that our dependency cupy doesn't support CUDA 10 yet, so spaCy only supports up to CUDA 9.2

@folterj
Copy link

folterj commented Oct 30, 2018

@honnibal Thank you for the quick response. I've reinstalled CUDA, version 9.2, however "pip install -U spacy[cuda92]" gives an error as Cupy does not support 9.2 (only older versions). So compiling cupy - with Visual Studio 2017 build tools using "pip install cupy". Once this successfully ran, reinstalling spaCy ("pip install spacy[cuda]" this time) unfortunately results in the exact same cymem errors.

@honnibal
Copy link
Member

honnibal commented Oct 30, 2018

Can you just delete your virtualenv and start again? Unfortunately pip doesn't always do smart things once in arbitrary states.

python -m pip install spacy[cuda92]
python -m pip list

You should see spaCy v2.0.16, cymem 2.0.2, preshed 1.0.1, cupy, thinc 6.12, and thinc_gpu_ops (among others)

@folterj
Copy link

folterj commented Oct 30, 2018

Thank you - I have not created/specified a environment - not sure how to delete environment. When trying to run the first instruction, I get the below error message. The list command shows I already have most of the libraries (including cupy 5.0.0), minus the thinc_gpu_ops. In case relevant, I'm using WinPython and have first installed spaCy without cuda option.

Could not find a version that satisfies the requirement cupy-cuda92>=4.0; extra == "cuda92" (from spacy[cuda92]) (from versions: )
No matching distribution found for cupy-cuda92>=4.0; extra == "cuda92" (from spacy[cuda92])

@honnibal
Copy link
Member

Installing into the main Python installation is sort of unideal, because it means you'll carry the state around between projects. It's also hard to back out of version problems.

You should be able to run something like python -m venv spacy-env, which will create a directory spacy-env. You can then run spacy-env\Scripts\activate to activate the virtualenv within your terminal. After doing that, if you run python -m pip list you should see a clean environment. You can delete the directory and recreate it if you need to start afresh.

@folterj
Copy link

folterj commented Oct 30, 2018

@honnibal Thank you again - I understand it can be useful to isolate states; following this indeed worked in terms of creating a separate environment, but unfortunately "python -m pip install spacy[cuda92]" still does not work (the same error as in my previous post). python -m pip install spacy[cuda] works but later model install / spacy validate / import spacy fails (cymem error).

@folterj
Copy link

folterj commented Oct 31, 2018

@honnibal Although I mentioned WinPython - I should have said I'm working on Windows 10 (64bit), which I assume is the problem. I surmise a wheel is needed for Windows installations to get Cupy, which in turn is required to get spaCy with GPU support? If this is the case, an extra line on the spaCy installation page would be helpful for Windows users.
Related issues flagged by others:
cupy/cupy#1545
cupy/cupy#1719

@Jagadesh546
Copy link

When i try to load the model using spacy (nlp=spacy.load('en_coref_md), I am receiving this error:
"cymem.cymem.Pool has the wrong size, try recompiling. Expected 64, got 48"
But other models such as en_core_web_sm are working fine.
Kindly someone help to resolve this issue.

@folterj
Copy link

folterj commented Nov 7, 2018

@honnibal Just to update - I'm not able to install spaCy 2.0.16 on Windows 10 64bit / Python 3 at all (with or without GPU support) - without hitting this reoccurring warning messages. I've removed all Python environments, removed all CUDA drivers/SDK, reinstalled using Conda & separate environment (as you kindly explained), different version of Python 3, different Python environments. Although the pip installation looks ok, calling "python -m spacy validate", installing a model or importing spacy always results in the now familiar cymem message (see below). Note that appears to be only a warning and I found that spaCy does seem to work ok.

python -m spacy validate
...\envs\spacy-env\lib\importlib_bootstrap.py:219: RuntimeWarning: cymem.cymem.Pool size changed, may indicate binary incompatibility. Expected 48 from C header, got 64 from PyObject
return f(*args, **kwds)
...\envs\spacy-env\lib\importlib_bootstrap.py:219: RuntimeWarning: cymem.cymem.Address size changed, may indicate binary incompatibility. Expected 24 from C header, got 40 from PyObject
return f(*args, **kwds)

(Another related thread: #2907)

@jeremywang123
Copy link

Hey, just to update. Problem still remains with new versions and downgrading to 2.0.12 seems the only solution for now.

@cjburrage
Copy link

how do I downgrade to 2.0.12?

@jxu
Copy link

jxu commented Dec 6, 2018

pip install spacy==2.0.12

@honnibal
Copy link
Member

Could the people having trouble try pip install spacy==2.0.18? Also, which OS and Python version are you using? I can't reproduce the error, and I'm not sure why it wouldn't be working.

@honnibal honnibal added the more-info-needed This issue needs more information label Dec 20, 2018
@no-response
Copy link

no-response bot commented Jan 3, 2019

This issue has been automatically closed because there has been no response to a request for more information from the original author. With only the information that is currently in the issue, there's not enough information to take action. If you're the original author, feel free to reopen the issue if you have or find the answers needed to investigate further.

@no-response no-response bot closed this as completed Jan 3, 2019
@mertyildiran
Copy link

mertyildiran commented Jan 6, 2019

I'm suffering from the exact same error.

Because of the issue #2995 I have upgraded to spacy==2.0.18 but now I get this error from NeuralCoref:

Traceback (most recent call last):
  File "/usr/local/bin/dragonfire", line 11, in <module>
    load_entry_point('dragonfire', 'console_scripts', 'dragonfire')()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/mertyildiran/Documents/Dragonfire/dragonfire/__init__.py", line 37, in <module>
    from dragonfire.coref import NeuralCoref  # Submodule of Dragonfire that aims to create corefference based dialogs
  File "/home/mertyildiran/Documents/Dragonfire/dragonfire/coref.py", line 14, in <module>
    import en_coref_sm  # Small English model for NeuralCoref: a pipeline extension for spaCy 2.0
  File "/home/mertyildiran/.local/lib/python3.6/site-packages/en_coref_sm/__init__.py", line 6, in <module>
    from en_coref_sm.neuralcoref import NeuralCoref
  File "/home/mertyildiran/.local/lib/python3.6/site-packages/en_coref_sm/neuralcoref/__init__.py", line 1, in <module>
    from .neuralcoref import NeuralCoref
  File "cymem.pxd", line 1, in init en_coref_sm.neuralcoref.neuralcoref
ValueError: cymem.cymem.Pool has the wrong size, try recompiling. Expected 64, got 48

Travis CI build log of the above error

huggingface/neuralcoref#102 (comment) tells me to downgrade spaCy to version anything between 2.0.11 and 2.0.13 to fix this error. But the problem is I need to have at least version 2.0.18 to fix #2995

So which version of spaCy am I gonna use now? Arbitrary version specifications like msgpack>=0.5.6,<1.0.0 in thinc I believe caused this mess. @honnibal and @ines please avoid this and use msgpack==... if it's possible.

In conclusion, I don't know what happened in the journey from 2.0.13 to 2.0.18 but now the development of my project Dragonfire stuck because of this issue. @honnibal and @ines cloud you please fix this issue or tell me what am I going to do? NeuralCoref seems like not very active lately so I don't think the resolution will come from there.

@mertyildiran
Copy link

mertyildiran commented Jan 6, 2019

OK, I managed to force msgpack==0.5.6 while downgrading to spacy==2.0.13 here: DragonComputer/Dragonfire@26122cd

But still something got broken in the journey from 2.0.13 to 2.0.18 for NeuralCoref. I don't know which project should fix this, either spaCy or NeuralCoref...

@liuzzi
Copy link

liuzzi commented Jan 23, 2019

I was also struggling with loading the coref model, and was able to fix this problem by doing:

sudo pip3 install cymem==1.31.2 spacy==2.0.12

not sure exactly what that addressed, but it worked.

@Franck-Dernoncourt
Copy link

Franck-Dernoncourt commented Feb 5, 2019

Thanks, conda install cymem==1.31.2 did the trick for me. (I already had spacy==2.0.12 and was getting ValueError: cymem.cymem.Pool has the wrong size, try recompiling.)

@lasershow
Copy link

Fixed to install pip install spacy==2.0.18, but I don't know why I needed administrator authority.

@zar3bski
Copy link

The "downgrading trick" to 2.0.12 did not do the trick for me:
cymem-1.31.2 murmurhash-0.28.0 preshed-1.0.1 spacy-2.0.12 thinc-6.10.3 Python 3.5.3

Any other idea?

@valtron
Copy link

valtron commented Mar 10, 2019

@ZarebskiDavid I managed to build everything and get it working (latest tags). Here's what I had to do.

@lock
Copy link

lock bot commented Apr 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install Installation issues more-info-needed This issue needs more information ✨ prodigy Issues related to using spaCy with the Prodigy annotation tool
Projects
None yet
Development

No branches or pull requests