Tag Archives: Scips

[Solved] Import gensim Error: RuntimeError: Cython extensions are unavailable.

Gensim was installed successfully, but a runtimeerror occurred during import
the runtime error is as follows:
runtimeerror: Python extensions are unavailable. Without them, this gensim functionality is disabled. If you’ve installed from a package, ask the package maintainer to include Python extensions. If you’re building gensim from source yourself, run python setup. py build_ Ext — inplace and retry.
after reading other users’ articles, it is found that numpy and SciPy are incompatible with gensim

The solution steps are as follows

    1. view the python adaptation information, download the adapted numpy and SciPy WHL files, install the WHL files, download the gensim again, and run successfully.

First, check the version information of your Python adaptation before downloading the file
Open CMD and directly enter PIP debug -- verbose on the command line. The results are as follows

after finding it, go to the following link to download the adapted numpy and SciPy files

https://www.lfd.uci.edu/ ~gohlke/pythonlibs/

The corresponding downloaded file on my computer is

After downloading, enter CMD
CD to download SciPy and numpy + MKL
Python – M PIP install scipy-1.7.2-cp37-cp37m-win_ amd64.whl
python -m pip install numpy-1.21.4+mkl-cp37-cp37m-win_ amd64.whl

Then uninstall gensim and install gensim
finally, you can import

How to Solve Error “ImportError: cannot import name imsave“

Problem description

Today, when running a GitHub code two years ago, an error was reported:

from scipy.misc import imsave

ImportError: cannot import name 'imsave'

But after checking, I found that I have installed the SciPy module. When checking the internal function module of SciPy, I found that there are no functions such as imsave

import scipy.misc

print(dir(scipy.misc))

After searching, it is found that the reason is the SciPy version: after SciPy 1.3, functions such as SciPy. Misc. Imread/imsave will be discarded.

resolvent

To re install the previous version of SciPy, first log in to the official website of SciPy and find the corresponding WHL file. As the python environment of this machine is Ubuntu + python = 3.6.9, download the third corresponding file:

Then uninstall the previous SciPy and install the file

# uninstal scipy
pip uninstall scipy


# install
pip install scipy-1.2.0-cp36-cp36m-manylinux1_x86_64.whl

Check the SciPy internal function again

 

You can see that there are functions like imread, imsave, imshow, etc

Imresize import error: cannot import name ‘imresize’

Import imresize in Python code:

from scipy.misc import imresize

Unable to import due to the following error:

ImportError: cannot import name 'imresize'

This is due to the problem with the version of SciPy. The function imresize will no longer be included in the version after SciPy 1.3.0

imresize is deprecated! imresize is deprecated in SciPy 1.0.0, and will be removed in 1.3.0. Use Pillow instead: numpy.array ( Image.fromarray (arr).resize()).

Therefore, in order to use imresize, you need to reduce SciPy to an earlier version:

pip3 install scipy==1.1.0

Problem solving.