Watson Studio, Watson ML, Watson OpenScale

 View Only
Expand all | Collapse all

How to I "import dash" into my Jupyter notebook

  • 1.  How to I "import dash" into my Jupyter notebook

    Posted Fri February 12, 2021 09:33 AM
    How to I "import dash" into my Jupyter notebook to run data visualizations using Python 3.7 and the related version of Spark. My apologies in advance for this naive question. I am a novice user and am just getting started with Jupyter notebooks in Watson studio. If I merely use the command line "import dash" I get an error message saying something to the effect of "module dash not found". The "import dash" seems to work fine for me in other Jupyter environments. Thanks in advance for any detailed set of instructions you may be able to give.

    Girish Punj


  • 2.  RE: How to I "import dash" into my Jupyter notebook

    User Group Leader
    Posted Mon February 15, 2021 10:37 AM


      In Python environments, you often need to install a package before you can import it.  It makes the package available in the environment.  Since you are operating in the context of some virtual machine when working in Watson Studio, you need to first "import" the package  into your notebook environment, and then you can import the package in question.  In your notebook, do this:

    # First install the package into the notebook
    !pip install dash
    # Then import it in
    import dash

    In an environment on your local machine, you would just do the "pip install" without the leading exclamation (!), but since we are working ion the context of a Python notebook, we need to have the exclamation (!) to let the notebook know that we are executing a system level command.


    Daniel Toczala
    Community Leader and Customer Success Manager - Watson