koaning / whatlies

Toolkit to help understand "what lies" in word embeddings. Also benchmarking!
https://koaning.github.io/whatlies/
Apache License 2.0
469 stars 50 forks source link

Error after installing umap #327

Closed mehmetilker closed 2 years ago

mehmetilker commented 2 years ago

I could run simple examples from the guide until installing "pip install whatlies[umap]"

Then I started to see this error: Maybe it is related with numpy, it uninstall version 1.22.2 and installs 1.21.5

[File stringsource:105, in init gensim._matutils()

AttributeError: type object 'gensim._matutils.array' has no attribute '__reduce_cython__']()
koaning commented 2 years ago

That's ... strange.

Could you try installing umap manually?

mehmetilker commented 2 years ago

If you mean "pip install umap" than it still requires installation specified in that warning.

[ModuleNotFoundError: In order to use Umap you'll need to install via;

pip install whatlies[umap]

See installation guide here: https://rasahq.github.io/whatlies/#installation.]()
koaning commented 2 years ago

Could you share the commands that you tried in a fresh virtual environment? That way we might try to reproduce it.

Also, what Python version/operating system are you using?

mehmetilker commented 2 years ago

I have created a fresh env to be sure it is not related with my prev. env. But now there is another problem.

Python 3.9.5 Fresh env: First: pip install whatlies[spacy] -loading a model with spacy and can see a plot working -When I run umap example, I see warning: pip install whatlies[umap] installation complates with this warning: ERROR: numba 0.55.1 has requirement numpy<1.22,>=1.18, but you'll have numpy 1.22.2 which is incompatible.

Restart kernel and repeat: now basic plotting still works but umap example does not work due to same error:


[ModuleNotFoundError: In order to use Umap you'll need to install via;
pip install whatlies[umap]

See installation guide here: https://rasahq.github.io/whatlies/#installation.]()
koaning commented 2 years ago

I see, but it looks like you haven't tried installing umap manually.

python -m pip install umap-learn

When you try to install umap direct, what output do you see?

mehmetilker commented 2 years ago

I tried but as ~~python -m pip install umap~

Then I tried with: python -m pip install umap-learn

Same:

[ModuleNotFoundError: In order to use Umap you'll need to install via;

pip install whatlies[umap]

See installation guide here: https://rasahq.github.io/whatlies/#installation.]()
koaning commented 2 years ago

@mehmetilker I'm doing my best to understand where something is going wrong but it'd help if you explained in more detail what you tried, what you expected, and what went wrong. I asked for your operating system, which you haven't given yet and you've also not shared the actual python code that triggers the error.

I'm assuming it's an import error but it's unclear what steps you've taken, and in what order they happened. Could you please be as explicit as possible, by starting a new virtual environment, and could you please document every step that you've taken?

When I install the project with umap it seems to work fine.

python -m pip install "whatlies[umap]"

There is an installation warning in the background about numba, but it does not cause the import to go awry.

# This just works. 
from whatlies.transformers import Umap
mehmetilker commented 2 years ago

Sorry to miss operating system part... Ubuntu 20.04

I do not have anything new to write since I followed your guide here (https://github.com/koaning/whatlies) but I will try to do my best;

Fresh env: Run on command prompt (success): pip install whatlies[spacy] Run on Notebook (success):

from whatlies import EmbeddingSet
from whatlies.language import SpacyLanguage

lang = SpacyLanguage("vectors/x.1000000.n4-5_floret_model")

Run on notebook (fail, which is expected):

from whatlies.transformers import Pca, Umap

orig_chart = emb.plot_interactive('man', 'woman')
pca_plot = emb.transform(Pca(2)).plot_interactive()
umap_plot = emb.transform(Umap(2)).plot_interactive()

pca_plot | umap_plot

Run on command prompt (succes): pip install whatlies[umap]

Installing collected packages: llvmlite, numba, pynndescent, umap-learn
Successfully installed llvmlite-0.38.0 numba-0.55.1 pynndescent-0.5.6 umap-learn-0.5.2

Run on notebook (fail, I restart kernel in case it did not load whatlies[umap] installation and I repeat running codes on notebook):

from whatlies.transformers import Pca, Umap

orig_chart = emb.plot_interactive('man', 'woman')
pca_plot = emb.transform(Pca(2)).plot_interactive()
umap_plot = emb.transform(Umap(2)).plot_interactive()

pca_plot | umap_plot

Warning:

[ModuleNotFoundError: In order to use Umap you'll need to install via;

pip install whatlies[umap]

See installation guide here: https://rasahq.github.io/whatlies/#installation.]()

Is there anything I am missing to see?

koaning commented 2 years ago

Did you install everything before running all the code? I just want to rule out it's a virtualenv thing where you've started the notebook, ran some code that didn't work, installed a tool but forgot to restart the notebook.

mehmetilker commented 2 years ago

Yes I have tried to restart notebook as I have written above steps I tried multiple times. Not only in new notebook but also in previous one. I tried lots of different combinations. How hard it could be running "pip install whatlies[umap]" then run a simple code?

I appreciate your help. If it works on your side, then I should spent my time to look for another solution... Thanks for your time.