When importing pyjmi or pymodelica in Python the script startup.py is run which sets the environment used by JModelica.org for the current Python session. For example, the environment variable
JMODELICA_HOME points at the JModelica.org installation directory and IPOPT_HOME points at the Ipopt installation directory. One or more of these environment variables set in startup.py can be overridden by a user defined script: user_startup.py.
The script startup.py looks for user_startup.py in the folder
$USERPROFILE/.jmodelica.org/ (Windows)
$HOME/.jmodelica.org/ (unix)
If the script user_startup.py is not found, the default environment variables will be used.
The following step-by-step procedure will redefine the JModelica.org environment variable IPOPT_HOME:
Create a text file and name it user_startup.py.
Place the file in $USERPROFILE/.jmodelica.org/ (Windows) or $HOME/.jmodelica.org/ (unix). To find out what $USERPROFILE or $HOME points to, open a Python shell and type:
import os os.environ['USERPROFILE'] // windows os.environ['HOME'] // unix
Open the file and type
environ['IPOPT_HOME']='<new path to Ipopt home>'
Save and close.
Check your changes by opening a Python shell, import pyjmi and check the IPOPT_HOME environment variable:
import pyjmi pyjmi.environ['IPOPT_HOME']