Installation

This guide covers how to install PyBA and its dependencies.

From PyPI

The recommended way to install PyBA:

pip install py-browser-automation

or via brew:

brew tap fauvidotechnologies/pyba
brew install pyba

From Source

For development or to get the latest changes:

git clone https://github.com/fauvidoTechnologies/PyBrowserAutomation.git
cd PyBrowserAutomation
pip install -e .

Using Poetry

If you prefer Poetry for dependency management:

git clone https://github.com/fauvidoTechnologies/PyBrowserAutomation.git
cd PyBrowserAutomation
poetry install

Browser Dependencies

PyBA uses Playwright under the hood. After installing PyBA, you need to install browser binaries:

Option 1: Automatic (recommended)

Let PyBA handle it by setting handle_dependencies=True:

from pyba import Engine

engine = Engine(openai_api_key="...", handle_dependencies=True)

Option 2: Manual

Install browsers and system dependencies yourself:

# Install browser binaries
playwright install

# Install system dependencies (Linux only)
playwright install-deps

Option 3: Using the DependencyManager

from pyba.core import DependencyManager

DependencyManager.playwright.handle_dependencies()

LLM Provider Setup

PyBA supports three LLM providers. You need at least one configured.

OpenAI

  1. Get an API key from OpenAI Platform

  2. Pass it directly or set as environment variable:

# Direct
engine = Engine(openai_api_key="sk-...")

# Or via environment
import os
os.environ["OPENAI_API_KEY"] = "sk-..."
engine = Engine(openai_api_key=os.environ["OPENAI_API_KEY"])

Google Gemini

  1. Get an API key from Google AI Studio

  2. Use it in PyBA:

engine = Engine(gemini_api_key="your-gemini-key")

Google VertexAI

  1. Set up a GCP project with VertexAI enabled

  2. Configure authentication (gcloud auth application-default login)

  3. Use it in PyBA:

engine = Engine(
    vertexai_project_id="your-project-id",
    vertexai_server_location="us-central1"
)

Verifying Installation

Run a quick test to verify everything works:

from pyba import Engine

engine = Engine(openai_api_key="your-key", handle_dependencies=True)
result = engine.sync_run(prompt="Go to example.com and tell me the page title")
print(result)

If you see output about the page title, you’re all set!

Platform Support

PyBA is tested on:

  • Linux: Ubuntu 20.04+, Debian 10+

  • macOS: 11 (Big Sur) and later

  • Windows: Windows 10/11

Note

On Linux servers without a display, use headless=True (this is the default).