urchade / GLiNER

Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts) @ NAACL 2024
https://arxiv.org/abs/2311.08526
Apache License 2.0
1.42k stars 123 forks source link

Error while importing pacakge #50

Closed shyamalaspure closed 7 months ago

shyamalaspure commented 7 months ago

I am trying to import pacakge after doing pip install gliner-spacy getting import error python version using 3.10.11

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gliner\__init__.py", line 3, in <module> 
    from .model import GLiNER
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gliner\model.py", line 13, in <module>   
    from gliner.modules.token_rep import TokenRepLayer
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gliner\modules\token_rep.py", line 4, in 
<module>
    from flair.data import Sentence
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\__init__.py", line 42, in <module> 
    from . import (  # noqa: E402 import after setting device
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\models\__init__.py", line 1, in <module>
    from .clustering import ClusteringModel
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\models\clustering.py", line 14, in 
<module>
    from flair.embeddings import DocumentEmbeddings
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\embeddings\__init__.py", line 13, in <module>
    from .document import (
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\embeddings\document.py", line 16, in <module>
    from flair.embeddings.token import FlairEmbeddings, StackedEmbeddings, TokenEmbeddings
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\flair\embeddings\token.py", line 10, in <module>
    import gensim
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gensim\__init__.py", line 11, in <module>    from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gensim\corpora\__init__.py", line 6, in <module>
    from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gensim\corpora\indexedcorpus.py", line 14, in <module>
    from gensim import interfaces, utils
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gensim\interfaces.py", line 19, in <module>
    from gensim import utils, matutils
  File "C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\gensim\matutils.py", line 20, in <module>    from scipy.linalg import get_blas_funcs, triu
ImportError: cannot import name 'triu' from 'scipy.linalg' (C:\Users\RAD-Shyam Alaspure\CI_Scripts\Clinical NER service\gliNER\gliner\lib\site-packages\scipy\linalg\__init__.py)

Please reslove this thread.

amand26 commented 7 months ago

Same issue for me.

randaller commented 7 months ago

Same here.

amand26 commented 7 months ago

Resolved the issue. Some issue with the scipy version. Just downgrade the scipy version. pip install scipy==1.9.0 @randaller , @shyamalaspure

urchade commented 7 months ago

Thanks @amand26

randaller commented 7 months ago

Thanks @amand26 it works

shyamalaspure commented 7 months ago

Thanks @amand26, helped and resolved closing this thread