How do I install a python library on an environment?


#1

I would like to install the python library treeinterpreter v0.2 on a c3 environment and associated data science server. Can I do this?


#2
  1. You need to define a runtime in the c3 repository:
    Under your package folder, in package.json:

{
“name”: “myPackage”,
“description”: “My Package”,
“author”: “John Doe”,
“dependencies”: [“otherPackage”],
“runtimes”: {
“py-myPackage”: {
“language”: “Python”,
“runtime”: “CPython”,
“modules”: {
other libraries…
“pip.treeinterpreter”: “==0.2”
},
“repositories”: [
https://artifacts.c3-e.com/v1/anaconda
]
}
}
}

  1. You need to provision myPackage to your environment using c3-prov.
  2. In your data science server, open a notebook and connect to the same environment using a pyc3 connection.

c3 = typesys.C3ServerConnection(‘myURL’, ‘myPackage’, ‘prod’)
c3.importAll()

  1. Run this in your notebook: c3.refresh_environments()
  2. After the call is done, refresh the page and go in the Kernel menu and click Change Kernel. You should see your newly defined runtime with treeinterpreter package available.