title: How to set the environment when using `conda build`?
body: <p>Trying to take advantage of Conda's build function to install a package not in conda repositories. I've downloaded the source files for the package I want. At the same level I created a folder for my <em>conda recipes</em> which contains the <code>meta.yaml</code> setting <code>source: path: ../&lt;package-name&gt;</code>. So, <em>look up one directory to find the source files</em>. This works.</p>
  
  <p>The problem happens at the end when build attempts to test importing the package. It says <em>x module not found</em>, but I'm invoking <code>conda build</code> from a conda environment where the missing package is installed as shown by <code>conda list</code>. </p>
  
  <p>How do I know from what environment <code>conda build</code> is performing these tests?</p>
  
  <p>How to set the environment when using <code>conda build</code>?</p>
  
  <p>Doesn't help that <a href="https://conda.io/projects/conda-build/en/latest/index.html" rel="nofollow noreferrer">Conda Build</a> docs are full of the word <em>environment</em>, but which mostly refers to <a href="https://docs.conda.io/projects/conda-build/en/latest/user-guide/environment-variables.html" rel="nofollow noreferrer">environmental variables</a> and not <a href="https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/environments.html" rel="nofollow noreferrer">conda environments</a></p>
  
  <pre><code>(base) C:\Users\myhome\PyTools\bin&gt;conda info
  
       active environment : base
      active env location : C:\Users\myhome\Miniconda3_64-4.5.4
              shell level : 1
         user config file : C:\Users\myhome\.condarc
   populated config files : C:\Users\myhome\.condarc
            conda version : 4.5.4
      conda-build version : 3.18.9
           python version : 3.6.5.final.0
         base environment : C:\Users\myhome\Miniconda3_64-4.5.4  (writable)
             channel URLs : https://conda.anaconda.org/anaconda/win-64
                            https://conda.anaconda.org/anaconda/noarch
                            https://repo.anaconda.com/pkgs/main/win-64
                            https://repo.anaconda.com/pkgs/main/noarch
                            https://repo.anaconda.com/pkgs/free/win-64
                            https://repo.anaconda.com/pkgs/free/noarch
                            https://repo.anaconda.com/pkgs/r/win-64
                            https://repo.anaconda.com/pkgs/r/noarch
                            https://repo.anaconda.com/pkgs/pro/win-64
                            https://repo.anaconda.com/pkgs/pro/noarch
                            https://repo.anaconda.com/pkgs/msys2/win-64
                            https://repo.anaconda.com/pkgs/msys2/noarch
                            https://conda.anaconda.org/conda-forge/win-64
                            https://conda.anaconda.org/conda-forge/noarch
            package cache : C:\Users\myhome\Miniconda3_64-4.5.4\pkgs
                            C:\Users\myhome\AppData\Local\conda\conda\pkgs
         envs directories : C:\Users\myhome\Miniconda3_64-4.5.4\envs
                            C:\Users\myhome\AppData\Local\conda\conda\envs
                            C:\Users\myhome\.conda\envs
                 platform : win-64
               user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Windows/10 Windows/10.0.17763
            administrator : False
               netrc file : None
             offline mode : False
  
  (myenv) C:\Users\myhome\PyTools\bin&gt;conda build &lt;module to install&gt;
  ...
  set PREFIX=C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\_test_env
  set SRC_DIR=C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\test_tmp
  
  (myenv) %SRC_DIR%&gt;call "%SRC_DIR%\conda_test_env_vars.bat"
  
  (myenv) %SRC_DIR%&gt;call "C:\Users\myhome\Miniconda3_64-4.5.4\Scripts\activate.bat" "%PREFIX%"
  
  (%PREFIX%) %SRC_DIR%&gt;IF 0 NEQ 0 exit 1
  
  (%PREFIX%) %SRC_DIR%&gt;IF 0 NEQ 0 exit 1
  
  (%PREFIX%) %SRC_DIR%&gt;"%PREFIX%\python.exe" -s "%SRC_DIR%\run_test.py"
  Traceback (most recent call last):
  import: 'swaggerpy'
    File "C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\test_tmp\run_test.py", line 2, in &lt;module&gt;
      import swaggerpy
    File "C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\_test_env\lib\site-packages\swaggerpy\__init__.py", line 13, in &lt;module&gt;
      from .swagger_model import load_file, load_json, load_url, Loader
    File "C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\_test_env\lib\site-packages\swaggerpy\swagger_model.py", line 15, in &lt;module&gt;
      from swaggerpy.http_client import SynchronousHttpClient
    File "C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\swaggerpy_1568484873987\_test_env\lib\site-packages\swaggerpy\http_client.py", line 11, in &lt;module&gt;
      import requests
  ModuleNotFoundError: No module named 'requests'
  
  (%PREFIX%) %SRC_DIR%&gt;IF 1 NEQ 0 exit 1
  Tests failed for swaggerpy-0.2.1-py36_0.tar.bz2 - moving package to C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\broken
  WARNING:conda_build.build:Tests failed for swaggerpy-0.2.1-py36_0.tar.bz2 - moving package to C:\Users\myhome\Miniconda3_64-4.5.4\conda-bld\broken
  TESTS FAILED: swaggerpy-0.2.1-py36_0.tar.bz2
  
  (myenv) C:\Users\myhome\PyTools\bin&gt;conda list
  # packages in environment at C:\Users\myhome\Miniconda3_64-4.5.4\envs\myenv:
  #
  # Name                    Version                   Build  Channel
  ...
  requests                  2.22.0                   py36_0    anaconda
  ...
  </code></pre>