How to install Pip Packages in an Anaconda (“Conda”) Env.
A quick guide on installing pip packages into your Anaconda env
Anaconda is a pretty nifty package manager in the Data Science community. One of its pitfalls, however, is that anaconda doesn’t have full coverage of the default python package repository pypi.org. What this means is that while a package might be available on pypi.org, it might not have been “conda-ized”, A.K.A, uploaded to the Conda platform.
However, there is a really nifty trick that you can use to install packages that aren’t available in their conda form into your Conda env.
Traditional Method
Traditionally, you can activate a conda env, and then just operate as you normally would by using pip install packageName
however, this doesn’t ensure that the package gets installed into the anaconda library directory, and could result in the package being installed into another (non-anaconda) pip library directory.
Improved Method
To ensure that our packages get installed to the anaconda library directory, and assuming you have pip installed in your anaconda directory via:conda install -c conda-forge pip
you can then use the following command:
python -m pip install PackageName
This will ensure that your pip package is properly installed into your anaconda env, and not accidentally installed into a non-conda library.
Questions?
You can find me on:
- GitHub: https://github.com/bengejd/
- Medium: https://medium.com/@JordanBenge
- Twitter: https://twitter.com/J_Benge13
Who am I? My name is Jordan Benge, I am a Software Developer who loves helping others and contributing to Open-Source whenever possible. I like to write up guides on how to do things that interest me that aren’t completely covered elsewhere.