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

Alphonse Okossi 141 Reputation points
2021-03-08T16:47:56.203+00:00

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.
230 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
986 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,641 Reputation points Moderator
    2021-03-10T07:19:17.033+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.