Geode Common Module
geode-common is the foundational Python module for Geode-solutions' licensed computational geometry and meshing libraries. It provides core utilities, license management, and environment initialization for the entire Geode-solutions ecosystem. It is a wrapper around a C++ library using Pybind11. The current version is 33.21.3, with frequent updates aligning with Geode-solutions' development.
Common errors
-
ModuleNotFoundError: No module named 'geode_common'
cause The geode-common package is not installed in the current Python environment, or the environment is not activated.fixRun `pip install geode-common` to install the package. Ensure your virtual environment (if used) is active. -
RuntimeError: Geode-solutions has not been initialized. Please call geode_common.initialize_geode_solutions() first.
cause The required initialization function `geode_common.initialize_geode_solutions()` was not called before attempting to use Geode-solutions functionality.fixAdd `geode_common.initialize_geode_solutions()` to your code before any other Geode-solutions operations. -
RuntimeError: License is not valid.
cause The provided license key is either missing, expired, or invalid for the Geode-solutions modules being used.fixEnsure you have a correct and current license key. Set it using `geode_common.set_license('YOUR_KEY_HERE')` or via the `GEODE_LICENSE_KEY` environment variable. -
ERROR: Package 'geode-common' requires Python '>=3.9, <3.13', but you have Python 3.X.
cause You are attempting to install geode-common on a Python version that is not officially supported.fixSwitch to a supported Python version (3.9, 3.10, 3.11, or 3.12). Consider using `pyenv` or `conda` to manage multiple Python versions.
Warnings
- breaking geode-common has strict Python version requirements. It officially supports Python versions 3.9 through 3.12. Attempting to install or run on unsupported Python versions (e.g., 3.8 or 3.13+) will result in installation failures or runtime errors.
- gotcha Calling `geode_common.initialize_geode_solutions()` is mandatory before using any functionality from `geode-common` or any other Geode-solutions module. Forgetting this step will lead to runtime errors.
- gotcha Most licensed Geode-solutions modules rely on a valid license key set via `geode_common.set_license()`. While `geode-common` itself might function partially without it, subsequent imports or operations from other Geode-solutions modules will fail.
Install
-
pip install geode-common
Imports
- geode_common
import geode_common
- set_license
from geode_common import set_license
- initialize_geode_solutions
from geode_common import initialize_geode_solutions
Quickstart
import os
import geode_common
# The Geode-solutions ecosystem typically requires a license key.
# It's best practice to provide this via an environment variable.
license_key = os.environ.get("GEODE_LICENSE_KEY", "")
geode_common.set_license(license_key)
# Initialize the Geode-solutions environment, which is mandatory
# before using any other Geode-solutions modules.
geode_common.initialize_geode_solutions()
# You can check the version or other common properties after initialization.
print(f"Geode-solutions common module initialized. Version: {geode_common.VERSION}")
print(f"Logger enabled: {geode_common.Logger.is_enabled()}")
# At this point, you would typically import and use other specific
# Geode-solutions modules (e.g., geode_mesh, geode_implicit).