don't install requirements.txt if environment.yml is present
The most likely cause of both being present is equivalent dependencies for two use cases,
not a single multi-stage conda environment.
If deps should be installed in conda with pip, they will be in `environment.yml` under `pip`.
MODIFY
repo2docker/detectors.py
repo2docker/detectors.py
@@ -554,7 +554,7 @@ class CondaBuildPack(BuildPack):
conda clean -tipsy
"""
))
- if os.path.exists('requirements.txt'):
+ elif os.path.exists('requirements.txt'):
assembly_scripts.append((
'${NB_USER}',
'pip install --no-cache-dir -r requirements.txt'

MODIFY
tests/conda/requirements/README.rst
tests/conda/requirements/README.rst
Python - Mixed Requirements
---------------------------
-You can specify both a ``requirements.txt`` and an ``environment.yml`` file,
-and both of these will be used to build your environment.
+An ``environment.yml`` takes precedence over ``requirements.txt``.
+To install files into a conda environment with pip, use the ``pip`` key in ``environment.yml``:
+
+.. sourcecode:: yaml
+
+ dependencies:
+ - numpy
+ - pip:
+ - tornado

MODIFY
tests/conda/requirements/environment.yml
tests/conda/requirements/environment.yml
dependencies:
- numpy
+ - pip:
+ - simplejson

MODIFY
tests/conda/requirements/verify
tests/conda/requirements/verify
@@ -4,4 +4,9 @@ import sys
assert sys.version_info[:2] == (3, 6)
import numpy
+try:
import there
+except ImportError:
+ print('ok')
+else:
+ raise Exception("'there' shouldn't have been installed from requirements.txt")

don't install requirements.txt if environment.yml is present

The most likely cause of both being present is equivalent dependencies for two use cases,
not a single multi-stage conda environment.

If deps should be installed in conda with pip, they will be in `environment.yml` under `pip`.