Installation

Required Software

Before you install PsN, you should make sure that the following programs and the required modules are installed on your computer.

NONMEM

PsN 4 supports standard and NMQual 8 installations of NONMEM.
Verify that all NONMEM installations you intend to use can be run directly via the nmfe/autolog scripts and that they produce complete output files.
If running NONMEM with nmfe/autolog.pl does not work then PsN will not work either.
If you plan to use the parallelization features of NONMEM you must also verify that you can run NONMEM in parallel directly with the nmfe script, for example nmfe73.

Perl 5, version 5.10.1 or higher

The Perl version can be checked with the command
perl --version

Perl Modules

The only Perl modules required to be able to run PsN are:
Maths::Random
Moose
MooseX::Params:Validate

but without the recommended modules (listed below for each OS), some scm and vpc features, nmoutput2so and a scm bugfix are not available.

The following paragraphs describe the setup procedure for different operating systems. You need internet access for the installation procedure to work because the packages are downloaded from the web. Pay attention to any warning message about internet connection problmes, as such problems must be solved before completing the installations.

Perl for Windows users

We recommend Strawberry Perl for Windows users who are installing Perl for the first time, because of the easier installation and the wider selection of Perl modules.

Warning: the gfortran coming bundled with the latest version of strawberry perl (5.26.2.1) cannot be used to run NONMEM. For unknown reasons NONMEM crashes when testing the installation.

ActivePerl also works fine even though some Perl modules might be more difficult to install. If ActivePerl is selected it is important to select a version which supports the extra Perl modules needed for PsN.

Installing Strawberry Perl Modules on Windows

  1. Open a DOS command window
    (Start→Run, type cmd
    or
    In Windows 10: Start→All apps→Windows System→ Command Prompt).
  2. Run the following commands (hit ↵ after each command):
    cpan Math::Random
    cpan MooseX::Params::Validate
    cpan Statistics::Distributions
    cpan YAML::XS
    cpan XML::LibXML

Installing ActivePerl Modules on Windows

☛ Note: ActivePerl (unlike Strawberry Perl) does not come with libxml2, which is a dependency of the XML-LibXML package, bundled. If you intend to run nmoutput2so you will need to install the appropriate dll:s manually. The libxml2 webpage has information on how to do this.
  1. Open a DOS command window
    (Start→Run, type cmd
    or
    In Windows 10: Start→All apps→Windows System→ Command Prompt).
  2. Run the following commands (hit ↵ after each command):
    ppm install math-random
    ppm install moosex-params-validate
    ppm install statistics-distributions
    ppm install archive-zip
    ppm install file-copy-recursive
    ppm install YAML-XS
    ppm install XML-LibXML

Perl for Mac OS users

The version of Perl needs to be 5.10.1 or above. For older versions of Mac OS, Perl needs to be upgraded. This can be done by installing ActivePerl (and installing the needed packages with ppm install).

For updated information on which modules are available for which Perl version in ActivePerl see package information pages for
Math::Random
MooseX::Params::Validate
File::Copy::Recursive
Archive::Zip
Statistics::Distributions
and
XML::LibXML.

Installing Perl modules on Linux/Unix/Mac OS

You might need to answer some questions interactively when using the cpan command.
  1. Open a terminal.
  2. Run the following commands (hit ↵ after each command), prepend sudo if necessary:
    cpan Math::Random
    cpan Moose
    cpan MooseX::Params::Validate
    cpan Statistics::Distributions
    cpan Archive::Zip
    cpan File::Copy::Recursive
    cpan Yaml::XS
    cpan Storable

PsN Installation

  1. Unpack the file you downloaded from the PsN Download Page. It will create a directory called PsN-Source.

  2. Run the installation script from within PsN-Source.

    Windows

    User of Strawberry Perl, open a DOS command window
    (Start→Run, type cmd
    or
    In Windows 10: Start→All apps→Windows System→ Command Prompt)
    and go to the PsN-Source directory and type: perl setup.pl and ↵.

    If you have ActivePerl installed you should be able to double-click setup.pl for the installation to start. Otherwise, open a command prompt, go to the PsN-Source directory and type: perl setup.pl and ↵.

    Linux/Unix/Mac OS

    Open a terminal, cd to the PsN-Source directory and type: sudo perl setup.pl and ↵.

    sudo can be skipped if you already have write permissions in the installation directories you intend to use.

  3. Read all messages carefully and answer the questions on screen.

    Windows

    The default settings are probably the best for most users. It is highly recommended to let the installation script create psn.conf. automatically unless you are experienced in installing and configuring PsN.
    For convenience you should also check that the directory where the utilities are installed is in your $PATH. (Right-click on My Computer→ Choose Advanced system settings → Environment variables → Mark path and click Edit and make the changes needed).
  4. Mac OS

    Mac users with the latest version(s) of Mac Os cannot accept the default installation folder for PsN utilities, even when installing as root.1
    Do the following:
    Run setup.pl as root.

    When setup.pl prompts for the PsN Utilities directory like this:
    PsN Utilities installation directory [/usr/bin]:
    type /usr/local/bin and ↵.

    The other default settings can be accepted.
    If there is a message about PsN already being installed this message is misleading, what it should say is that PsN is already *partially* installed. This is not an error, just say yes to continue.

  5. If you did not let the installation script create the configuration file psn.conf for you, or if you are running NONMEM via NMQual or on a cluster, you need to edit psn.conf in the PsN installation directory.
    The document PsN Configuration.pdf describes how to make the correct settings in the psn.conf file.

  6. When the installation is done you can safely remove the PsN-Source directory.

1 The default installation folder cannot be used with the latest versions of Mac OS as not even root has write permissions in /usr/bin and therefore setup.pl cannot install anything there. What we want to do is use a directory which is already in $PATH *and* where root has write permission.


Portable PsN installations

This functionality is intended for advanced users only. The setup.pl script takes an optional argument 'relative':
setup.pl relative
If this argument is given, the bin scripts (PsN Utilities) will use a relative path when including the lib modules (PsN Core and Toolkit). This makes the PsN installation directory movable, as long as the relative position between the bin scripts and lib modules remains the same.
In addition the [nm_versions] section in psn.conf can list the name of the nmfe executables instead of the full path to the NONMEM installation directories if at runtime the nmfe executable, chosen by default or with option -nm_version, is in the user $PATH, see documentation in PsN Configuration.pdf.
The test package, if installed, will not be portable even if setup.pl is run with argument relative. If the test package is moved, the file test/includes.pm must be edited manually before any tests are run.

Multiple PsN installations

It is possible to have several installations of PsN and use them in parallel. The default version of PsN may be changed every time a new installation is made. To check which PsN version is the default use the command
psn -version
A specific version may be called with its version number, for example
execute-3.7.6 -help
☛ Note: When installing PsN 4 on Windows all previously installed versions (installed with the same bin directory, including PsN 3-versions) are fixed automatically so that they are callable with a specific version as explained above. This is a new feature of PsN 4 when installing on Windows.

R plots

The automatic rplots functionality in PsN (via the -rplots option) require that R (at least version 3.1.2 is required) is installed and that some specific R packages along with their dependencies are installed in R.
The R-scripts/install_R_packages.R can be run to install all needed R-packages in the given path. Open a terminal, go to the R-scripts directory, type
Rscript install_R_packages.R
and the full path to where to install.
Example:
Rscript install_R_packages.R C:\R\library
To make PsN always use a specific R library path, add the R library path to the psn.conf file.
Example:
R_LIB_PATH=C:\R\library
Some of these packages need some external dependencies to be installed before installing in R.

Ubuntu/Debian

apt install libpq-dev
apt install libcairo2-dev
apt install libssl-dev
apt install libcurl4-openssl-dev
apt install libmariadb-client-lgpl-dev
apt install libgmp-dev
apt install libmpfr-dev
apt install libxml2-dev
apt install libudunits2-dev
apt install libblas-dev
apt install liblapack-dev
apt install libmagick++-dev

CentOS/Fedora

yum install openssl-devel
yum install libcurl-devel
yum install cairo-devel
yum install mariadb-devel
yum install libxml2-devel
yum install ImageMagick-c++-devel

Mac Os

For Mac OS one option is to install the following packages via brew:
openssl@1.1
cairo
and
mariadb-connector-c.


R Markdown

Some of the PsN tools support using R Markdown to plot. Then you need to install R Markdown in R together with its dependencies. When using Rstudio, the installation will be taken care of behind the scenes.

Ubuntu/Debian

For Ubuntu and Debian Linux, apart from installing the R Markdown package, the following commands are needed to install the dependencies:
apt install pandoc
apt install texlive
apt install texlive-latex-extra

Windows

The recommended option is to install RStudio and MiKTeX.
Download and install the latest version of RStudio from Rstudio.
Download the Basic MiKTeX Installer from MiKTeX.
Download and install pandoc from pandoc.
Before you actually can work with R Markdown, you need to install a few packages. RStudio automatically detects which packages are needed if you create a new R Markdown file.
To create a new R Markdown file you need to
open RStudio
click File in the menu
then New File
and finally R Markdown.
RStudio detects that you miss some packages and asks if you want to install them. Click Yes. RStudio then installs the required packages.