Having issue installing mysql-connector-python package to Jupiter notebook on PySpark3 using Script Action-script failing

Alphonse Okossi 141 Reputation points

Here is my Script Action commands:

!/usr/bin/env bash

sudo /usr/bin/anaconda/bin/conda create --prefix /usr/bin/anaconda/envs/bgdatamysql python=3.5 anaconda --yes
sudo /usr/bin/anaconda/bin/conda install -c anaconda mysql-connector-python -n bgdatamysql --yes
sudo /usr/bin/anaconda/bin/conda install pandas -n bgdatamysql --yes
sudo /usr/bin/anaconda/bin/conda install panasql -n bgdatamysql --yes

Script action failing

Azure HDInsight
Azure HDInsight
An Azure managed cluster service for open-source analytics.
207 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
762 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 85,121 Reputation points Microsoft Employee

    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>




    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


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


    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.