Open 2132030 opened 9 months ago
I think I've seen similar problem before. Can you send me the script you are trying to run? Can you run the P1_test_tube_aerobic.ipynb at all? You can get is here: https://sites.google.com/view/comets-tutorial/home
I think I know what the bug is. "line_terminator" should be "lineterminator" in to_csv(f, mode='a', line_terminator = '\n', header=False, index=False) Let me change and test this.
OK, I think, in model.py all "line_terminator" need to be changed to "lineterminator". I will try that later today, but you may try to do it yourself and test it. Then you can actually push it here. I would appreciate that. :)
I changed and test it and solved this, after then I got another error in my script: (I am using macOS Sonoma 14.3.1, Gurobi 1100, Comets 2.10.5, java 21.0.2)
Running COMETS simulation ... Error: COMETS simulation did not complete
examine comets.run_output for the full java trace
if we detect a common reason, it will be stated in the RuntimeError at the bottom
RuntimeError Traceback (most recent call last) Cell In[39], line 1 ----> 1 sim.run()
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:400, in comets.run(self, delete_files) 397 self.run_errors = "STDERR empty." 399 # Raise RuntimeError if simulation had nonzero exit --> 400 self.__analyze_run_output() 402 # '''----------- READ OUTPUT ---------------------------------------''' 403 # Read total biomass output 404 if self.parameters.all_params['writeTotalBiomassLog']:
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:568, in comets.__analyze_run_output(self) 565 raise RuntimeError(f"COMETS simulation did not complete:\n {message}") 567 message = "undetected reason. examine comets.run_output for JAVA trace" --> 568 raise RuntimeError(f"COMETS simulation did not complete:\n {message}")
RuntimeError: COMETS simulation did not complete: undetected reason. examine comets.run_output for JAVA trace
Same error in your script:
Running COMETS simulation ... Error: COMETS simulation did not complete
examine comets.run_output for the full java trace
if we detect a common reason, it will be stated in the RuntimeError at the bottom
RuntimeError Traceback (most recent call last) Cell In[11], line 1 ----> 1 experiment.run()
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:400, in comets.run(self, delete_files) 397 self.run_errors = "STDERR empty." 399 # Raise RuntimeError if simulation had nonzero exit --> 400 self.__analyze_run_output() 402 # '''----------- READ OUTPUT ---------------------------------------''' 403 # Read total biomass output 404 if self.parameters.all_params['writeTotalBiomassLog']:
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:565, in comets.__analyze_run_output(self) 563 message += "if in Unix. In Windows, it suggests that something changed\n" 564 message += "with the dependencies installed alongside COMETS" --> 565 raise RuntimeError(f"COMETS simulation did not complete:\n {message}") 567 message = "undetected reason. examine comets.run_output for JAVA trace" 568 raise RuntimeError(f"COMETS simulation did not complete:\n {message}")
RuntimeError: COMETS simulation did not complete: JAVA could not find gurobi. try the following:
import os os.environ['GUROBI_COMETS_HOME'] if there is nothing there try setting that variable to the location of gurobi.jar, for example: os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi900/linux64'
This seems like you don't have gurobi installed properly. Are you doing this on Linux? If yes, make sure you have the GUROBI_COMETS_HOME defined in your .bashrc file. My .bashrc file has these lines:
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
Make sure you adapt them to your case, wherever you installed gurobi should replace my line /share/pkg.7/gurobi/9.0.0/install/ Is this enough info you need, or should I explain in more detail?
No, I am using MacOS
On Mac you need this line:
export GUROBI_HOME=/Library/gurobi902/mac64/
Where instead of gurobi902 put gurobi
I tried this line in .bashrc file: export GUROBI_HOME= /Library/gurobi1100/macos_universal2
but, I got this error again:
Running COMETS simulation ... Error: COMETS simulation did not complete
examine comets.run_output for the full java trace
if we detect a common reason, it will be stated in the RuntimeError at the bottom
RuntimeError Traceback (most recent call last) Cell In[19], line 1 ----> 1 experiment.run()
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:400, in comets.run(self, delete_files) 397 self.run_errors = "STDERR empty." 399 # Raise RuntimeError if simulation had nonzero exit --> 400 self.__analyze_run_output() 402 # '''----------- READ OUTPUT ---------------------------------------''' 403 # Read total biomass output 404 if self.parameters.all_params['writeTotalBiomassLog']:
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:565, in comets.__analyze_run_output(self) 563 message += "if in Unix. In Windows, it suggests that something changed\n" 564 message += "with the dependencies installed alongside COMETS" --> 565 raise RuntimeError(f"COMETS simulation did not complete:\n {message}") 567 message = "undetected reason. examine comets.run_output for JAVA trace" 568 raise RuntimeError(f"COMETS simulation did not complete:\n {message}")
RuntimeError: COMETS simulation did not complete: JAVA could not find gurobi. try the following:
import os os.environ['GUROBI_COMETS_HOME'] if there is nothing there try setting that variable to the location of gurobi.jar, for example: os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi900/linux64'
Hi all, this is an aside, but while the lineterminator thing probably should be changed, it shouldn't cause an error I don't think. It is more likely a red herring related to other issues.
On Mon, Feb 26, 2024 at 3:39 AM 2132030 @.***> wrote:
I tried this line in .bashrc file: export GUROBI_HOME= /Library/gurobi1100/macos_universal2
but, I got this error again:
Running COMETS simulation ... Error: COMETS simulation did not complete
examine comets.run_output for the full java trace
if we detect a common reason, it will be stated in the RuntimeError at the bottom
RuntimeError Traceback (most recent call last) Cell In[19], line 1 ----> 1 experiment.run()
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:400, in comets.run(self, delete_files) 397 self.run_errors = "STDERR empty." 399 # Raise RuntimeError if simulation had nonzero exit --> 400 self.__analyze_run_output() 402 # '''----------- READ OUTPUT ---------------------------------------''' 403 # Read total biomass output 404 if self.parameters.all_params['writeTotalBiomassLog']:
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:565, in comets.__analyze_run_output(self) 563 message += "if in Unix. In Windows, it suggests that something changed\n" 564 message += "with the dependencies installed alongside COMETS" --> 565 raise RuntimeError(f"COMETS simulation did not complete:\n {message}") 567 message = "undetected reason. examine comets.run_output for JAVA trace" 568 raise RuntimeError(f"COMETS simulation did not complete:\n {message}")
RuntimeError: COMETS simulation did not complete: JAVA could not find gurobi. try the following:
import os os.environ['GUROBI_COMETS_HOME'] if there is nothing there try setting that variable to the location of gurobi.jar, for example: os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi900/linux64'
— Reply to this email directly, view it on GitHub https://github.com/segrelab/cometspy/issues/50#issuecomment-1963689478, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLGCRNDA2J76J6CFZAOH5DYVRJ35AVCNFSM6AAAAABDWOQ5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGY4DSNBXHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
--
Jeremy M. Chacón, Ph.D.
he / him / his
Bioinformatics Analyst RI Bioinformatics Minnesota Supercomputing Institute University of Minnesota
You need to make sure that you are running bash on your Mac. If you are running zsh, which is the default in latest Macs, you need to get that line in the .zshrc file. Check, do you have a .zshrc file?
Yes, I have .zshrc file
I tried in the .zshrc file but I got this error again :(
RuntimeError: COMETS simulation did not complete: JAVA could not find gurobi. try the following:
import os os.environ['GUROBI_COMETS_HOME'] if there is nothing there try setting that variable to the location of gurobi.jar, for example: os.environ['GUROBI_COMETS_HOME'] = '/opt/gurobi900/linux64'
Can you show me a screenshot of your gurobi path and directory contents? What do you get when you run: import os os.environ['GUROBI_COMETS_HOME']
I got when I run: import os os.environ['GUROBI_COMETS_HOME']
aha, yes. The problem is that /lib at the end. In your .bashrc and .zshrc files you should have export GUROBI_COMETS_HOME=/Library/gurobi1100/macos_universal2/ wihtout the lib at the end.
I tried that but got error again.
Good morning. Are you positive that gurobi is installed properly? Gurobi has a test case in their install instructions which is worth double-checking.
If it is installed properly, would you post a screenshot of your gurobi's path all the way to gurobi.jar? Thanks!
To follow up on Jeremy's comment, the problem probably is those two lib in the path, you should have only one.
Good morning. Are you positive that gurobi is installed properly? Gurobi has a test case in their install instructions which is worth double-checking. If it is installed properly, would you post a screenshot of your gurobi's path all the way to gurobi.jar? Thanks!
Here,
I get this error after 'sim.run()' code;
Running COMETS simulation ...
TypeError Traceback (most recent call last) Cell In[73], line 1 ----> 1 sim.run()
File ~/anaconda3/lib/python3.11/site-packages/cometspy/comets.py:362, in comets.run(self, delete_files) 359 c_package = self.working_dir + '.current_package' + to_append 360 c_script = self.working_dir + '.current_script' + to_append --> 362 self.layout.write_necessary_files(self.working_dir, to_append) 364 # self.layout.write_layout(self.working_dir + '.current_layout') 365 self.parameters.write_params(c_global, c_package)
File ~/anaconda3/lib/python3.11/site-packages/cometspy/layout.py:636, in layout.write_necessary_files(self, working_dir, to_append) 634 self.__check_if_initial_pops_in_range() 635 self.write_layout(working_dir, to_append) --> 636 self.write_model_files(working_dir)
File ~/anaconda3/lib/python3.11/site-packages/cometspy/layout.py:641, in layout.write_model_files(self, working_dir) 639 '''writes each model file''' 640 for m in self.models: --> 641 m.write_comets_model(working_dir)
File ~/anaconda3/lib/python3.11/site-packages/cometspy/model.py:973, in model.write_comets_model(self, working_dir) 969 with open(path_to_write, 'a') as f: 971 f.write('SMATRIX ' + str(len(self.metabolites)) + 972 ' ' + str(len(self.reactions)) + '\n') --> 973 smat.to_csv(f, mode='a', line_terminator = '\n', header=False, index=False) 974 f.write(r'//' + '\n') 976 f.write('BOUNDS ' + 977 str(self.default_bounds[0]) + ' ' + 978 str(self.default_bounds[1]) + '\n')
TypeError: NDFrame.to_csv() got an unexpected keyword argument 'line_terminator'
How can fix it? Can you help me?