Repository: conda/conda

Issue:
Unable to create environment from yml file with pip install
<!--
Hi!  Read this; it's important.

This is an issue tracker for conda -- the package manager.  File feature requests
for conda here, as well as bug reports about something conda has messed up.

If your issue is a bug report for:
  * a specific conda package from Anaconda ('defaults' channel):
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * a specific conda package from conda-forge:
      ==> file at the corresponding feedstock under https://github.com/conda-forge
  * repo.anaconda.com access and service:
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * anaconda.org access and service:
      ==> file at https://anaconda.org/contact/report
  * commands under 'conda build':
      ==> file at https://github.com/conda/conda-build
  * commands under 'conda env':
      ==> please file it here!
  * all other conda commands that start with 'conda':
      ==> please file it here!

If you continue on,

   **please include all requested information below.**

If a maintainer determines the information is required to understand 
your issue, and if it is not provided, your issue may be
closed automatically.

-->

## Current Behavior
<!-- What actually happens?
     If you want to include console output, please use "Steps to Reproduce" below. -->

I am trying to create an environment on Mac OS using a `.yml` file. This has worked fine in the past, but it doesn't work at all anymore (including with previously used yml files). It spits out a bunch of weird output.

### Steps to Reproduce
<!-- If the current behavior is a bug, please provide specific, minimal steps to independently reproduce.
     Include the exact conda commands that reproduce the issue and their output between the ticks below. -->
