segrelab / cometspy

Python interface for running COMETS simulations and analyzing the results
GNU General Public License v3.0
11 stars 9 forks source link

KeyError: 'COMETS_HOME' #16

Open merveyrc opened 2 years ago

merveyrc commented 2 years ago

Hi, I am using macOS(10.12.6) and spyder(Python 3.9). I'm trying to run the comets simulation with this code: my_simulation = c.comets(my_layout, my_params) but I got a Error :could not find environmental variable GUROBI_COMETS_HOME or GUROBI_HOME or COMETS_GUROBI_HOME COMETS will not work with GUROBI until this is solved.

KeyError: 'COMETS_HOME'

eventhough I set all the environment variables as specified. When I check the bash profile, I can already see the all the paths which should be included.

When I check the environment variables and their locations, they are located as follows.

COMETS_HOME /Applications/COMETS GUROBI_HOME /Library/gurobi902/mac64 GRB_LICENSE_FILE / Library/gurobi902/gurobi.lic

I also tried the suggested solution which is "import os and set os.environ['GUROBI_HOME'] then try to make a comets object again" but again I got the same error : KeyError: 'COMETS_HOME'

Here is the tutorial which I tried : https://segrelab.github.io/comets-manual/getting_started/

jeremymchacon commented 2 years ago

Hello,

Many apologies, for some reason getting environmental variables to be visible across platforms has been one of our surprisingly hardest challenges.

Did you try:

import os os.environ['COMETS_HOME'] = '/Applications/COMETS/' os.environ['GUROBI_HOME'] = '/Library/gurobi902/mac64/'

?

merveyrc commented 2 years ago

Thank you so much for your return. It worked but now I got an error when I try to run simulation which is "RuntimeError: COMETS simulation did not complete:JAVA could not find gurobi."

I tried do suggested solution my_simulation.set_classpath('gurobi', '/library/gurobi902/mac64/lib/gurobi.jar') and also import os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi902/mac64'

but still I couldn't solve the problem, so simulation didn't run. What should I do to run the simulation without any errors ?

jeremymchacon commented 2 years ago

Those two paths (/opt/... and /library/...) are not the same. I would verify where gurobi is installed and adjust the code you supplied as need be. Also, once you get os.environ['GUROBI_COMETS_HOME'] pointing at the right path, the other command probably shouldn't be necessary.

On Sun, May 29, 2022 at 6:54 AM merveyrc @.***> wrote:

Thank you so much for your return. It worked but now I got an error when I try to run simulation which is "RuntimeError: COMETS simulation did not complete:JAVA could not find gurobi."

I tried do suggested solution my_simulation.set_classpath('gurobi', '/library/gurobi902/mac64/lib/gurobi.jar') and also import os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi902/mac64'

but still I couldn't solve the problem, so simulation didn't run. What should I do to run the simulation without any errors ?

— Reply to this email directly, view it on GitHub https://github.com/segrelab/cometspy/issues/16#issuecomment-1140432946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLGCRK6SS6MCDKIGT3YNRDVMNLFVANCNFSM5XEJD67Q . You are receiving this because you commented.Message ID: @.***>

--

Jeremy M. Chacón, Ph.D.

he / him / his

Research Associate, Harcombe Lab University of Minnesota Ecology, Evolution and Behavior

IdunBurgos commented 1 year ago

Hi! I'm also trying to follow the tutorial mentioned above and I was getting the same error. I installed cometspy into a conda environment and I do not have the application installed on my computer so I was not sure how to set the 'COMETS_HOME' variable. In the end, I set it to this

os.environ['GUROBI_HOME']="/Library/gurobi1001/macos_universal2" os.environ['GRG_LICENCE_FILE']="/Users/my-user/gurobi.lic" os.environ['GUROBI_COMETS_HOME'] ='/Users/my-user/opt/anaconda3/envs/my-env'

Now I'm getting a new error that I don't know how I should deal with:

`IndexError Traceback (most recent call last) Cell In[44], line 1 ----> 1 my_simulation = c.comets(my_layout,my_params)

File ~/opt/anaconda3/envs/dfba/lib/python3.8/site-packages/cometspy/comets.py:147, in comets.init(self, layout, parameters, relative_dir) 143 self.VERSION = os.path.splitext(os.listdir(os.environ['COMETS_HOME'] + 144 '/bin')[0])[0] 146 # set default classpaths, which users may change --> 147 self.build_default_classpath_pieces() 148 self.__build_and_set_classpath() 149 self.test_classpath_pieces()

File ~/opt/anaconda3/envs/dfba/lib/python3.8/site-packages/cometspy/comets.py:175, in comets.__build_default_classpath_pieces(self) 171 self.classpath_pieces = {} 172 self.classpath_pieces['gurobi'] = (self.GUROBI_HOME + 173 '/lib/gurobi.jar') --> 175 self.classpath_pieces['junit'] = glob.glob(self.COMETS_HOME + 176 '/lib/junit' + '//junit', 177 recursive=True)[0] 178 self.classpath_pieces['hamcrest'] = glob.glob(self.COMETS_HOME + 179 '/lib' + '//hamcrest', 180 recursive=True)[0] 182 self.classpath_pieces['jogl_all'] = glob.glob(self.COMETS_HOME + 183 '/lib' + '/**/jogl-all.jar', 184 recursive=True)[0]

IndexError: list index out of range`

jeremymchacon commented 1 year ago

Hello,

Thanks for your interest in COMETS. If I understood correctly, you have installed comestpy but not COMETS? cometspy is "just" an interface to COMETS and requires COMETS to be installed separately, at which point the COMETS_HOME variable will be added to your path. Please reach out if I misunderstood or you have more questions.

Best,

Jeremy

On Tue, Jun 6, 2023 at 4:58 AM IdunBurgos @.***> wrote:

Hi! I'm also trying to follow the tutorial mentioned above and I was getting the same error. I installed cometspy into a conda environment and I do not have the application installed on my computer so I was not sure how to set the 'COMETS_HOME' variable. In the end, I set it to this

os.environ['GUROBI_HOME']="/Library/gurobi1001/macos_universal2" os.environ['GRG_LICENCE_FILE']="/Users/my-user/gurobi.lic" os.environ['GUROBI_COMETS_HOME'] ='/Users/my-user/opt/anaconda3/envs/my-env'

Now I'm getting a new error that I don't know how I should deal with:

`IndexError Traceback (most recent call last) Cell In[44], line 1 ----> 1 my_simulation = c.comets(my_layout,my_params)

File ~/opt/anaconda3/envs/dfba/lib/python3.8/site-packages/cometspy/comets.py:147, in comets.init(self, layout, parameters, relative_dir) 143 self.VERSION = os.path.splitext(os.listdir(os.environ['COMETS_HOME'] + 144 '/bin')[0])[0] 146 # set default classpaths, which users may change --> 147 self.build_default_classpath_pieces() 148 self.__build_and_set_classpath() 149 self.test_classpath_pieces()

File ~/opt/anaconda3/envs/dfba/lib/python3.8/site-packages/cometspy/comets.py:175, in comets.__build_default_classpath_pieces(self) 171 self.classpath_pieces = {} 172 self.classpath_pieces['gurobi'] = (self.GUROBI_HOME + 173 '/lib/gurobi.jar') --> 175 self.classpath_pieces['junit'] = glob.glob(self.COMETS_HOME + 176 '/lib/junit' + '/

/junit', 177 recursive=True)[0] 178 self.classpath_pieces['hamcrest'] = glob.glob(self.COMETS_HOME + 179 '/lib' + '//hamcrest', 180 recursive=True)[0] 182 self.classpath_pieces['jogl_all'] = glob.glob(self.COMETS_HOME + 183 '/lib' + '/**/jogl-all.jar', 184 recursive=True)[0]

IndexError: list index out of range`

