Alexander Farkas
Alexander Farkas

Reputation: 688

What to do if you need packages from both conda and pip?

I've been developing my project with pip (django, drm etc). Now I need to use faiss, which only has unofficial package on pip (official - in conda). What should I do in this situation? Can I combine them somehow? Or should I migrate to conda?

Upvotes: 1

Views: 646

Answers (1)

Stuart Berg
Stuart Berg

Reputation: 18141

If you're using a non-conda environment, then you're limited to using pip only. That is, pip does not know how to install conda packages.

But if you switch to using conda, then you can use either. The general recommendation is to install everything with conda if possible, but use pip when you have no other choice.

I recommend installing Miniconda, then creating a new environment for all of your dependencies. If necessary, add pip-only dependencies (if you have any).

conda create --name alex python=3.8 pip django requests bla-bla-bla
conda activate alex
pip install drm foo bar yada-yada

If you need uncommon or bleeding-edge packages, you might also consider obtaining your conda packages from the conda-forge channel, rather than the defaults channel. See here for instructions.

Upvotes: 2

Related Questions