Package Details: python-gensim 4.3.2-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: 2023-08-30 01:49 (UTC)

Latest Comments

1 2 Next › Last »

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.

edh commented on 2018-09-14 05:50 (UTC)

@Pastafarianist Well, it was not really missing, it was merely marked as optional dependency. However, I admit that gensim is not of much use without it and I converted it to a hard dependency.

Pastafarianist commented on 2018-09-13 17:44 (UTC) (edited on 2018-09-13 17:44 (UTC) by Pastafarianist)

A dependency on smart_open is missing (an attempt to import gensim fails due to an import error of smart_open).

edh commented on 2018-09-07 11:26 (UTC)

I adopted the package and rewrote the PKGBUILD. Furthermore, I added a python2 version of the package via a split package approach.

drencrom commented on 2018-09-01 18:04 (UTC)

This is the PKGBUILD updated to 3.5.0 in case anyone is interested: https://merlino.uy/PKGBUILD