4

Any leads on how can I install gensim on the M1 chip on the new Mac community? There hasn't been much news yet for this. This is the only other question there -

can't install gensim on apple M1

(and I am not looking to use rosetta)

ERROR:

RuntimeError: Cython extensions are unavailable. Without them, this gensim functionality is disabled. If you've installed from a package, ask the package maintainer to include Cython extensions.

Anan
  • 159
  • 1
  • 1
  • 13
  • 2
    A simple pip install (in a Miniconda env) works perfectly fine on my M1 Mac Mini (not using Rosetta). Where exactly do you struggle? – petezurich Apr 19 '21 at 20:03
  • Do you net get the Cython runtime error? Updated question with the error message. Gesim installs but I can't use it because of this error. – Anan Apr 19 '21 at 20:21
  • 1
    How did you try to install Gensim, into what kind of environment? Did you watch the output of the install command for anything anomalous? (Have you tried using a miniconda environment, then installing via `pip` into that environment, as @petezurich reports above works for him?) – gojomo Apr 19 '21 at 20:32
  • 1
    I don't get any errors and can use gensim just fine. – petezurich Apr 19 '21 at 20:41
  • @gojomo - Installed Miniforge as that is the recommended way to do it on the m1 Mac for now. created a virtual environment using Conda. Now Miniforge library for m1 doesn't have gensim yet. So I did pip install gensim inside my venv. Now when I run my file, I get the above error. – Anan Apr 20 '21 at 06:53
  • Thats great @petezurich. Please let me know how did you install it. Requesting you to give me all the necessary steps. – Anan Apr 20 '21 at 06:53
  • 1
    There seems not much to add. I install the ARM version of miniconda, make an env (Python v. 3.8) and simply pip install gensim. I can use gensim in notebooks just fine. I don't get any errors whatsoever. Are you sure that you use the M1/ARM version of miniconda? You might want to check [this SO thread](https://stackoverflow.com/questions/65534042/anaconda-and-upgrading-to-new-m1-mac) too. – petezurich Apr 20 '21 at 08:55
  • where did you install the arm miniconda from? May I kindly have a link? – Anan Apr 20 '21 at 08:58
  • I'm not sure where miniforge is the 'recommended' way to do it, but the testimony here is that plain 'miniconda' works, so I'd try that, & not improvise other things. I'd get miniconda from here: https://docs.conda.io/en/latest/miniconda.html – gojomo Apr 20 '21 at 17:12
  • Thanks everyone. Turns out MiniForge was the issue. I uninstalled and installed Miniconda. – Anan Apr 21 '21 at 09:16

1 Answers1

3

First of all, I know this is not the best and safest choice, but this thing worked for me. As I wanted to install sklearn on M1, I needed to have anaconda installed, and also the specific channel that supports it was conda-forge. To install Gensim, I just did a simple pip install gensim inside of the conda environment where I have my other packages installed.

In general, it's not the best idea to install different packages using a combination of conda and pip, but sadly, I think you have no other choice if you want to make things work on m1.

Zhivar Sourati
  • 395
  • 3
  • 8