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

ImportError: cannot import name 'triu' from 'scipy.linalg' #268

Open
msusol opened this issue Apr 30, 2024 · 0 comments
Open

ImportError: cannot import name 'triu' from 'scipy.linalg' #268

msusol opened this issue Apr 30, 2024 · 0 comments
Assignees

Comments

@msusol
Copy link
Collaborator

msusol commented Apr 30, 2024

Gensim Newsgroup.ipynb generates an error today when you run pip install -r requirements.txt that can be resolved by using scipy<1.13 to make existing code work.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[4], line 5
      3 import string
      4 import funcy as fp
----> 5 from gensim import models
      6 from gensim.corpora import Dictionary, MmCorpus
      7 import nltk

File ~/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/gensim/__init__.py:11
      7 __version__ = '4.3.2'
      9 import logging
---> 11 from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
     14 logger = logging.getLogger('gensim')
     15 if not logger.handlers:  # To ensure reload() doesn't add another one

File ~/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/gensim/corpora/__init__.py:6
      1 """
      2 This package contains implementations of various streaming corpus I/O format.
      3 """
      5 # bring corpus classes directly into package namespace, to save some typing
----> 6 from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
      8 from .mmcorpus import MmCorpus  # noqa:F401
      9 from .bleicorpus import BleiCorpus  # noqa:F401

File ~/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/gensim/corpora/indexedcorpus.py:14
     10 import logging
     12 import numpy
---> 14 from gensim import interfaces, utils
     16 logger = logging.getLogger(__name__)
     19 class IndexedCorpus(interfaces.CorpusABC):

File ~/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/gensim/interfaces.py:19
      7 """Basic interfaces used across the whole Gensim package.
      8 
      9 These interfaces are used for building corpora, model transformation and similarity queries.
   (...)
     14 
     15 """
     17 import logging
---> 19 from gensim import utils, matutils
     22 logger = logging.getLogger(__name__)
     25 class CorpusABC(utils.SaveLoad):

File ~/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/gensim/matutils.py:20
     18 import scipy.sparse
     19 from scipy.stats import entropy
---> 20 from scipy.linalg import get_blas_funcs, triu
     21 from scipy.linalg.lapack import get_lapack_funcs
     22 from scipy.special import psi  # gamma function utils

ImportError: cannot import name 'triu' from 'scipy.linalg' (/Users/marksusol/.virtualenvs/venv-pyLDAvis/lib/python3.11/site-packages/scipy/linalg/__init__.py)

ref: https://stackoverflow.com/questions/78279136/importerror-cannot-import-name-triu-from-scipy-linalg-gensim

piskvorky/gensim#3525

@msusol msusol self-assigned this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant