Skip to content

Commit

Permalink
conda_env.env: fixed detection of pip in environment
Browse files Browse the repository at this point in the history
split dependency names using `r"[\s=]"` to detect `pip` as a conda package dependency
  • Loading branch information
duncanmmacleod committed Apr 2, 2019
1 parent b6e9fff commit 9c82fbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions conda_env/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import OrderedDict
from itertools import chain
import os
import re

from conda.base.context import context
from conda.cli import common # TODO: this should never have to import form conda.cli
Expand Down Expand Up @@ -47,9 +48,10 @@ def validate_keys(data, kwargs):
print('')

deps = data.get('dependencies', [])
depsplit = re.compile(r"[\s=]")
for dep in deps:
if (isinstance(dep, dict) and 'pip' in dep
and not any(_.split()[0] == 'pip' for _ in deps if not hasattr(_, 'keys'))):
if (isinstance(dep, dict) and 'pip' in dep and not
any(depsplit.split(_)[0] == 'pip' for _ in deps if not hasattr(_, 'keys'))):
print("Warning: you have pip-installed dependencies in your environment file, "
"but you do not list pip itself as one of your conda dependencies. Conda "
"may not use the correct pip to install your packages, and they may end up "
Expand Down

0 comments on commit 9c82fbc

Please sign in to comment.