NationalSecurityAgency/ghidra · error · Exception
Cannot find Python source for {name}. Try gradle assemblePyP
Error message
Cannot find Python source for {name}. Try gradle assemblePyPackage? What it means
Raised by ghidra_module_pypath() in gmodutils.py when neither '<MODULE_HOME>/pypkg/src' (installed layout) nor '<MODULE_HOME>/build/pypkg/src' (dev/build layout) exists as a directory. This helper locates the Python source package for a Ghidra module so launchers can set PYTHONPATH; failure means the module's Python package was never built or installed.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/data/support/gmodutils.py:43
that minimal logic is required to get it loaded.
This file CANNOT be assumed to be available on a remote target. For
that, consider ghidratrace.setuputils.
"""
import os
from typing import Optional
def ghidra_module_pypath(name: Optional[str]=None) -> str:
mod_home_name = 'MODULE_HOME' if name is None else f'MODULE_{name.replace("-","_")}_HOME'
mod_home = os.getenv(mod_home_name)
installed = f'{mod_home}/pypkg/src'
if os.path.isdir(installed):
return installed
dev = f'{mod_home}/build/pypkg/src'
if os.path.isdir(dev):
return dev
raise Exception(
f"Cannot find Python source for {name}. Try gradle assemblePyPackage?")
View on GitHub (pinned to d5f144c24d)
Solutions
- Run the Gradle task: './gradlew assemblePyPackage' (or ':Debugger-jpda:assemblePyPackage') to generate the pypkg/src directory.
- Verify the MODULE_HOME (or MODULE_<NAME>_HOME) environment variable points at the correct module root containing the built pypkg.
- If using a distributed Ghidra install, re-install or re-extract so the pypkg/src subtree is present under the module directory.
Example fix
# before — pypkg not built yet # (env) MODULE_HOME=/path/to/module without pypkg/src # after # shell ./gradlew :Debugger-jpda:assemblePyPackage # then re-run the launcher with MODULE_HOME set to the module root
Defensive patterns
Strategy: validation
Validate before calling
import os
mod_home = os.getenv('MODULE_HOME') or os.getenv(f'MODULE_{name.replace("-","_")}_HOME')
if not (mod_home and os.path.isdir(f'{mod_home}/pypkg/src') or os.path.isdir(f'{mod_home}/build/pypkg/src')):
raise SystemExit('Run: ./gradlew assemblePyPackage before launching') Try / catch
try:
from gmodutils import ghidra_module_pypath
pypath = ghidra_module_pypath(name)
except Exception as e:
print('Python package missing — run gradle assemblePyPackage')
raise Prevention
- Always run 'gradle assemblePyPackage' as part of your build before launching.
- Set MODULE_HOME / MODULE_<NAME>_HOME to the correct module root in launch scripts.
- Verify the pypkg/src subtree exists in distributed installs.
When it happens
Trigger: A Windows launch script imports gmodutils and calls ghidra_module_pypath('Debugger-jpda') (or similar) before the module's pypkg has been assembled. The MODULE_<NAME>_HOME environment variable points at a directory tree lacking both the installed and build pypkg/src subpaths.
Common situations: Running a launcher directly from a source checkout without first executing 'gradle assemblePyPackage'; an incomplete or partially-built installation; the MODULE_HOME/MODULE_<NAME>_HOME env var pointing at the wrong root; a fresh clone that was only built with 'gradle build' but not the py-package target.
Related errors
- %s: error: too many @-files encountered
- Address {address} is not in process {proc}
- Invalid byte_order: {}
- Cannot convert {}'s value: '{}', type: '{}'
- No memory mapper
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/f9479517f4241a3e.
Report an issue: GitHub.