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

Environmental Variable #7

Closed sshort325 closed 2 years ago

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 10 23 22 AM I keep getting this issue and I'm not sure how to fix it.

dukovski commented 2 years ago

You did not install COMETS and Gurobi properly. The COMETS_HOME variable tells matlab where comets was installed. In Windows you go to setting->advanced->set ENV variables. In Linux/Mac you should have a line in your .bashrc or .cshrc files:

export COMETS_HOME= export GUROBI_HOME=

where and are replaced with your actual paths.

sshort325 commented 2 years ago

Oh my gosh thank you so much! I am really new to this and not very good at this point honestly. How do I find my path on a Mac? Also, if I find my path and do the export does that fix it? Or do I need to completely redownload?

dukovski commented 2 years ago

Oh no, you don't need to do any of that, just use the installer from runcomets.org

dukovski commented 2 years ago

https://www.runcomets.org/get-started

dukovski commented 2 years ago

Also, detailed instruction can be found here: https://www.nature.com/articles/s41596-021-00593-3

dukovski commented 2 years ago

specific details are in this section: https://www.nature.com/articles/s41596-021-00593-3#Sec24

dukovski commented 2 years ago

In MacOS, the line

export GUROBI_HOME=/Library/gurobi902/mac64/

should be included in the .bash_profile file in older versions of MacOS, or .zshrc in the latest version of MacOS. The version name and number in gurobi902 should be set to the one installed. It is important to source these files before attempting to run COMETS. The easiest way to do that is to close the terminal and open another one.

Also, the COMETS installer will add lines:

export COMETS_HOME=/home/username/comets export PATH=$PATH:$COMETS_HOME export GUROBI_COMETS_HOME=$(echo $(ls -d /usr/gurobi/gurobi*/linux64)|awk {‘print $NF’}) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GUROBI_COMETS_HOME/lib/

in the.bashrc file in Linux, and

export COMETS_HOME=/Applications/COMETS export PATH=$PATH:$COMETS_HOME export GUROBI_COMETS_HOME=$(echo $(ls -d /Library/gurobi*/mac64)|awk {‘print $NF’}) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GUROBI_COMETS_HOME/lib/

in the .bash_profile file in older versions of MacOS, and .zshrc in the latest version of MacOS, where username is replaced with the specific one for the user. This should make Gurobi libraries available to COMETS. More information can be found in the Troubleshooting table.

sshort325 commented 2 years ago

I do have those instructions, I have been following along with them as best as I can. On page 5042, I was following adding those lines in. However, it wasn't working well. I did download the COMETS through the link you posted. I am just really confused on this part. Screen Shot 2022-06-28 at 11 24 56 AM

dukovski commented 2 years ago

All this is supposed to be done automatically during installation. Can you look at your .zshrc file? Open a terminal and do: cat .zshrc

dukovski commented 2 years ago

Actually, let's go back a bit. Did you use the installer for Mac from runcomets.org?

sshort325 commented 2 years ago

Honestly, I started this process a few weeks ago and Im not 100% sure. But none of that information has come up automatically for me.

dukovski commented 2 years ago

OK get the installer from here: https://www.runcomets.org/installation for Mac, and just run it. Let me know hoe it goes.

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 11 49 31 AM I did, that's how COMETS looks.

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 11 49 56 AM And that's what I got in my terminal

dukovski commented 2 years ago

OK that's good

dukovski commented 2 years ago

So the problem is when you try to run the matlab toolbox, right?

dukovski commented 2 years ago

Did you add the paths to comets and cobra in matlab?

dukovski commented 2 years ago

Would you try the cometspy toolbox in pyhton, it is easier to setup.

dukovski commented 2 years ago

Oh sorry, I missed one of the warnings. Seems like you don't have gurobi installed. Did you try to install gurobi?

sshort325 commented 2 years ago

Yes thats correct. When I do testComets() it comes up with the environment variable output from above. Screen Shot 2022-06-28 at 11 55 39 AM

sshort325 commented 2 years ago

I was actually working in python when I had this happen. And that's why I switched to Matlab. Screen Shot 2022-06-23 at 2 37 04 PM

dukovski commented 2 years ago

Let's try to make it work in python.

dukovski commented 2 years ago

Open a terminal, do:

cd cat .zshrc

Let's see if you have GUROBI_HOME properly installed.

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 12 04 34 PM

dukovski commented 2 years ago

This is surprising. Do:

cat .bash_profile

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 12 10 12 PM

dukovski commented 2 years ago

OK let's see where is Gurobi installed. Do: echo $GUROBI_COMETS_HOME

dukovski commented 2 years ago

and then: echo $GUROBI_HOME

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 12 25 43 PM

dukovski commented 2 years ago

aha, this is it, gurobi is not installed where it is supposed to be They could have changed the default installation for gurobi

gbkgwyneth commented 2 years ago

Please note that as of Gurobi 9.5.0 the install directory on Macs has changed: /Library/gurobi950/macos_universal2

dukovski commented 2 years ago

Ah, that's it.

dukovski commented 2 years ago

OK so in the .bash_profile file you should make that change.

sshort325 commented 2 years ago

How do I change it?

dukovski commented 2 years ago

export GUROBI_COMETS_HOME=/Library/gurobi950/macos_universal2/ export GUROBI_HOME=/Library/gurobi950/macos_universal2/

dukovski commented 2 years ago

Edit your .bash_profile file and replace those two lines.

dukovski commented 2 years ago

Do you know how to do it?

sshort325 commented 2 years ago

I googled it just now. This is what it looks like now, I highlighted it to make it easier to see. Screen Shot 2022-06-28 at 12 35 33 PM

dukovski commented 2 years ago

OK good, now you need to restart your Mac in principle. Can you do that?

dukovski commented 2 years ago

(If you don't want to restart there is a way around it)

sshort325 commented 2 years ago

I think Ill be okay to restart it. Ill be right back

dukovski commented 2 years ago

OK

sshort325 commented 2 years ago

Alright, all restarted now

dukovski commented 2 years ago

OK let's try the echoes again

dukovski commented 2 years ago

echo $GUROBI_COMETS_HOME

sshort325 commented 2 years ago

Screen Shot 2022-06-28 at 12 46 40 PM

dukovski commented 2 years ago

I think you have a line with GUROBI_COMETS_HOME still present in your .bash_profile file.

dukovski commented 2 years ago

the old one

sshort325 commented 2 years ago

Oh crap yes I didnt delete that

dukovski commented 2 years ago

You have to comment it out