Package Details: python-gensim 4.3.3-1

Git Clone URL: https://aur.archlinux.org/python-gensim.git (read-only, click to copy)
Package Base: python-gensim
Description: Library for topic modelling, document indexing and similarity retrieval with large corpora
Upstream URL: https://radimrehurek.com/gensim/
Keywords: embedding HDP language LDA LSA natural NLP processing toolbox word word2vec
Licenses: LGPL2.1
Submitter: Dieter_be
Maintainer: edh
Last Packager: edh
Votes: 16
Popularity: 0.000000
First Submitted: 2011-01-27 14:26 (UTC)
Last Updated: 2024-07-31 04:01 (UTC)

Latest Comments

1 2 3 Next › Last »

SelectionRemark commented on 2024-07-31 21:09 (UTC)

@edh I think so too, gensim has to fix this properly anyway at some point. Meanwhile there is an easy workaround by pinning scipy to v1.13

edh commented on 2024-07-31 13:29 (UTC)

@SelectionRemark hmm, I don't think blocking a script update is worth one model in gensim so I think I'm leaning toward not pinning the version and have this model be broken. Please let me know if this is not acceptable to you.

SelectionRemark commented on 2024-07-31 07:54 (UTC) (edited on 2024-07-31 07:55 (UTC) by SelectionRemark)

Hi @edh, the latest version v4.3.3 requires an old scipy version (<=1.13.1), with the current version v1.14.0 lsimodel fails. See https://github.com/piskvorky/gensim/commit/afbb82ea3446b5462a6ae1f5b02d338ff0170e5a

Not sure though how or if an old version of scipy can be pinned, or if that is desirable at all.

Right now, I have manually downgraded scipy v1.13, and everything continues to work.

draic commented on 2024-07-30 15:57 (UTC)

could we please get an update to 4.3.3 which was released over a week ago? https://pypi.org/project/gensim/4.3.3/

This fixes the import error and without it the gensim package is broken (see comment below)

gay commented on 2024-06-24 19:30 (UTC) (edited on 2024-06-24 19:30 (UTC) by gay)

The gensim package is unfortunately currently broken because of a tiny change in scipy-1.13 and will fail with

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

as explained here: https://github.com/piskvorky/gensim/issues/3525

A bugfix has been merged back in April, but the next release is not out yet. The due date is set for July 1, but who knows if they can keep that deadline.

In the meantime, the recommendation in the gensim community is to downgrade Scipy to 1.12. This will not work with the standard Arch python-scipy package, because the last Scipy 1.12 version uses Python 3.11, not the current Python 3.12. Replacing python-scipy with the pip version will not only make the system inconsistent, but also break dependencies like python-scikit-learn, python-networkx, python-statsmodels.

I believe, the error can be temporarily resolved like so (it's admittedly a bit wacky):

  1. Create build directory

    mkdir gensim; cd gensim
    
  2. Download code

    git clone https://github.com/piskvorky/gensim.git
    
  3. Create install subdirectory, so we do not have to allow the gensim setup to write into system directories.

    mkdir makedirectory
    
  4. Build gensim. This will fail at the end of the build, when it will try to write into /usr/bin in spite of the specified local build directory. That does not deem to matter, however. Make sure to not use sudo, else it will succeed in writing to system directories.

    python setup.py install --install-lib ./makedirectory/
    
  5. Compile C objects (without that, it will fail with the NO CYTHON error, https://github.com/piskvorky/gensim/issues/3260 )

    python setup.py build_ext --inplace
    
  6. Open makedirectory/gensim-4.3.2.dev0-py3.12-linux-x86_64.egg/gensim/matutils.py (with vim or nano) and replace line 20:

    from scipy.linalg import get_blas_funcs, triu
    

    with the official fix from https://github.com/piskvorky/gensim/blob/develop/gensim/matutils.py:

    from scipy.linalg import get_blas_funcs
    try:
        from numpy import triu
    except ImportError:
        from scipy.linalg import triu
    
  7. Install gensim with pip. This package will not work. We will replace it in the next step. But we use it to provide the gensim-4.3.2.dist-info directory and contents.

    pip install --user --break-system-packages gensim
    
  8. Overwrite the pip gensim with the locally built and modified one

    cp -a makedirectory/gensim-4.3.2.dev0-py3.12-linux-x86_64.egg/gensim ~/.local/lib/python3.12/site-packages/gensim
    

edh commented on 2021-04-06 09:12 (UTC)

@erk Thanks for the tip on python-pip. I fixed it in a recent commit and also added python-levenshtein.

erk commented on 2021-04-05 08:33 (UTC) (edited on 2021-04-05 08:35 (UTC) by erk)

I think you may have to add python-pip to the (make) as well, as it will not build without it.

in a similar way python-levenshtein has to be added as a optional, as it is needed for the gensim.similarities.levenshtein submodule.

edh commented on 2020-12-04 19:56 (UTC)

@silversilva Right! Thanks for the hint!

silversilva commented on 2020-12-04 06:01 (UTC)

I am unable to install the package without python-wheel. But with python-wheel everything installs smoothly. Should it be added to the make dependency?

Pastafarianist commented on 2018-09-16 20:32 (UTC)

@edh thank you for the swift update. I'd like to remark though that gensim cannot be used at all without smart_open as the very import gensim fails.