UUPharmacometrics/PsN

Pharmpy 1.2.0

Closed this issue · 3 comments

Hi,

Testing PsN 5.4.0 with Pharmpy 1.2.0 results in the following error in the frem routine

$ frem run2.mod -covariates=APGR -no-model_subdir
Traceback (most recent call last):
  File "<install_dir>/pharmpy-core/1.2.0-foss-2023a/bin/psn-pharmpy-wrapper", line 8, in <module>
    sys.exit(pharmpy_wrapper())
             ^^^^^^^^^^^^^^^^^
  File "<install_dir>/pharmpy-core/1.2.0-foss-2023a/lib/python3.11/site-packages/pharmpy/tools/psn_helpers.py", line 157, in pharmpy_wrapper
    exec(sys.argv[1], globals(), {})
  File "<string>", line 1, in <module>
TypeError: setup() missing 1 required positional argument: 'missing_data_token'
Must have at least one covariate at <install_dir>/PsN/5.4.0-foss-2023a/frem line 335.

$ cat run2.mod 
$PROBLEM    PHENOBARB SIMPLE MODEL
$INPUT      ID TIME AMT WT APGR DV LNWT
$DATA       pheno.dta IGNORE=I

Testing with Pharmpy 1.0.1 (as suggested in the PsN 5.4.0 Github release) works fine. We wanted to benefit from some of the recent fixes in Pharmpy 1.2.0 though for our pharmpy standalone work.

This is because of a recent fix in the FREM to be able to use different tokens for missing data. I think a one line patch would solve this problem to make it possible to use Pharmpy 1.2.0 with PsN 5.4.0:

In lib/tools/frem.pm change line 114 to:

    my $code = "from pharmpy.tools.frem.tool import setup; print(setup(" . PsN::path_literal($model->full_name) . ',' . PsN::python_array($self->covariates) . ',"' . $self->missing_data_token . '"' . "))";

Thank you that solved it!

Thanks for the feedback! The next version of PsN should solve this.