Search code examples
pythonapache-sparkjupyter-notebookibm-cloud

Python script using spark library at Bluemix


I am trying to write python script to call spark library at Bluemix platform. Would you mind advise the flow?

I have created Apache Spark Analytic Service at Bluemix, and open a iPython Notebook. However, I can't install new python package using !pip install <package>

And suppose I have solved this issue, I would like that it works like an application that I can make it continuously at background. Is it possible?


Solution

  • Also, you can do it another way:

    First find home dir: print os.environ["HOME"] Then install module to this directory: !pip install <package> -t 'your home directory'

    Append path to directory:

     import sys, os      
    sys.path.append("".join([os.environ["HOME"]])) 
    

    Finally import module: import <package>