Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'COMETS_HOME' #16

Open
merveyrc opened this issue May 27, 2022 · 12 comments
Open

KeyError: 'COMETS_HOME' #16

merveyrc opened this issue May 27, 2022 · 12 comments

Comments

@merveyrc
Copy link

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
Copy link
Collaborator

jeremymchacon commented May 27, 2022

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
Copy link
Author

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 ?

@merveyrc merveyrc reopened this May 29, 2022
@jeremymchacon
Copy link
Collaborator

jeremymchacon commented May 29, 2022 via email

@IdunBurgos
Copy link

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
Copy link
Collaborator

jeremymchacon commented Jun 6, 2023 via email

@IdunBurgos
Copy link

Thank you for the reply!

@yqq-79
Copy link

yqq-79 commented Aug 29, 2023

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
Copy link
Contributor

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
Copy link

yqq-79 commented Aug 29, 2023

I see. Thank you for the reply!

@lancong0714
Copy link

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

@jeremymchacon
Copy link
Collaborator

jeremymchacon commented May 21, 2024 via email

@lancong0714
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants