• Concept
  • Version ยท 6.0
  • Deliver

Troubleshoot ModuleNotFoundError for custom policy checks

Last updated: September 29, 2026

You may receive this error if --script-python-executable-path is set to the Python executable in your custom virtual environment but you haven't correctly installed your modules:

Error while executing script 'python_scripts/test_python_check.py': ModuleNotFoundError: No module named 'liquibase_checks_python' line: 2

You upgraded to Liquibase Secure 6.0 with an existing custom virtual environment

As of 6.0 the embedded runtime is Python 3.12; a virtual environment created for an earlier version fails with this error.

Fix: recreate the environment.

Your modules aren't installed correctly

Fix: activate your virtual environment. Then import the liquibase-checks-python package and any other Python modules you want to use: pip install liquibase-checks-python simplejson sqlparse urllib3

Restart your IDE to see any changes.

Your check script imports a module that is not on the Python import path

Check scripts run in an embedded Python environment that replaces the host filesystem, so a shared helper module is not importable just because it exists on disk. The error names the missing module and the line that imported it.

Fix: Put the helper module in the same directory as the check script, which Liquibase adds to the import path automatically. If the module lives elsewhere, name its directory with --checks-scripts-python-path, separating multiple directories with the path separator for your operating system: liquibase checks run --checks-scripts-python-path=/opt/shared/utils:/opt/shared/db

Liquibase matches its own embedded modules first, so a shared module named the same as one of them is never imported. Rename the shared module if that happens. This parameter is available in Liquibase Secure 5.2.0 and later.

Your IDE isn't configured to recognize your virtual environment

Your IDE may not display correct syntax highlighting for your Liquibase module imports if you haven't configured your virtual environment correctly, or haven't configured your IDE to recognize your virtual environment.

Fix: configure your IDE to recognize Python-language files and to use the Python executable in your custom virtual environment, then activate your virtual environment.

You're on Liquibase 4.30.0 or earlier with the wrong GraalPy version

Fix: install the correct version of GraalPy. In Liquibase 4.30.0 and earlier, Linux users must install GraalPy 24.0.0 (not the latest version). In Liquibase 4.31.0 and later, you can use the latest version of GraalPy.