```
conda env create -f test.yml

cat test.yml:
name: testpip
channels:
  - defaults
  - conda-forge
dependencies:
  - python
  - pip:
    - dill

output:
Collecting package metadata: done
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

CondaEnvException: Pip subcommand failed with 
output: 
error: ++ /Users/Michael/.brew/anaconda3/bin/conda shell.posix hook
+ eval 'export CONDA_EXE="/Users/Michael/.brew/anaconda3/bin/conda"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause

__conda_hashr() {
    if [ -n "${ZSH_VERSION:+x}" ]; then
        \rehash
    elif [ -n "${POSH_VERSION:+x}" ]; then
        :  # pass
    else
        \hash -r
    fi
}

__conda_activate() {
    if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
        # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
        # after conda updated to >= 4.4. See issue #6173.
        PS1="$CONDA_PS1_BACKUP"
        \unset CONDA_PS1_BACKUP
    fi

    \local cmd="$1"
    shift
    \local ask_conda
    ask_conda="$(PS1="$PS1" "$CONDA_EXE" shell.posix "$cmd" "$@")" || \return $?
    \eval "$ask_conda"
    __conda_hashr
}

__conda_reactivate() {
    \local ask_conda
    ask_conda="$(PS1="$PS1" "$CONDA_EXE" shell.posix reactivate)" || \return $?
    \eval "$ask_conda"
    __conda_hashr
}

conda() {
    if [ "$#" -lt 1 ]; then
        "$CONDA_EXE"
    else
        \local cmd="$1"
        shift
        case "$cmd" in
            activate|deactivate)
                __conda_activate "$cmd" "$@"
                ;;
            install|update|upgrade|remove|uninstall)
                "$CONDA_EXE" "$cmd" "$@" && __conda_reactivate
                ;;
            *) "$CONDA_EXE" "$cmd" "$@" ;;
        esac
    fi
}

if [ -z "${CONDA_SHLVL+x}" ]; then
    \export CONDA_SHLVL=0
    PATH="$(dirname "$(dirname "$CONDA_EXE")")/condabin:${PATH:-}"
    \export PATH

    # We'\''re not allowing PS1 to be unbound. It must at least be set.
    # However, we'\''re not exporting it, which can cause problems when starting a second shell
    # via a first shell (i.e. starting zsh from bash).
    if [ -z "${PS1+x}" ]; then
        PS1=
    fi
fi


conda activate base'
++ export CONDA_EXE=/Users/Michael/.brew/anaconda3/bin/conda
++ CONDA_EXE=/Users/Michael/.brew/anaconda3/bin/conda
++ '[' -z x ']'
++ conda activate base
++ '[' 2 -lt 1 ']'
++ local cmd=activate
++ shift
++ case "$cmd" in
++ __conda_activate activate base
++ '[' -n '' ']'
++ local cmd=activate
++ shift
++ local ask_conda
+++ PS1=
+++ /Users/Michael/.brew/anaconda3/bin/conda shell.posix activate base
++ ask_conda='\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''1'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
++ eval '\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''1'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
+++ export CONDA_PROMPT_MODIFIER=
+++ CONDA_PROMPT_MODIFIER=
+++ export CONDA_SHLVL=1
+++ CONDA_SHLVL=1
+++ export PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
+++ PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
++ __conda_hashr
++ '[' -n '' ']'
++ '[' -n '' ']'
++ hash -r
+ conda activate /Users/Michael/.brew/anaconda3/envs/testpip
+ '[' 2 -lt 1 ']'
+ local cmd=activate
+ shift
+ case "$cmd" in
+ __conda_activate activate /Users/Michael/.brew/anaconda3/envs/testpip
+ '[' -n '' ']'
+ local cmd=activate
+ shift
+ local ask_conda
++ PS1=
++ /Users/Michael/.brew/anaconda3/bin/conda shell.posix activate /Users/Michael/.brew/anaconda3/envs/testpip
+ ask_conda='\export CONDA_DEFAULT_ENV='\''testpip'\''
\export CONDA_PREFIX='\''/Users/Michael/.brew/anaconda3/envs/testpip'\''
\export CONDA_PREFIX_1='\''/Users/Michael/.brew/anaconda3'\''
\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''2'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/envs/testpip/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
+ eval '\export CONDA_DEFAULT_ENV='\''testpip'\''
\export CONDA_PREFIX='\''/Users/Michael/.brew/anaconda3/envs/testpip'\''
\export CONDA_PREFIX_1='\''/Users/Michael/.brew/anaconda3'\''
\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''2'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/envs/testpip/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
++ export CONDA_DEFAULT_ENV=testpip
++ CONDA_DEFAULT_ENV=testpip
++ export CONDA_PREFIX=/Users/Michael/.brew/anaconda3/envs/testpip
++ CONDA_PREFIX=/Users/Michael/.brew/anaconda3/envs/testpip
++ export CONDA_PREFIX_1=/Users/Michael/.brew/anaconda3
++ CONDA_PREFIX_1=/Users/Michael/.brew/anaconda3
++ export CONDA_PROMPT_MODIFIER=
++ CONDA_PROMPT_MODIFIER=
++ export CONDA_SHLVL=2
++ CONDA_SHLVL=2
++ export PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/envs/testpip/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
++ PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/.brew/anaconda3/envs/testpip/bin:/Users/Michael/.brew/anaconda3/condabin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
+ __conda_hashr
+ '[' -n '' ']'
+ '[' -n '' ']'
+ hash -r
/Users/Michael/.brew/anaconda3/envs/testpip/.tmpjnp3x_cw: line 3: syntax error near unexpected token `('
/Users/Michael/.brew/anaconda3/envs/testpip/.tmpjnp3x_cw: line 3: `pip install -r /[PATH REMOVED FOR PRIVACY (Location of test.yml)]/condaenv.cx06b6nv.requirements.txt'
```


## Expected Behavior
<!-- What do you think should happen? -->
It should install an environment with python and dill. I know that I can install dill with conda directly, but this is just an example package from pip.

## Environment Information
<details open><summary><code>`conda info`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda info' -->

```
     active environment : base
    active env location : /Users/Michael/.brew/anaconda3
            shell level : 1
       user config file : /Users/Michael/.condarc
 populated config files : /Users/Michael/.condarc
          conda version : 4.6.7
    conda-build version : 3.17.6
         python version : 3.7.1.final.0
       base environment : /Users/Michael/.brew/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/Michael/.brew/anaconda3/pkgs
                          /Users/Michael/.conda/pkgs
       envs directories : /Users/Michael/.brew/anaconda3/envs
                          /Users/Michael/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.7 requests/2.21.0 CPython/3.7.1 Darwin/18.2.0 OSX/10.14.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False
```
</p></details>


<details open><summary><code>`conda config --show-sources`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda config --show-sources' -->

```
==> /Users/Michael/.condarc <==
changeps1: False
ssl_verify: True
channels:
  - defaults
```
</p></details>


<details><summary><code>`conda list --show-channel-urls`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda list --show-channel-urls' -->

```
 packages in environment at /Users/Michael/.brew/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0    defaults
alabaster                 0.7.12                   py37_0    defaults
anaconda                  2018.12                  py37_0    defaults
anaconda-client           1.7.2                    py37_0    defaults
anaconda-navigator        1.9.6                    py37_0    defaults
anaconda-project          0.8.2                    py37_0    defaults
appnope                   0.1.0                    py37_0    defaults
appscript                 1.0.1            py37h1de35cc_1    defaults
asn1crypto                0.24.0                   py37_0    defaults
astroid                   2.1.0                    py37_0    defaults
astropy                   3.1              py37h1de35cc_0    defaults
atomicwrites              1.2.1                    py37_0    defaults
attrs                     18.2.0           py37h28b3542_0    defaults
babel                     2.6.0                    py37_0    defaults
backcall                  0.1.0                    py37_0    defaults
backports                 1.0                      py37_1    defaults
backports.os              0.1.1                    py37_0    defaults
backports.shutil_get_terminal_size 1.0.0                    py37_2    defaults
beautifulsoup4            4.6.3                    py37_0    defaults
bitarray                  0.8.3            py37h1de35cc_0    defaults
bkcharts                  0.2                      py37_0    defaults
blas                      1.0                         mkl    defaults
blaze                     0.11.3                   py37_0    defaults
bleach                    3.0.2                    py37_0    defaults
blosc                     1.14.4               hd9629dc_0    defaults
bokeh                     1.0.2                    py37_0    defaults
boto                      2.49.0                   py37_0    defaults
bottleneck                1.2.1            py37h1d22016_1    defaults
bzip2                     1.0.6                h1de35cc_5    defaults
ca-certificates           2018.03.07                    0    defaults
certifi                   2018.11.29               py37_0    defaults
cffi                      1.11.5           py37h6174b99_1    defaults
chardet                   3.0.4                    py37_1    defaults
click                     7.0                      py37_0    defaults
cloudpickle               0.6.1                    py37_0    defaults
clyent                    1.2.2                    py37_1    defaults
colorama                  0.4.1                    py37_0    defaults
conda                     4.6.7                    py37_0    defaults
conda-build               3.17.6                   py37_0    defaults
conda-env                 2.6.0                         1    defaults
conda-verify              3.1.1                    py37_0    defaults
contextlib2               0.5.5                    py37_0    defaults
cryptography              2.4.2            py37ha12b0ac_0    defaults
curl                      7.63.0            ha441bb4_1000    defaults
cycler                    0.10.0                   py37_0    defaults
cython                    0.29.2           py37h0a44026_0    defaults
cytoolz                   0.9.0.1          py37h1de35cc_1    defaults
dask                      1.0.0                    py37_0    defaults
dask-core                 1.0.0                    py37_0    defaults
datashape                 0.5.4                    py37_1    defaults
dbus                      1.13.2               h760590f_1    defaults
decorator                 4.3.0                    py37_0    defaults
defusedxml                0.5.0                    py37_1    defaults
distributed               1.25.1                   py37_0    defaults
docutils                  0.14                     py37_0    defaults
entrypoints               0.2.3                    py37_2    defaults
et_xmlfile                1.0.1                    py37_0    defaults
expat                     2.2.6                h0a44026_0    defaults
fastcache                 1.0.2            py37h1de35cc_2    defaults
filelock                  3.0.10                   py37_0    defaults
flask                     1.0.2                    py37_1    defaults
flask-cors                3.0.7                    py37_0    defaults
freetype                  2.9.1                hb4e5f40_0    defaults
future                    0.17.1                   py37_0    defaults
get_terminal_size         1.0.0                h7520d66_0    defaults
gettext                   0.19.8.1             h15daf44_3    defaults
gevent                    1.3.7            py37h1de35cc_1    defaults
glib                      2.56.2               hd9629dc_0    defaults
glob2                     0.6                      py37_1    defaults
gmp                       6.1.2                hb37e062_1    defaults
gmpy2                     2.0.8            py37h6ef4df4_2    defaults
greenlet                  0.4.15           py37h1de35cc_0    defaults
h5py                      2.8.0            py37h878fce3_3    defaults
hdf5                      1.10.2               hfa1e0ec_1    defaults
heapdict                  1.0.0                    py37_2    defaults
html5lib                  1.0.1                    py37_0    defaults
icu                       58.2                 h4b95b61_1    defaults
idna                      2.8                      py37_0    defaults
imageio                   2.4.1                    py37_0    defaults
imagesize                 1.1.0                    py37_0    defaults
importlib_metadata        0.6                      py37_0    defaults
intel-openmp              2019.1                      144    defaults
ipykernel                 5.1.0            py37h39e3cac_0    defaults
ipython                   7.2.0            py37h39e3cac_0    defaults
ipython_genutils          0.2.0                    py37_0    defaults
ipywidgets                7.4.2                    py37_0    defaults
isort                     4.3.4                    py37_0    defaults
itsdangerous              1.1.0                    py37_0    defaults
jbig                      2.1                  h4d881f8_0    defaults
jdcal                     1.4                      py37_0    defaults
jedi                      0.13.2                   py37_0    defaults
jinja2                    2.10                     py37_0    defaults
jpeg                      9b                   he5867d9_2    defaults
jsonschema                2.6.0                    py37_0    defaults
jupyter                   1.0.0                    py37_7    defaults
jupyter_client            5.2.4                    py37_0    defaults
jupyter_console           6.0.0                    py37_0    defaults
jupyter_core              4.4.0                    py37_0    defaults
jupyterlab                0.35.3                   py37_0    defaults
jupyterlab_server         0.2.0                    py37_0    defaults
keyring                   17.0.0                   py37_0    defaults
kiwisolver                1.0.1            py37h0a44026_0    defaults
krb5                      1.16.1               hddcf347_7    defaults
lazy-object-proxy         1.3.1            py37h1de35cc_2    defaults
libarchive                3.3.3                h786848e_5    defaults
libcurl                   7.63.0            h051b688_1000    defaults
libcxx                    4.0.1                hcfea43d_1    defaults
libcxxabi                 4.0.1                hcfea43d_1    defaults
libedit                   3.1.20170329         hb402a30_2    defaults
libffi                    3.2.1                h475c297_4    defaults
libgfortran               3.0.1                h93005f0_2    defaults
libiconv                  1.15                 hdd342a3_7    defaults
liblief                   0.9.0                h2a1bed3_0    defaults
libpng                    1.6.35               ha441bb4_0    defaults
libsodium                 1.0.16               h3efe00b_0    defaults
libssh2                   1.8.0                ha12b0ac_4    defaults
libtiff                   4.0.9                hcb84e12_2    defaults
libxml2                   2.9.8                hab757c2_1    defaults
libxslt                   1.1.32               hb819dd2_0    defaults
llvmlite                  0.26.0           py37h8c7ce04_0    defaults
locket                    0.2.0                    py37_1    defaults
lxml                      4.2.5            py37hef8c89e_0    defaults
lz4-c                     1.8.1.2              h1de35cc_0    defaults
lzo                       2.10                 h362108e_2    defaults
markupsafe                1.1.0            py37h1de35cc_0    defaults
matplotlib                3.0.2            py37h54f8f79_0    defaults
mccabe                    0.6.1                    py37_1    defaults
mistune                   0.8.4            py37h1de35cc_0    defaults
mkl                       2019.1                      144    defaults
mkl-service               1.1.2            py37hfbe908c_5    defaults
mkl_fft                   1.0.6            py37h27c97d8_0    defaults
mkl_random                1.0.2            py37h27c97d8_0    defaults
more-itertools            4.3.0                    py37_0    defaults
mpc                       1.1.0                h6ef4df4_1    defaults
mpfr                      4.0.1                h3018a27_3    defaults
mpmath                    1.1.0                    py37_0    defaults
msgpack-python            0.5.6            py37h04f5b5a_1    defaults
multipledispatch          0.6.0                    py37_0    defaults
navigator-updater         0.2.1                    py37_0    defaults
nb_conda_kernels          2.2.0                    py37_1    defaults
nbconvert                 5.4.0                    py37_1    defaults
nbformat                  4.4.0                    py37_0    defaults
ncurses                   6.1                  h0a44026_1    defaults
networkx                  2.2                      py37_1    defaults
nltk                      3.4                      py37_1    defaults
nodejs                    10.13.0              h0a44026_0    defaults
nose                      1.3.7                    py37_2    defaults
notebook                  5.7.4                    py37_0    defaults
numba                     0.41.0           py37h6440ff4_0    defaults
numexpr                   2.6.8            py37h7413580_0    defaults
numpy                     1.15.4           py37hacdab7b_0    defaults
numpy-base                1.15.4           py37h6575580_0    defaults
numpydoc                  0.8.0                    py37_0    defaults
odo                       0.5.1                    py37_0    defaults
olefile                   0.46                     py37_0    defaults
openpyxl                  2.5.12                   py37_0    defaults
openssl                   1.1.1a               h1de35cc_0    defaults
packaging                 18.0                     py37_0    defaults
pandas                    0.23.4           py37h6440ff4_0    defaults
pandoc                    1.19.2.1             ha5e8f32_1    defaults
pandocfilters             1.4.2                    py37_1    defaults
parso                     0.3.1                    py37_0    defaults
partd                     0.3.9                    py37_0    defaults
path.py                   11.5.0                   py37_0    defaults
pathlib2                  2.3.3                    py37_0    defaults
patsy                     0.5.1                    py37_0    defaults
pcre                      8.42                 h378b8a2_0    defaults
pep8                      1.7.1                    py37_0    defaults
pexpect                   4.6.0                    py37_0    defaults
pickleshare               0.7.5                    py37_0    defaults
pillow                    5.3.0            py37hb68e598_0    defaults
pip                       18.1                     py37_0    defaults
pkginfo                   1.4.2                    py37_1    defaults
pluggy                    0.8.0                    py37_0    defaults
ply                       3.11                     py37_0    defaults
prometheus_client         0.5.0                    py37_0    defaults
prompt_toolkit            2.0.7                    py37_0    defaults
psutil                    5.4.8            py37h1de35cc_0    defaults
ptyprocess                0.6.0                    py37_0    defaults
py                        1.7.0                    py37_0    defaults
py-lief                   0.9.0            py37hd4eaf27_0    defaults
pycodestyle               2.4.0                    py37_0    defaults
pycosat                   0.6.3            py37h1de35cc_0    defaults
pycparser                 2.19                     py37_0    defaults
pycrypto                  2.6.1            py37h1de35cc_9    defaults
pycurl                    7.43.0.2         py37ha12b0ac_0    defaults
pyflakes                  2.0.0                    py37_0    defaults
pygments                  2.3.1                    py37_0    defaults
pylint                    2.2.2                    py37_0    defaults
pyodbc                    4.0.25           py37h0a44026_0    defaults
pyopenssl                 18.0.0                   py37_0    defaults
pyparsing                 2.3.0                    py37_0    defaults
pyqt                      5.9.2            py37h655552a_2    defaults
pysocks                   1.6.8                    py37_0    defaults
pytables                  3.4.4            py37h13cba08_0    defaults
pytest                    4.0.2                    py37_0    defaults
pytest-arraydiff          0.3              py37h39e3cac_0    defaults
pytest-astropy            0.5.0                    py37_0    defaults
pytest-doctestplus        0.2.0                    py37_0    defaults
pytest-openfiles          0.3.1                    py37_0    defaults
pytest-remotedata         0.3.1                    py37_0    defaults
python                    3.7.1                haf84260_7    defaults
python-dateutil           2.7.5                    py37_0    defaults
python-libarchive-c       2.8                      py37_6    defaults
python.app                2                        py37_9    defaults
pytz                      2018.7                   py37_0    defaults
pywavelets                1.0.1            py37h1d22016_0    defaults
pyyaml                    3.13             py37h1de35cc_0    defaults
pyzmq                     17.1.2           py37h1de35cc_0    defaults
qt                        5.9.7                h468cd18_1    defaults
qtawesome                 0.5.3                    py37_0    defaults
qtconsole                 4.4.3                    py37_0    defaults
qtpy                      1.5.2                    py37_0    defaults
readline                  7.0                  h1de35cc_5    defaults
requests                  2.21.0                   py37_0    defaults
rope                      0.11.0                   py37_0    defaults
ruamel_yaml               0.15.46          py37h1de35cc_0    defaults
scikit-image              0.14.1           py37h0a44026_0    defaults
scikit-learn              0.20.1           py37h27c97d8_0    defaults
scipy                     1.1.0            py37h1410ff5_2    defaults
seaborn                   0.9.0                    py37_0    defaults
send2trash                1.5.0                    py37_0    defaults
setuptools                40.6.3                   py37_0    defaults
simplegeneric             0.8.1                    py37_2    defaults
singledispatch            3.4.0.3                  py37_0    defaults
sip                       4.19.8           py37h0a44026_0    defaults
six                       1.12.0                   py37_0    defaults
snappy                    1.1.7                he62c110_3    defaults
snowballstemmer           1.2.1                    py37_0    defaults
sortedcollections         1.0.1                    py37_0    defaults
sortedcontainers          2.1.0                    py37_0    defaults
sphinx                    1.8.2                    py37_0    defaults
sphinxcontrib             1.0                      py37_1    defaults
sphinxcontrib-websupport  1.1.0                    py37_1    defaults
spyder                    3.3.2                    py37_0    defaults
spyder-kernels            0.3.0                    py37_0    defaults
sqlalchemy                1.2.15           py37h1de35cc_0    defaults
sqlite                    3.26.0               ha441bb4_0    defaults
statsmodels               0.9.0            py37h1d22016_0    defaults
sympy                     1.3                      py37_0    defaults
tblib                     1.3.2                    py37_0    defaults
terminado                 0.8.1                    py37_1    defaults
testpath                  0.4.2                    py37_0    defaults
tk                        8.6.8                ha441bb4_0    defaults
toolz                     0.9.0                    py37_0    defaults
tornado                   5.1.1            py37h1de35cc_0    defaults
tqdm                      4.28.1           py37h28b3542_0    defaults
traitlets                 4.3.2                    py37_0    defaults
unicodecsv                0.14.1                   py37_0    defaults
unixodbc                  2.3.7                h1de35cc_0    defaults
urllib3                   1.24.1                   py37_0    defaults
wcwidth                   0.1.7                    py37_0    defaults
webencodings              0.5.1                    py37_1    defaults
werkzeug                  0.14.1                   py37_0    defaults
wheel                     0.32.3                   py37_0    defaults
widgetsnbextension        3.4.2                    py37_0    defaults
wrapt                     1.10.11          py37h1de35cc_2    defaults
wurlitzer                 1.0.2                    py37_0    defaults
xlrd                      1.2.0                    py37_0    defaults
xlsxwriter                1.1.2                    py37_0    defaults
xlwings                   0.15.1                   py37_0    defaults
xlwt                      1.3.0                    py37_0    defaults
xz                        5.2.4                h1de35cc_4    defaults
yaml                      0.1.7                hc338f04_2    defaults
zeromq                    4.2.5                h0a44026_1    defaults
zict                      0.1.3                    py37_0    defaults
zlib                      1.2.11               h1de35cc_3    defaults
zstd                      1.3.7                h5bba6e5_0    defaults

```
</p></details>



Discussion:
We don't really support installing anaconda inside of homebrew.  If you can identify what problem appears to happen with our activation script:

```
/Users/Michael/.brew/anaconda3/envs/testpip/.tmpjnp3x_cw: line 3: syntax error near unexpected token `('
```

We'd be happy to take a look.  However, your configuration may be a problem here.  The recent change that happened was to activate the conda env that is created prior to running pip.  This code does work in our tests, but there's always room for something on your system that our code doesn't account for.

https://github.com/conda/conda/blob/master/conda_env/pip_util.py#L24
https://github.com/conda/conda/blob/master/conda/utils.py#L262-L288

Thanks for the response. I can't see why homebrew would make any difference, it's just like installing Anaconda to a different directory, right?

This has been working fine forever, it just broke today. I'm happy to help diagnose the issue, but I don't understand the code you linked to well enough to figure out the error directly. Any pointers?
As I suspected, this isn't an issue with homebrew. I just installed the distribution of anaconda straight from the website, then did `conda update conda`, and then ran `conda env create -f test.yml`. The output is below.

```
Collecting package metadata: done
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

CondaEnvException: Pip subcommand failed with 
output: 
error: ++ /Users/Michael/anaconda3/bin/conda shell.posix hook
+ eval 'export CONDA_EXE="/Users/Michael/anaconda3/bin/conda"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause

__conda_hashr() {
    if [ -n "${ZSH_VERSION:+x}" ]; then
        \rehash
    elif [ -n "${POSH_VERSION:+x}" ]; then
        :  # pass
    else
        \hash -r
    fi
}

__conda_activate() {
    if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
        # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
        # after conda updated to >= 4.4. See issue #6173.
        PS1="$CONDA_PS1_BACKUP"
        \unset CONDA_PS1_BACKUP
    fi

    \local cmd="$1"
    shift
    \local ask_conda
    ask_conda="$(PS1="$PS1" "$CONDA_EXE" shell.posix "$cmd" "$@")" || \return $?
    \eval "$ask_conda"
    __conda_hashr
}

__conda_reactivate() {
    \local ask_conda
    ask_conda="$(PS1="$PS1" "$CONDA_EXE" shell.posix reactivate)" || \return $?
    \eval "$ask_conda"
    __conda_hashr
}

conda() {
    if [ "$#" -lt 1 ]; then
        "$CONDA_EXE"
    else
        \local cmd="$1"
        shift
        case "$cmd" in
            activate|deactivate)
                __conda_activate "$cmd" "$@"
                ;;
            install|update|upgrade|remove|uninstall)
                "$CONDA_EXE" "$cmd" "$@" && __conda_reactivate
                ;;
            *) "$CONDA_EXE" "$cmd" "$@" ;;
        esac
    fi
}

