Reputation: 43
I am trying to import graphframes in to my databricks notebook
from graphframes import *
but failed with following error message
ImportError: No module named 'graphframes'
How can I add/import in to databricks notebook, any help appreciated.
Upvotes: 3
Views: 3136
Reputation: 12768
Note: By default, "graphframes" is not installed on the databricks.
You need to install the package explicitly.
You can install the packages in different methods.
Method1: Installing external packages using pip cmdlet.
Syntax: %sh /databricks/python3/bin/pip install <packagename>
%sh
/databricks/python3/bin/pip install graphframes
Method2: Using Databricks library utilities
Syntax:
dbutils.library.installPyPI("pypipackage", version="version", repo="repo", extras="extras")
dbutils.library.restartPython() # Removes Python state, but some libraries might not work without calling this function
To install graphframes using databricks library utilities use the below command.
dbutils.library.installPyPI("graphframes")
Tried the examples available in this article GraphFrames Documentation.
Notebook output:
Hope this helps.
Upvotes: 2
Reputation: 457
You need to install the graphframes module by opening your terminal and typing pip install graphframes
Upvotes: 0
Reputation: 28
graphframes
is not default dependency with python. You should install this dependency.
Upvotes: 0