From 83c0f7d3bc4d2ca7bdef7503e068764b71461120 Mon Sep 17 00:00:00 2001 From: Sebastian Luna-Valero Date: Thu, 24 Nov 2022 08:20:25 +0100 Subject: [PATCH 1/3] Do not use `--kind=explicit` --- docs/pip.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/pip.md b/docs/pip.md index 58b1a1e18..a1fe3dd80 100644 --- a/docs/pip.md +++ b/docs/pip.md @@ -21,6 +21,10 @@ dependencies: If in this case `some_pip_only_library` depends on `requests` that dependency will be met by conda and the version will be constrained to what the conda solver determines. +Please note that explicit lock files do not support installing `pip` dependencies. +The unified lockfile format does (i.e. the `--kind=explicit` flag cannot be used +with `conda-lock --file=environment.yml`) + ## Usage with pyproject.toml If a dependency refers directly to a URL rather than a package name and version, From 152bc2a9e7a735fa3a6d2f506f542ac229399c03 Mon Sep 17 00:00:00 2001 From: Sebastian Luna-Valero Date: Thu, 24 Nov 2022 18:19:41 +0100 Subject: [PATCH 2/3] Update docs/pip.md Co-authored-by: Ben Mares --- docs/pip.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/pip.md b/docs/pip.md index a1fe3dd80..1dba37e3c 100644 --- a/docs/pip.md +++ b/docs/pip.md @@ -21,9 +21,10 @@ dependencies: If in this case `some_pip_only_library` depends on `requests` that dependency will be met by conda and the version will be constrained to what the conda solver determines. -Please note that explicit lock files do not support installing `pip` dependencies. -The unified lockfile format does (i.e. the `--kind=explicit` flag cannot be used -with `conda-lock --file=environment.yml`) +We recommend avoiding the `--kind=explicit` flag when there are `pip` +dependencies. Most tools (except for `conda-lock install`) do not recognize +`pip` dependencies from explicit lockfiles, so they may be silently ignored. +The default lockfile format explicitly supports pip dependencies. ## Usage with pyproject.toml From b0f8a69ec2a3b3f73fca6927436d7ee46ff0b2e5 Mon Sep 17 00:00:00 2001 From: Sebastian Luna-Valero Date: Fri, 25 Nov 2022 07:37:41 +0100 Subject: [PATCH 3/3] add warning --- conda_lock/conda_lock.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conda_lock/conda_lock.py b/conda_lock/conda_lock.py index 31b6157ba..179bc6ac3 100644 --- a/conda_lock/conda_lock.py +++ b/conda_lock/conda_lock.py @@ -675,6 +675,15 @@ def sanitize_lockfile_line(line: str) -> str: for dep in pip_deps ] ) + + if len(pip_deps) > 0: + logger.warning( + "WARNING: installation of pip dependencies is only supported " + "by the 'conda-lock install' command. Other tools may silently " + "ignore them. For portability, we recommend using the newer " + "unified lockfile format (i.e. removing the --kind=explicit " + "argument." + ) else: raise ValueError(f"Unrecognised lock kind {kind}.")