if [ -z "${CONDA_SHLVL+x}" ]; then
    \export CONDA_SHLVL=0
    PATH="$(dirname "$(dirname "$CONDA_EXE")")/condabin:${PATH:-}"
    \export PATH

    # We'\''re not allowing PS1 to be unbound. It must at least be set.
    # However, we'\''re not exporting it, which can cause problems when starting a second shell
    # via a first shell (i.e. starting zsh from bash).
    if [ -z "${PS1+x}" ]; then
        PS1=
    fi
fi


conda activate base'
++ export CONDA_EXE=/Users/Michael/anaconda3/bin/conda
++ CONDA_EXE=/Users/Michael/anaconda3/bin/conda
++ '[' -z x ']'
++ conda activate base
++ '[' 2 -lt 1 ']'
++ local cmd=activate
++ shift
++ case "$cmd" in
++ __conda_activate activate base
++ '[' -n '' ']'
++ local cmd=activate
++ shift
++ local ask_conda
+++ PS1=
+++ /Users/Michael/anaconda3/bin/conda shell.posix activate base
++ ask_conda='\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''1'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
++ eval '\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''1'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
+++ export CONDA_PROMPT_MODIFIER=
+++ CONDA_PROMPT_MODIFIER=
+++ export CONDA_SHLVL=1
+++ CONDA_SHLVL=1
+++ export PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
+++ PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
++ __conda_hashr
++ '[' -n '' ']'
++ '[' -n '' ']'
++ hash -r
+ conda activate /Users/Michael/anaconda3/envs/testpip
+ '[' 2 -lt 1 ']'
+ local cmd=activate
+ shift
+ case "$cmd" in
+ __conda_activate activate /Users/Michael/anaconda3/envs/testpip
+ '[' -n '' ']'
+ local cmd=activate
+ shift
+ local ask_conda
++ PS1=
++ /Users/Michael/anaconda3/bin/conda shell.posix activate /Users/Michael/anaconda3/envs/testpip
+ ask_conda='\export CONDA_DEFAULT_ENV='\''testpip'\''
\export CONDA_PREFIX='\''/Users/Michael/anaconda3/envs/testpip'\''
\export CONDA_PREFIX_1='\''/Users/Michael/anaconda3'\''
\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''2'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/envs/testpip/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
+ eval '\export CONDA_DEFAULT_ENV='\''testpip'\''
\export CONDA_PREFIX='\''/Users/Michael/anaconda3/envs/testpip'\''
\export CONDA_PREFIX_1='\''/Users/Michael/anaconda3'\''
\export CONDA_PROMPT_MODIFIER='\'''\''
\export CONDA_SHLVL='\''2'\''
\export PATH='\''/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/envs/testpip/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin'\'''
++ export CONDA_DEFAULT_ENV=testpip
++ CONDA_DEFAULT_ENV=testpip
++ export CONDA_PREFIX=/Users/Michael/anaconda3/envs/testpip
++ CONDA_PREFIX=/Users/Michael/anaconda3/envs/testpip
++ export CONDA_PREFIX_1=/Users/Michael/anaconda3
++ CONDA_PREFIX_1=/Users/Michael/anaconda3
++ export CONDA_PROMPT_MODIFIER=
++ CONDA_PROMPT_MODIFIER=
++ export CONDA_SHLVL=2
++ CONDA_SHLVL=2
++ export PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/envs/testpip/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
++ PATH=/Users/Michael/.dotfiles/bin:/Users/Michael/anaconda3/envs/testpip/bin:/Applications/CPLEX_Studio128/cplex/bin/x86-64_osx:/Users/Michael/.brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/domino:/Library/TeX/texbin:/opt/X11/bin
+ __conda_hashr
+ '[' -n '' ']'
+ '[' -n '' ']'
+ hash -r
/Users/Michael/anaconda3/envs/testpip/.tmp3af49sb0: line 3: syntax error near unexpected token `('
/Users/Michael/anaconda3/envs/testpip/.tmp3af49sb0: line 3: `pip install -r /[REMOVED FOR PRIVACY]/condaenv.c163kmcx.requirements.txt'
```

```
conda info

     active environment : base
    active env location : /Users/Michael/anaconda3
            shell level : 1
       user config file : /Users/Michael/.condarc
 populated config files : /Users/Michael/.condarc
          conda version : 4.6.7
    conda-build version : 3.17.6
         python version : 3.7.1.final.0
       base environment : /Users/Michael/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/Michael/anaconda3/pkgs
                          /Users/Michael/.conda/pkgs
       envs directories : /Users/Michael/anaconda3/envs
                          /Users/Michael/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.7 requests/2.21.0 CPython/3.7.1 Darwin/18.2.0 OSX/10.14.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False
