segrelab / comets-toolbox

MATLAB scripts and utilities for the COMETS software for spatial DFBA
http://www.bu.edu/segrelab/comets/
GNU Lesser General Public License v3.0
2 stars 3 forks source link

Error: COMETS_HOME environmental variable is not set #8

Open 2132030 opened 7 months ago

2132030 commented 7 months ago

I am using Linux and MATLAB_R2021b. I'm trying to run the comets simulation with this code:

runComets(layout,cometsDirectory) I got this Error: Error using runCometsOnDirectory COMETS_HOME environmental variable is not set

' %% Add COMETS Java Classpath to MATLAB cometshome = getenv('COMETS_HOME'); if isempty(cometshome) error('COMETS_HOME environmental variable is not set') end gurobihome = getenv('GUROBI_HOME'); if isempty(gurobihome) error('GUROBI_HOME environmental variable is not set') end javaclasspath(cometshome); % add COMETS classpath to MATLAB javaclasspath(gurobihome); '

dukovski commented 7 months ago

You need these system variables set properly. What system are you using? Windows, Linux?

2132030 commented 7 months ago

Linux

dukovski commented 7 months ago

You need to include these lines in your .bashrc file (or equivalent for other shells):

export COMETS_HOME=/projectnb/cometsfba/comets_2.11.1 export PATH=$PATH:$COMETS_HOME export GUROBI_HOME=/share/pkg.7/gurobi/9.0.0/install/ export GUROBI_COMETS_HOME=/share/pkg.7/gurobi/9.0.0/install/ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GUROBI_COMETS_HOME/lib/

export GUROBI_PATH=$GUROBI_HOME export PATH=$PATH:$GUROBI_HOME/bin

Of course, you need to edit it to your system, the first line is setting the variable that is missing in your case. Set it to wherever you installed Comets. Let me know how it goes.