Codex PDF "No module named reportlab"? Use the Bundled Runtime

Codex PDF "No module named reportlab"? Use the Bundled Runtime

Aident AI

An amber switch directs a cyan path through an indigo dependency arch to a stack of PDF pages while a coral path stops short.

Codex PDF "No module named reportlab"? Use the Bundled Runtime

If a Codex PDF task fails on macOS with ModuleNotFoundError: No module named 'reportlab', do not assume Codex has no PDF support. First check which Python executable ran. A fresh upstream report shows that bare python3 can resolve to the user's PATH interpreter even while Codex's separate bundled runtime already contains reportlab, pdfplumber, and pypdf.

The safest temporary fix is to make Codex load its workspace dependency paths and run every PDF command with the returned Python executable. Do not guess an internal app path or globally rewrite PATH.

Confirm an Interpreter Mismatch

Run these read-only checks in the same Codex task that failed:

command -v python3
python3 -c 'import sys; print(sys.executable); print(sys.version)'
python3 -c 'import reportlab'

The first two commands identify the interpreter selected by the shell. The third reproduces the missing import without installing or changing anything.

This is an interpreter-specific result. It means the selected Python environment cannot import reportlab; it does not prove that every Python runtime available to Codex is missing the package. Python exposes the active interpreter path through sys.executable, which is the value to compare after Codex loads its bundled dependencies.

If the failure is instead that the dependency-loading command itself hangs, use the separate Codex workspace dependency diagnostic before changing packages.

Tell Codex to Use the Returned Python Path

Give Codex a bounded retry instruction:

Retry this PDF task with Codex's bundled workspace dependencies. First load the workspace dependency paths. Use the returned Python executable explicitly for every PDF command. Verify that reportlab, pdfplumber, and pypdf import successfully before generating the PDF. Do not guess an internal path, change my global PATH, or install packages unless the bundled dependency loader is unavailable.

After the dependency loader returns a path, keep that exact executable in a task-scoped variable:

BUNDLED_PYTHON="/absolute/path/returned/by/the/dependency/loader"
"$BUNDLED_PYTHON" -c 'import sys, reportlab, pdfplumber, pypdf; print(sys.executable); print("PDF runtime ready")'

Expected output includes the bundled interpreter path and PDF runtime ready. The path above is only an example because app and plugin installations can move. Re-resolve it for the current task instead of copying a path from another machine, app version, or session.

Then invoke the PDF generator with the same executable:

"$BUNDLED_PYTHON" scripts/render_report.py

Replace scripts/render_report.py with the reviewed generator in your workspace. Do not switch back to bare python3 for a later render or verification step, because that reintroduces the same ambiguity.

Why Changing Global PATH Is the Wrong Fix

Your shell Python may belong to Homebrew, pyenv, uv, Conda, a project virtual environment, or the macOS toolchain. Putting Codex's private runtime first in global PATH can silently change unrelated project commands and may break when the app updates.

Keep the two environments separate:

  • use Codex's returned runtime path for the bundled PDF workflow;

  • use the project's declared environment for repository code;

  • use an explicit executable whenever the boundary matters; and

  • resolve the path again after a Codex or plugin update.

This is the same reason an agent skill should declare and inspect its dependencies instead of assuming the user's shell owns them. If you install a third-party PDF skill or workflow, apply the agent skill audit checklist before letting it run package installers or file converters.

Use an Isolated Fallback Only When the Bundled Runtime Is Unavailable

If Codex cannot expose its bundled Python path and the PDF is urgent, create a project-local virtual environment only after confirming that external package installation is allowed:

python3 -m venv .venv-pdf
./.venv-pdf/bin/python -m pip install reportlab pdfplumber pypdf
./.venv-pdf/bin/python -c 'import reportlab, pdfplumber, pypdf; print("PDF environment ready")'

For repeatable work, pin reviewed versions in the repository's dependency file and use that source of truth. Do not use sudo pip, install into the system Python, or add an app-private runtime to a project lockfile.

This fallback changes the workspace and downloads packages, so it is not the first diagnostic step. Preserve the original error and interpreter path before installing anything; they are the useful evidence for the upstream report.

Verify the PDF, Not Just the Import

A successful import only proves that the libraries are available. Verify the generated artifact too:

  1. Confirm the command exits successfully and writes the expected file.

  2. Check that the file begins with a valid PDF signature.

  3. Open it with pypdf using the same interpreter and confirm the expected page count.

  4. Render every page to images and inspect them for clipped text, missing fonts, blank charts, overlaps, and broken links.

  5. Re-run the generator once from a fresh Codex task to confirm that dependency resolution is repeatable.

For a three-page report, a compact structural check is:

"$BUNDLED_PYTHON" -c 'from pypdf import PdfReader; reader = PdfReader("output.pdf"); assert len(reader.pages) == 3; print("3 pages verified")'

Change the asserted count to the reviewed expectation. Do not treat a file that merely opens as proof that its visual content is correct.

Avoid These False Fixes

  • Do not repeatedly install reportlab into whichever python3 happens to run.

  • Do not copy a private runtime path from an issue report or another Mac.

  • Do not globally prepend an app bundle to PATH.

  • Do not delete project virtual environments before identifying the selected interpreter.

  • Do not declare the issue resolved after imports pass; verify the rendered PDF.

The upstream issue was opened on August 6, 2026 against Codex CLI 0.146.1 on macOS. It reports PATH Python 3.14.5 failing the import while Codex's bundled Python 3.12.13 imports all three PDF libraries. That evidence supports the runtime-mismatch diagnosis for that configuration, not a claim that every PDF failure has the same cause.

Monitor the Upstream Fix With Aident Loadout

Aident Loadout can check the connected GitHub issue surface without placing a provider token in your prompt. Give Codex the canonical setup instruction:

Follow https://aident.ai/SETUP.md

Then use this bounded prompt:

Check my Aident Loadout account and Vault status. Find a connected read-only GitHub issue Action, inspect its current schema, and preflight it. Return the state, updated time, maintainer-authored comments, linked fixes, and release references for openai/codex issue 37333. Do not create or edit issues, post comments, change labels, change files, or ask me for a provider key.

Success is measurable: the result contains one current issue record, performs zero GitHub writes, and exposes no credential. Ready to track the fix safely? Set up Aident Loadout and run the read-only check.

Sources

Refresh this guide when issue 37333 changes state, Codex exposes a stable documented runtime command, a release fixes interpreter selection, or the fresh-task verification no longer reproduces the mismatch.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

The one tool

for every tool

your agent needs.

Give any AI agent real capabilities in seconds. Connect 1,000+ tools once, skip the setup headache, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.