Deploying with custom Python environments
When you deploy, Modelbit will detect the pip
packages needed to replicate your Notebook's environment.
To further customize the Python environment, use the python_version
, python_packages
and system_packages
parameters.
Specifying python packages
To deploy to an environment with a specific version of sklearn
:
mb.deploy(my_deploy_function, python_packages=["scikit-learn==1.0.2",])
To deploy to an environment with a specific versions of multiple pip
packages:
mb.deploy(my_deploy_function, python_packages=["scikit-learn==1.0.2", "xgboost==1.5.2"])
To deploy to an environment with a specific version of Python:
mb.deploy(my_deploy_function, python_version="3.9")
Specifying system packages
Sometimes your Python packages rely on system packages like git
or gcc
. To add system packages, use the system_packages
parameter in mb.deploy
. These packages get installed with apt-get install
.
mb.deploy(my_deploy_function, system_packages=["libgomp1"])
You can specify multiple system packages:
mb.deploy(my_deploy_function, system_packages=["build-essential", "cmake"])
Including additional files
Modelbit has different workflows depending on how you want to add additional Python files with your deployments:
- Extra Files for one deployment: If you have one or two
.py
files that only one deployment depends on. - Common files for all deployments: If you have Python files that should be available in all deployments.
- Private packages & wheels: If you have a
setup.py
orpyproject.toml
and usepip install
to make your libraries available for import.