0

This may be a silly simple question, but I couldn't find an answer in the documentation of Anaconda or elsewhere. I am a bit of a noob when it comes to Python and I am trying to install a package. The problem is generalizable to other packages.

specs

I am working on a macOS Catalina (10.15.5) and using Anaconda as my python environment (python2.7).

problem

I am attempting to install the package pyLDAvis in my python environment, but the package isn't available on Anaconda's environment manager, and pip or conda install isn't working on the Spyder shell. Do pip and conda installs only work on the Anaconda Prompt? The problem is that I have read that the Anaconda Prompt only exists on Windows, and I am on mac. How could I install packages (pip, conda, or else) on Anaconda?

Am I missing something?

Any help or pointers to documentation would be great! Thanks

sumusa
  • 1
  • 1
  • 3

2 Answers2

3

Assuming you have conda already installed and your shell is properly configured, you can activate the base environment via

conda activate

You can also create a new environment, see manage-environments docs.

For more information than given below, see manage-pkgs docs.

In case of conda, after your environment is activated, you can then install a package via conda install <package name>, e.g. the package numpy

conda install numpy

In case of pip, after your environment is activated, you can then install a package via pip install <package name>, e.g. the package numpy

pip install numpy

I only do this if the package is not available via a conda channel.

If the package is also not available via pip, you can download the source and set the package up your self. Usually the package author describes how to set up his/her package.

Stefan
  • 1,697
  • 15
  • 31
0

Thanks Stefan for the suggestion! I struggled a bit because although conda was "already installed", my shell was indeed not "properly configured." I am writing here my solution because it may be a recurring theme for macOS users and had an easy fix.

Starting with macOS Catalina, macOS uses zsh and not bash as the default shell, and so calling conda on zsh had no effect. The error message was: -zsh: conda: command not found. I solved this by changing the default shell to bash by running the following command: chsh -s /bin/bash.

Now that the shell and conda are properly configured, I managed to use conda activate as you suggested Stefan.

Finally, the package pyLDAvis could not be installed by conda install pyldavis but was installed with pip install pyldavis.

Solved!

sumusa
  • 1
  • 1
  • 3