title: Activate Anaconda Python environment from makefile
body: <p>I want to use a makefile to build my project's environment using a makefile and <a href="http://conda.pydata.org/docs/using/envs.html" rel="noreferrer">anaconda/miniconda</a>, so I should be able to clone the repo and simply run <code>make myproject</code></p>
  
  <pre><code>myproject: build
  
  build:
    @printf "\nBuilding Python Environment\n"
    @conda env create --quiet --force --file environment.yml
    @source /home/vagrant/miniconda/bin/activate myproject
  </code></pre>
  
  <p>If I try this, however, I get the following error</p>
  
  <blockquote>
    <p>make: source: Command not found </p>
    
    <p>make: *** [source] Error 127</p>
  </blockquote>
  
  <p>I have searched for a solution, but [this question/answer(<a href="https://stackoverflow.com/questions/7507810/howto-source-a-script-from-makefile">How to source a script in a Makefile?</a>) suggests that I cannot use <code>source</code> from within a makefile. </p>
  
  <p><a href="https://stackoverflow.com/questions/24736146/how-to-use-virtualenv-in-makefile">This answer</a>, however, proposes a solution (and received several upvotes) but this doesn't work for me either</p>
  
  <blockquote>
    <p>( \<br>
        source /home/vagrant/miniconda/bin/activate myproject; \</p>
    
    <p>)</p>
    
    <p>/bin/sh: 2: source: not found </p>
    
    <p>make: *** [source] Error 127</p>
  </blockquote>
  
  <p>I also tried moving the <code>source activate</code> step to a separate bash script, and executing that script from the makefile. That doesn't work, and I assume for the a similar reason, i.e. I am running <code>source</code> from within a shell.</p>
  
  <p>I should add that if I run <code>source activate myproject</code> from the terminal, it works correctly.</p>