thegreatjedi
thegreatjedi

Reputation: 3038

Do I need to configure interoperability between Conda and pip for each new environment?

From Conda 4.6 onwards, it is possible to configure Conda to directly install PyPi packages using pip (https://www.anaconda.com/conda-4-6-release/). Specifically, you need to manually enable it via conda config --set pip_interop_enabled True

I don't know how to check Conda's existing configurations, so I can't tell if this setting persists globally across environments or if I need to manually enable it every time I create a new environment. Any ideas?

I hardly see anyone mention this feature so far, which I guess is understandable considering that official article has been out for only about 3 months. So far, I've only found one answer in one SO question referencing this feature, and that's only mentioning that it exists.

Upvotes: 2

Views: 1650

Answers (2)

Mike Williamson
Mike Williamson

Reputation: 3270

How to check Conda's existing configurations:

conda config --show


While @merv's answer provides more depth, the OP actually asked the simple question above, so I thought I would answer it.

conda config --show will list all configurations, including whether or not pip_interop_enabled is True or False.

Upvotes: 0

merv
merv

Reputation: 77117

Be aware that mixing Conda and Pip is still generally discouraged, despite the existence of this experimental feature. I strongly recommend continuing to follow the best practices suggested in "Using Pip in a Conda Environment".

The description "to configure Conda to directly install PyPI packages using pip" isn't so accurate. Instead, the feature is to enable Conda to consider the presence of PyPI-installed packages when attempting to resolve dependencies. It does not enable Conda to install things using pip. It has more to do with preventing Conda from blindly clobbering PyPI packages when they are present.

It should be noted that using an env YAML to create (conda env create -f env.yaml) or update (conda env update -f env.yaml) an env does already support using pip - with or without this feature enabled.

As for settings, you can always check all settings with conda config --show. Whenever you use conda config --set it defaults to making a global change. If you want to set a configuration variable only for a specific env, then you must activate the env and include --env flag when running conda config --set.

Upvotes: 6

Related Questions