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

RuntimeError when using flair 0.8 with Python 3.9 #2138

Closed
b2m opened this issue Mar 8, 2021 · 0 comments · Fixed by #2151
Closed

RuntimeError when using flair 0.8 with Python 3.9 #2138

b2m opened this issue Mar 8, 2021 · 0 comments · Fixed by #2151
Labels
bug Something isn't working

Comments

@b2m
Copy link

b2m commented Mar 8, 2021

Describe the bug

RuntimeError when trying to use flair==0.8 with Python 3.9.

To Reproduce

On Windows using Powershell:

$ python -m venv venv
$ .\venv\Scripts\activate
$ python --version
> Python 3.9.2
$ pip install --no-cache-dir flair==0.8
> ...
$ python
>>> from flair.data import Sentence
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\code\flair\venv\lib\site-packages\flair\__init__.py", line 2, in <module>
    import torch
  File "E:\code\flair\venv\lib\site-packages\torch\__init__.py", line 196, in <module>
    from torch._C import *
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

On Docker using bash in the python:3.9 image:

$ python --version
> 3.9.2
$ pip install flair==0.8
> ...
$ python
>>> from flair.data import Sentence
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/flair/__init__.py", line 20, in <module>
    from . import models
  File "/usr/local/lib/python3.9/site-packages/flair/models/__init__.py", line 1, in <module>
    from .sequence_tagger_model import SequenceTagger, MultiTagger
  File "/usr/local/lib/python3.9/site-packages/flair/models/sequence_tagger_model.py", line 21, in <module>
    from flair.embeddings import TokenEmbeddings, StackedEmbeddings, Embeddings
  File "/usr/local/lib/python3.9/site-packages/flair/embeddings/__init__.py", line 6, in <module>
    from .token import TokenEmbeddings
  File "/usr/local/lib/python3.9/site-packages/flair/embeddings/token.py", line 13, in <module>
    import gensim
  File "/usr/local/lib/python3.9/site-packages/gensim/__init__.py", line 5, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils  # noqa:F401
  File "/usr/local/lib/python3.9/site-packages/gensim/corpora/__init__.py", line 6, in <module>
    from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
  File "/usr/local/lib/python3.9/site-packages/gensim/corpora/indexedcorpus.py", line 15, in <module>
    from gensim import interfaces, utils
  File "/usr/local/lib/python3.9/site-packages/gensim/interfaces.py", line 21, in <module>
    from gensim import utils, matutils
  File "/usr/local/lib/python3.9/site-packages/gensim/matutils.py", line 1104, in <module>
    from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
  File ".eggs/Cython-0.29.14-py2.7-linux-x86_64.egg/Cython/Includes/numpy/__init__.pxd", line 242, in init gensim._matutils
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Environment (please complete the following information):

  • OS: Windows 10 and Docker with python:3.9 image.
  • Version: flair-0.8

Additional context

  • I fixed this problem locally by installing numpy==1.20.0 (instead of the required 1.19.0).
  • Not reproducible with the Docker images python:3.8, python:3.7 and python:3.6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant