Skip to content

where possible, use version of fitting script that corresponds to imported module #268

@bernstei

Description

@bernstei

For MACE and GAP, we can find the fitting script that's consistent with the currently installed module, and this should possibly be the default, ahead of the one that's in the path, if it's not explicitly specified in function arg or env var.

For mace, there's a script we can just run:

import mace
f = Path(mace.__file__).parent / "cli" / "run_train.py"
command = f"python3 {f}"

For gap there's no such script, but we could perhaps use

command = f"python3 -c 'import quippy.cli; quippy.cli.gap_fit()'"

assuming that the executed python3 will inherit the same PYTHONPATH as the running one (could always do some sort of thing with env PYTHONPATH={...} python3 ... filling in the path from sys.path.

Note that the inheriting of the PYTHONPATH could also be a problem, albeit in a subtler way, for the mace option, because even if we explicitly find the version of run_train.py, any modules it loads will come from PYTHONPATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions