Search code examples
pythongithubjupyter-notebookdygraphs

How to use Github Package in Jupyter Notebooks


I am trying to use the dygraphs plot function from [here] (https://github.com/dinkelk/PyDyGraphs) in my jupyter notebook. The documentation says to:

Installation

Simply clone this repository and include the dygraphs.graph module in >>your Jupyter Notebooks. Note: PyDyGraphs only supports Python 3.

The documentation says to use "import dygraphs.graph as dy"

I'm not sure where to put the repository once I've downloaded it.

The package I've downloaded and unzipped. I've included the "import dygraphs.graph" in my notebook.

This package requires pandas to be installed and imported which I have done.

import numpy as np
import dygraphs.graph as dy

_____
ModuleNotFoundError                       Traceback (most recent  
call last)
<ipython-input-3-29a3c1e17595> in <module>
      4 import pandas as pd
      5 import time
 ----> 6 import dygraphs.graph as dy

ModuleNotFoundError: No module named 'dygraphs'
_____

I'm wondering where I should have put the files downloaded from github and if there is anything else I should be doing in order to use this package.


Solution

  • You need to add a system path (or install the package to the default python libary) before using "import dygraphs.graph". See the example .

    Add something like this in your jupyter notebook:

           sys.path.append("../")
    

    Then change "../" to the relative path to "dygraphs" folder you downloaded.