Skip to main content

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

For desktop features, use:

pip install "roboflow[desktop]"
Install from source

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

git clone https://github.com/roboflow-ai/roboflow-python.git
cd roboflow-python
python3 -m venv env
source env/bin/activate
pip install .
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 CLI-COMMANDS.md

🚀 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
roboflow.login()
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.

Quickstart

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

roboflow.login()

rf = roboflow.Roboflow()

# create a project
rf.create_project(
    project_name="project name",
    project_type="project-type",
    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
workspace.upload_dataset(
    dataset_path="./dataset/",
    num_workers=10,
    dataset_format="yolov8", # supports yolov8, yolov5, and Pascal VOC
    project_license="MIT",
    project_type="object-detection"
)

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

# run inference
model = version.model

img_url = "https://media.roboflow.com/quickstart/aerial_drone.jpeg"

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

print(predictions)

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

roboflow.login()

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 as those you will find in the URL addresses at app.roboflow.com and universe.roboflow.com.

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!


Metadata

Release files for roboflow 1.1.40

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for roboflow 1.1.40
File Size Uploaded Provenance Actions
roboflow-1.1.40.tar.gz 67.7 kB Without provenance Details for roboflow-1.1.40.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for roboflow 1.1.40
File Interpreter ABI Platform Actions
roboflow-1.1.40-py3-none-any.whl Python 3 none any Details for roboflow-1.1.40-py3-none-any.whl

Total release size: 146.9 kB

Release files / roboflow-1.1.40.tar.gz

Download URL roboflow-1.1.40.tar.gz
Size 67.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b84bfdc2c8f17df100232850b47ba14f02e9264d036febf85484cb568185800
BLAKE2b-256 checksum
How to use checksums
abd7638ccbf2c1735cc5891299884e939c30ecc3bf48bbb717b5eddc7b88c183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release files / roboflow-1.1.40-py3-none-any.whl

Download URL roboflow-1.1.40-py3-none-any.whl
Size 79.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
249ab6b7983ac84bec0b0c8495a2d5aa33a1d5bacba3e8b128752cc6aa6b54f3
BLAKE2b-256 checksum
How to use checksums
728de3f16db0a3139f7b2a0e8e3de56b8624a525c6764c7ecf804156a3719364
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Security for roboflow 1.1.40

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.40 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page