I am trying to import gensim into colab.
!pip install gensim
I get the following error:
/usr/local/lib/python3.11/dist-packages/numpy/__init__.py in __getattr__(attr)
365 raise AssertionError()
366 except AssertionError:
--> 367 msg = ("The current Numpy installation ({!r}) fails to "
368 "pass simple sanity checks. This can be caused for example "
369 "by incorrect BLAS library being linked in, or by mixing "
ModuleNotFoundError: No module named 'numpy.char'
my numpy version is 2.02. If I downgrade numpy to another version like say 1.26.4 I get a different error but always a numpy string related issue. Thanks
You have to restart the session for the underlying runtime to notice the package changes. See: https://stackoverflow.com/a/79518359/130288
I recall in the past Colab offering a warning when you had to do this. And possibly also, in the past, Colab hadn't yet loaded numpy
/etc in a fresh environment – and so it was OK for them to downgrade behind the scenes without a problem - the 1st import was only after the downgrade.
But something changed in Colab recently – maybe some fast-start optimization? – with a bunch of reports of problems like this in just the last day or two.
Explicitly restarting after the Gensim-install & numpy
/scipy
downgrades resolves the errors.