pip extras in zsh
Pip extras
In many Python packages, installation is given with extras and it is written as follows.
pip install spacy[apple]
This is to install spaCy
(opens in a new tab) package along with dependencies for Apple Silicon-based macs.
What's the problem?
Whenever I tried to install this specific package for my M1-Macbook Air, my shell complained and refused to work.
Then, it happened to me that the problem might be the shell, as Apple adopted zsh
as the default shell since Catalina. Going forward, every Mac OS has been shipped with it, including Big Sur
, the first OS pre-installed with Apple Silicon chips.
In other words, there is no way to make this specific command works on the zsh
shell.
To verify, I ran the same command with the bash
shell and it confirmed my theory as the command ran as I expected.
No solution, then?
Of course not.
One obvious solution would to change the default shell back to bash
, if I wouldn't recommend for conda (or mamba) users. The usual conda activate
(or mamba activate
) didn't work for me as I installed it on the zsh
shell.
Rather, just changing the command by a bit makes it work with the zsh
shell. That is, add ** before the bracket starts.
For instance, the same command I wrote at the start would be like this.
pip install spacy\[apple]
Done.
In case, you need a specific version of the package, the same thing applies.
pip install spacy\[apple]==3.4.4
La fin.
CC BY-NC 4.0 © min park.RSS