```

```
conda config --show-sources
==> /Users/Michael/.condarc <==
changeps1: False
ssl_verify: True
channels:
  - defaults
```

I activate conda by sourcing `. $HOME/anaconda3/etc/profile.d/conda.sh` in my .bashrc.

This seems like a bug in anaconda, not related homebrew. Can you help me diagnose it?
Homebrew-installed Anaconda is a package manager managing a package manager.  It seems they don't do any real customization, aside from possibly requiring sudo: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/anaconda.rb - so maybe it's not that bad.  It's still a bad idea in general, and even worse the more conflated and opinionated brew is with its anaconda installation.  Opinions are fine, but when those opinions become adopted by others who don't necessarily even understand that they're straying from default behavior, they give maintainers headaches.  The same can be said for us when we patch software to make it behave slightly differently and cause problems.

Anyway, to troubleshoot this, you'll want to open this file:

/Users/Michael/.brew/anaconda3/lib/python3.7/site-packages/conda/conda_env/pip_util.py

Put a breakpoint in here:

https://github.com/conda/conda/blob/master/conda_env/pip_util.py#L31

```
import pdb; pdb.set_trace()
```

now run your conda env create command.  When it gets to the PDB prompt, print out the location of the temporary file:

```
print(script_caller)
```

Find that file on your hard drive and upload it here.  There's some shell script error here that may also involve your shell rc file.  What shell do you use?  Have you run ``conda init``?  We may need to look at the rc file for your shell to figure out where the syntax error is coming in.
Thanks for the reply. Hopefully you saw my last comment that this is unrelated to homebrew. The same thing happens with a fresh install of Anaconda from the website. The contents of `script_caller` are:

```
eval "$("/Users/Michael/.brew/anaconda3/bin/conda" "shell.posix" "hook")"
conda activate "/Users/Michael/.brew/anaconda3/envs/testpip"
pip install -r /Users/Michael/[PATH TO test.yml]/condaenv.4s068msn.requirements.txt
```
and the contents of `condaenv.4s068msn.requirements.txt` are:
```
dill
```
There are no newlines at the end of either file. As I stated in my previous comment, the way that I get anaconda on the path (and the conda command set up) is by sourcing `conda.sh` with `. $HOME/anaconda3/etc/profile.d/conda.sh` in my `.bashrc` (I use bash, obviously).

I can't find any other issues with conda, everything else seems to be working fine. Thoughts?
Also, my .inputrc is
```
$include /etc/inputrc
"\C-p":history-search-backward
"\C-n":history-search-forward

