Search code examples
pythonazure-batch

How to install Python packages on Azure Batch Node


I am following the MS Azure Batch tutorial for Python: https://learn.microsoft.com/en-us/azure/batch/batch-python-tutorial

Now, I want to use some non-standard Python packages, such as SciPy or Colorama... whatever.

for example:

import scipy
import colorama
import ...

I cannot find any information on this by MS. Also, how do I make my VM node use python3?


Solution

  • To install any arbitrary software you like on your virtual machine, you can use the StartTask object in the PoolAddParameter object when you call add the pool to your account via add within the pool operations.

    There are also a few alternatives:

    1. Use application packages
    2. Use containers
    3. Bring your own custom image

    Regarding how to use python3 on the VM. That is not an Azure Batch specific issue, you'll need to figure out how to do that within the distribution/operating system specific way. For instance, if using Ubuntu, one possibility would be to ensure you have done the proper apt-get calls to retrieve the libraries and binaries required.