# How to Opt Out of Anonymous Usage Tracking in TabPFN Using TABPFN_DISABLE_TELEMOMETRY

> Disable anonymous usage tracking in TabPFN by setting the TABPFN_DISABLE_TELEMETRY environment variable to 1. Learn how to control your data privacy.

- Repository: [Prior Labs/TabPFN](https://github.com/PriorLabs/TabPFN)
- Tags: how-to-guide
- Published: 2026-05-06

---

**Set the environment variable `TABPFN_DISABLE_TELEMETRY=1` before importing any TabPFN module to completely disable anonymous usage telemetry collection.**

TabPFN automatically transmits anonymized usage data when models are loaded to help prioritize development efforts. If you require privacy compliance or operate in restricted network environments, the PriorLabs/TabPFN repository provides the `TABPFN_DISABLE_TELEMETRY` environment variable to silently opt out without impacting model functionality.

## How Telemetry Works in TabPFN

The telemetry system activates through the **`initialize_telemetry()`** function defined in [`src/tabpfn/base.py`](https://github.com/PriorLabs/TabPFN/blob/main/src/tabpfn/base.py) (lines 440-447). When executed, this function calls `ping()` and `capture_session()` from the shared `tabpfn_common_utils.telemetry` package. These helpers transmit anonymized session data to remote endpoints unless the opt-out variable is detected.

Because the environment check occurs at **import time**, the variable must be present in `os.environ` before any TabPFN code executes. Once modules load, the telemetry state is fixed for the session duration.

## Disabling Telemetry with TABPFN_DISABLE_TELEMETRY

The opt-out mechanism reads the `TABPFN_DISABLE_TELEMETRY` environment variable. When set to `"1"`, the telemetry functions become no-ops, preventing any network transmission to analytics endpoints.

### Set the Variable Before Import

You must define the environment variable **before** importing TabPFN. Setting it after `import tabpfn` has no effect.

In a Unix shell:

```bash
export TABPFN_DISABLE_TELEMETRY=1
python your_script.py

```

In Windows Command Prompt:

```cmd
set TABPFN_DISABLE_TELEMETRY=1
python your_script.py

```

In Python code (must execute first):

```python
import os
os.environ["TABPFN_DISABLE_TELEMETRY"] = "1"

# Safe to import after setting the variable

from tabpfn import TabPFNClassifier, TabPFNRegressor

```

### Verification Methods

While no public API exposes telemetry status, the test suite demonstrates expected behavior. The file [`tests/conftest.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/conftest.py) (lines 20-24) globally disables telemetry for all test runs by setting this variable, and [`tests/test_telemetry_disabled.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/test_telemetry_disabled.py) (lines 1-13) asserts that the environment variable is present during execution. You can verify functionality by monitoring network activity—no outbound calls should occur during `TabPFNClassifier()` initialization when the variable is set.

## Practical Code Examples

### Disabling Telemetry in a Python Script

```python
import os

# Opt-out must precede any TabPFN imports

os.environ["TABPFN_DISABLE_TELEMETRY"] = "1"

from tabpfn import TabPFNClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split

# Initialize without telemetry transmission

clf = TabPFNClassifier()
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

```

### Disabling Telemetry in Jupyter Notebooks

```python
import os
os.environ["TABPFN_DISABLE_TELEMETRY"] = "1"  # Must be first cell

```

```python

# Subsequent cells import TabPFN

from tabpfn import TabPFNRegressor

reg = TabPFNRegressor()

```

### Using a .env Configuration File

For projects using `python-dotenv`, create a `.env` file in your project root:

```bash
TABPFN_DISABLE_TELEMETRY=1

```

Then load it before importing TabPFN:

```python
from dotenv import load_dotenv
load_dotenv()  # Populates os.environ from .env

from tabpfn import TabPFNClassifier
clf = TabPFNClassifier()

```

## Source Code Implementation

The telemetry logic spans three critical files in the PriorLabs/TabPFN repository:

- **[`src/tabpfn/base.py`](https://github.com/PriorLabs/TabPFN/blob/main/src/tabpfn/base.py)** (lines 440-447): Implements `initialize_telemetry()`, which checks `TABPFN_DISABLE_TELEMETRY` before calling remote telemetry functions.
- **[`tests/conftest.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/conftest.py)** (lines 20-24): Demonstrates the standard test-suite approach for globally disabling telemetry via pytest configuration.
- **[`tests/test_telemetry_disabled.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/test_telemetry_disabled.py)** (lines 1-13): Contains assertions verifying the environment variable is correctly detected and respected.

## Summary

- **`TABPFN_DISABLE_TELEMETRY=1`** must be set before any `import tabpfn` statements to successfully opt out.
- The **`initialize_telemetry()`** function in [`src/tabpfn/base.py`](https://github.com/PriorLabs/TabPFN/blob/main/src/tabpfn/base.py) performs the environment check at module load time.
- When disabled, **`ping()`** and **`capture_session()`** from `tabpfn_common_utils.telemetry` become no-ops, ensuring no usage data leaves your system.
- The test suite uses this mechanism in [`tests/conftest.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/conftest.py) to guarantee no telemetry during automated testing.

## Frequently Asked Questions

### What happens if I set TABPFN_DISABLE_TELEMETRY after importing TabPFN?

Setting the variable after import has no effect. The `initialize_telemetry()` function checks the environment during module initialization in [`src/tabpfn/base.py`](https://github.com/PriorLabs/TabPFN/blob/main/src/tabpfn/base.py). Once classes like `TabPFNClassifier` are imported, telemetry is already configured. You must restart your Python session and set the variable before any import statements.

### Does disabling telemetry affect TabPFN model performance?

No. The `TABPFN_DISABLE_TELEMETRY` variable only controls the **`ping()`** and **`capture_session()`** calls in the telemetry utility package. These functions transmit usage metadata and do not interact with model training, inference logic, or hyperparameters. Your models will produce identical predictions with or without telemetry enabled.

### Can I verify that telemetry is actually disabled?

While there is no public API flag to query status, you can confirm the opt-out is working by ensuring the variable equals `"1"` before import, as demonstrated in [`tests/test_telemetry_disabled.py`](https://github.com/PriorLabs/TabPFN/blob/main/tests/test_telemetry_disabled.py). In restricted network environments, you can also verify that no outbound HTTPS connections are attempted during `TabPFNClassifier()` or `TabPFNRegressor()` initialization.

### Is TABPFN_DISABLE_TELEMETRY required for air-gapped environments?

While not strictly mandatory, setting `TABPFN_DISABLE_TELEMETRY=1` is strongly recommended for air-gapped or high-security deployments. Without this variable, TabPFN attempts to reach remote telemetry endpoints during model loading, which may cause connection timeouts or errors if external network access is blocked.