— Reply to this email directly, view it on GitHub https://github.com/segrelab/cometspy/issues/16#issuecomment-1578331214, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLGCRNMPMIMOUMCYSUNDT3XJ35M5ANCNFSM5XEJD67Q . You are receiving this because you commented.Message ID: @.***>

--

Jeremy M. Chacón, Ph.D.

he / him / his

Bioinformatics Analyst RI Bioinformatics Minnesota Supercomputing Institute University of Minnesota

IdunBurgos commented 1 year ago

Thank you for the reply!

yqq-79 commented 10 months ago

Hi! I'm also trying to follow the tutorial to run COMETS and I was getting the same error (COMETS_HOME environmental variable is not set). I installed COMETS MATLAB Toolbox in the Windows system and I didn't install the application on my computer.

dukovski commented 10 months ago

Hi yqq-79

Hi! I'm also trying to follow the tutorial to run COMETS and I was getting the same error (COMETS_HOME environmental variable is not set). I installed COMETS MATLAB Toolbox in the Windows system and I didn't install the application on my computer.

Cometspy COMETS Matlab are user interfaces for COMETS. You cannot run the without having comets installed. Please install comets first. I would recommend to use cometspy, since it has greater community of users and is better maintained. Let me know how it goes.

yqq-79 commented 10 months ago

I see. Thank you for the reply!

lancong0714 commented 1 month ago

hi, i am using windows and python. I've used the methods that you discussed above, but it still doesn't work. image

jeremymchacon commented 1 month ago

Hi LanCong, sorry you are having trouble. It looks like you have a line which is pointing to a non-existent path. Is this path correct?

os.environ ['GUROBI_HOME']='C:\gurobi1101\win64'

if yes, then replace your last environ line with this:

os.environ ['GUROBI_COMETS_HOME']='C:\gurobi1101\win64'

On Tue, May 21, 2024 at 8:53 AM LanCong @.***> wrote:

hi, i am using windows and python. I've used the methods that you discussed above, but it still doesn't work. image.png (view on web) https://github.com/segrelab/cometspy/assets/151328218/7aaee9a5-f7b5-4ffd-8f37-76d3699691c8

— Reply to this email directly, view it on GitHub https://github.com/segrelab/cometspy/issues/16#issuecomment-2122691446, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLGCRKYAT5QY4JLSGO6YLLZDNGT3AVCNFSM5XEJD672U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJSGI3DSMJUGQ3A . You are receiving this because you commented.Message ID: @.***>

--

Jeremy M. Chacón, Ph.D.

he / him / his

Bioinformatics Analyst RI Bioinformatics Minnesota Supercomputing Institute University of Minnesota

lancong0714 commented 1 month ago

Hi LanCong, sorry you are having trouble. It looks like you have a line which is pointing to a non-existent path. Is this path correct? os.environ ['GUROBI_HOME']='C:\gurobi1101\win64' if yes, then replace your last environ line with this: os.environ ['GUROBI_COMETS_HOME']='C:\gurobi1101\win64' On Tue, May 21, 2024 at 8:53 AM LanCong @.> wrote: hi, i am using windows and python. I've used the methods that you discussed above, but it still doesn't work. image.png (view on web) https://github.com/segrelab/cometspy/assets/151328218/7aaee9a5-f7b5-4ffd-8f37-76d3699691c8 — Reply to this email directly, view it on GitHub <#16 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLGCRKYAT5QY4JLSGO6YLLZDNGT3AVCNFSM5XEJD672U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJSGI3DSMJUGQ3A . You are receiving this because you commented.Message ID: @.> -- Jeremy M. Chacón, Ph.D. he / him / his Bioinformatics Analyst RI Bioinformatics Minnesota Supercomputing Institute University of Minnesota thank you for reply! I've tried your method but it still doesn't work, and I'd like to know whether the variable path I need to set('GUROBI_COMETS_HOME') is the address of the gurobi.jar