Skip to main content

Official Python package for working with the Roboflow API

Project description

Roboflow Python Package

Roboflow provides everything you need to build and deploy computer vision models. roboflow-python is the official Roboflow Python package. roboflow-python enables you to interact with models, datasets, and projects hosted on Roboflow.

With this Python package, you can:

  1. Create and manage projects;
  2. Upload images, annotations, and datasets to manage in Roboflow;
  3. Start training vision models on Roboflow;
  4. Run inference on models hosted on Roboflow, or Roboflow models self-hosted via Roboflow Inference, and more.

The Python package is documented on the official Roboflow documentation site. If you are developing a feature for this Python package, or need a full Python library reference, refer to the package developer documentation.

💻 Installation

You will need to have Python 3.8 or higher set up to use the Roboflow Python package.

Run the following command to install the Roboflow Python package:

pip install roboflow
Install from source

You can also install the Roboflow Python package from source using the following commands:

git clone
cd roboflow-python
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt
Command line tool

By installing roboflow python package you can use some of its functionality in the command line (without having to write python code). See

🚀 Getting Started

To use the Roboflow Python package, you first need to authenticate with your Roboflow account. You can do this by running the following command:

import roboflow
Authenticate with an API key

You can also authenticate with an API key by using the following code:

import roboflow

rf = roboflow.Roboflow(api_key="")

Learn how to retrieve your Roboflow API key.


Below are some common methods used with the Roboflow Python package, presented concisely for reference. For a full library reference, refer to the Roboflow API reference documentation.

import roboflow


rf = roboflow.Roboflow()

# create a project
    project_name="project name",
    license="project-license" # "private" for private projects

workspace = rf.workspace("WORKSPACE_URL")
project = workspace.project("PROJECT_URL")
version = project.version("VERSION_NUMBER")

# upload a dataset
    dataset_format="yolov8", # supports yolov8, yolov5, and Pascal VOC

# upload model weights
version.deploy(model_type="yolov8", model_path=f{HOME}/runs/detect/train/)

# run inference
model = version.model

img_url = ""

predictions = model.predict(img_url, hosted=True).json()


Library Structure

The Roboflow Python library is structured using the same Workspace, Project, and Version ontology that you will see in the Roboflow application.

import roboflow


rf = roboflow.Roboflow()

workspace = rf.workspace("WORKSPACE_URL")
project = workspace.project("PROJECT_URL")
version = project.version("VERSION_NUMBER")

The workspace, project, and version parameters are the same that you will find in the URL addresses at and

Within the workspace object you can perform actions like making a new project, listing your projects, or performing active learning where you are using predictions from one project's model to upload images to a new project.

Within the project object, you can retrieve metadata about the project, list versions, generate a new dataset version with preprocessing and augmentation settings, train a model in your project, and upload images and annotations to your project.

Within the version object, you can download the dataset version in any model format, train the version on Roboflow, and deploy your own external model to Roboflow.

🏆 Contributing

We would love your input on how we can improve the Roboflow Python package! Please see our contributing guide to get started. Thank you 🙏 to all our contributors!

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roboflow-1.1.27.tar.gz (62.5 kB view hashes)

Uploaded Source

Built Distribution

roboflow-1.1.27-py3-none-any.whl (74.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page