set colored-stats On
set completion-ignore-case On
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
set visible-stats On
```
in case that helps (given that you said there was some rc stuff happening).
I've solved it. There can't be a space in the path to the environment file. I'm not sure what has changed that is causing the bug, but as long as `test.yml` doesn't have a space in the path to it, everything is fine. If there is a space, I get the error.

I suspect that the `pip install -r path/to/test directory/test.yml` is the problem. It needs to be quoted. I can't figure out where the args for pip get set up, but whenever that happens, the path to the temporary requirements.txt file needs to be quoted (since that is created in the same directory as the .yml file).

Do you see where the fix needs to happen?
I suspect the line that needs to change is [here](https://github.com/conda/conda/blob/43aae7c6957bb771423f6a178d37704bc8739b36/conda_env/installers/pip.py#L41).
Just to follow up, if you change the line [here](https://github.com/conda/conda/blob/43aae7c6957bb771423f6a178d37704bc8739b36/conda_env/installers/pip.py#L41) from:
```
        pip_cmd = ['install', '-r', requirements.name]
```
to
```
        pip_cmd = ['install', '-r', '"{}"'.format(requirements.name)]
```
The problem goes away. The output of the tmp file that is created is now:
```
eval "$("/Users/Michael/.brew/anaconda3/bin/conda" "shell.posix" "hook")"
conda activate "/Users/Michael/.brew/anaconda3/envs/testpip"
pip install -r "/Users/Michael/test directory/condaenv.phc8fpjk.requirements.txt"
```
Which properly quotes the space.

Though, I haven't tested that change thoroughly, so I don't know if it could possibly break something else.
Thanks for your help in isolating the issue. We'll have it fixed in the
next release. If you'd like credit for your work in sorting this out,
please consider submitting a PR with your changes.

On Tue, Feb 26, 2019, 19:19 albertmichaelj <notifications@github.com> wrote:

> Just to follow up, if you change the link here
> <https://github.com/conda/conda/blob/43aae7c6957bb771423f6a178d37704bc8739b36/conda_env/installers/pip.py#L41>
> from:
>
>         pip_cmd = ['install', '-r', requirements.name]
>
> to
>
>         pip_cmd = ['install', '-r', '"{}"'.format(requirements.name)]
>
> The problem goes away. The output of the tmp file that is created is now:
>
> eval "$("/Users/Michael/.brew/anaconda3/bin/conda" "shell.posix" "hook")"
> conda activate "/Users/Michael/.brew/anaconda3/envs/testpip"
> pip install -r "/Users/Michael/test directory/condaenv.phc8fpjk.requirements.txt"
>
> Which properly quotes the space.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/conda/conda/issues/8347#issuecomment-467683852>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AACV-Y_w7Iz81SPvfCWkARCHaAPwrDVQks5vRd0bgaJpZM4bTFg9>
> .
>


Resolving patch:
diff --git a/conda_env/installers/pip.py b/conda_env/installers/pip.py
--- a/conda_env/installers/pip.py
+++ b/conda_env/installers/pip.py
@@ -38,7 +38,7 @@ def _pip_install_via_requirements(prefix, specs, args, *_, **kwargs):
         requirements.write('\n'.join(specs))
         requirements.close()
         # pip command line...
-        pip_cmd = ['install', '-r', requirements.name]
+        pip_cmd = ['install', '-r', '"{}"'.format(requirements.name)]
         pip_subprocess(pip_cmd, prefix, cwd=pip_workdir)
     finally:
         # Win/Appveyor does not like it if we use context manager + delete=True.


Test patch: