title: Run a python script on Azure Batch
body: <p>Iam trying to execute a python script on azure batch which is a linux dsvm so that the script can install python packages and then execute the python script.</p>
  
  <p>Below is the code i used:</p>
  
  <pre><code>try:
     from pip import main as pipmain
  except ImportError:
     from pip._internal import main as pipmain
  
  try:
      import pandas as pd
  except:
  
     pipmain(['install', 'pandas',"])
  
  import pandas
  </code></pre>
  
  <p>When i run the python script on azure Batch command line , the pool task errors out at the last statement(import pandas) eventhough i can see in the stdout log file that the pandas, numpy etc packages are installed.</p>
  
  <p>It seems that the packages are installed at some other location and while trying to import it is trying to import from some other location. It gives the error ImportError: No module named pandas in the stderr.txt file on the azure batch pool tasks.</p>
  
  <p>The reason why iam trying to install python packages and importing it the same script is because the azure batch command line doesnt allow me to write 2 commands , something like</p>
  
  <pre><code>pip install pandas
  python test.py
  </code></pre>
  
  <p>where it first install the packages and then invokes script where it just does the import of pandas library.</p>
  
  <p>I have also used the command in the <code>pip install pandas</code> and <code>pip install --install-option="--prefix=$AZ_BATCH_TASK_WORKING_DIR" pandas</code> at the start task of the batch pool. AZ_BATCH_TASK_WORKING_DIR as per my understanding is working directory to which the task and script has access when the task batch runs</p>
  
  <p>Is there a way i run the python script successfully on Azure Batch. At the momemt iam only running one command: import pandas</p>