Looking for HDInsight Script Action sample scripts for installing python package in PySpark 3

Alphonse Okossi 141 Reputation points
2021-03-09T19:07:45.02+00:00

Looking for HDInsight Script Action sample scripts for installing python package in PySpark 3

Azure HDInsight
Azure HDInsight
An Azure managed cluster service for open-source analytics.
210 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 89,466 Reputation points Microsoft Employee
    2021-03-10T07:18:49.52+00:00

    Hello @Alphonse Okossi ,

    Steps to install external Python packages using script action in Azure HDInsight:

    ****Step1:** Create a shell script.**

    • Line2 - Creating Python virtual environment using condo
    • Line3 - Seaborn is the package name that you would like to install. #!/usr/bin/env bash
      sudo /usr/bin/anaconda/bin/conda create --prefix /usr/bin/anaconda/envs/py35new python=3.5 anaconda --yes
      sudo /usr/bin/anaconda/envs/py35new/bin/pip install seaborn
      ****Step2:** Upload your script Action**

    Upload your Script Action to a Storage Account that your chosen HDInsights have access to.

    Bash script URI https://<my-storage-account>.blob.core.windows.net/<Storage-Container>/script-actions/<SctiptName>

    Example:

    https://cheprahdistorage.blob.core.windows.net/chepra-2021-03-10t05-18-30-771z/script-actions/seaborn-package.sh  
    

    76129-image.png

    Step3: Create a script action from Azure Portal.

    • Select the cluster that you want to run the Script action in Azure portal
    • On the blade under Configuration, you can find Script Actions
    • Select that and then click Submit New
    • Select custom
    • Give a name
    • Select nodes to install

    76096-image.png

    A few minutes Later, we have successfully installed external Python packages using script actions in Azure HDInsight.

    76201-image.png

    Hope this helps. Do let us know if you any further queries.


    Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.