biosustain / cameo

cameo - computer aided metabolic engineering & optimization
http://cameo.bio
Apache License 2.0
113 stars 44 forks source link

cameo optgene #227

Closed dwelkie closed 5 years ago

dwelkie commented 5 years ago

Hello, I saw that I may not be the only one who has come across this issue but I would appreciate further assistance. When I am working through the notebook "cameo-02-generating-gene-knockout-strategies" and all runs well until I reach Optgene. I get this:

result = optgene.run(target=model.reactions.EX_succ_e, 
                     biomass=model.reactions.BIOMASS_Ecoli_core_w_GAM,
                     substrate=model.metabolites.glc__D_e,
                     max_evaluations=20000, population_size=200, max_knockouts=5,
                     plot=False, growth_coupled=True)
Starting optimization at Thu, 24 Jan 2019 14:16:31
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-938f5e39fb47> in <module>
      3                      substrate=model.metabolites.glc__D_e,
      4                      max_evaluations=20000, population_size=200, max_knockouts=5,
----> 5                      plot=False, growth_coupled=True)

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/cameo/strain_design/heuristic/evolutionary_based.py in run(self, target, biomass, substrate, max_knockouts, variable_size, simulation_method, growth_coupled, max_evaluations, population_size, max_results, use_nullspace_simplification, seed, **kwargs)
    164                                             max_archive_size=max_results,
    165                                             seed=seed,
--> 166                                             **kwargs)
    167 
    168         kwargs.update(optimization_algorithm.simulation_kwargs)

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/cameo/strain_design/heuristic/evolutionary/optimization.py in run(self, max_size, variable_size, diversify, view, **kwargs)
    427                                                 generator=generator,
    428                                                 max_size=max_size,
--> 429                                                 **kwargs)
    430             simulation_logger.setLevel(log_level)
    431 

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/cameo/strain_design/heuristic/evolutionary/optimization.py in run(self, evaluator, generator, view, maximize, max_time, **kwargs)
    248                                            maximize=maximize,
    249                                            evaluator=evaluator,
--> 250                                            **kwargs)
    251         for observer in self.observers:
    252             observer.end()

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/inspyred/ec/ec.py in evolve(self, generator, evaluator, pop_size, seeds, maximize, bounder, **args)
    544     def evolve(self, generator, evaluator, pop_size=100, seeds=None, maximize=True, bounder=None, **args):
    545         args.setdefault('num_selected', pop_size)
--> 546         return EvolutionaryComputation.evolve(self, generator, evaluator, pop_size, seeds, maximize, bounder, **args)
    547 
    548 

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/inspyred/ec/ec.py in evolve(self, generator, evaluator, pop_size, seeds, maximize, bounder, **args)
    454             for obs in self.observer:
    455                 self.logger.debug('observation using {0} at generation {1} and evaluation {2}'.format(obs.__name__, self.num_generations, self.num_evaluations))
--> 456                 obs(population=list(self.population), num_generations=self.num_generations, num_evaluations=self.num_evaluations, args=self._kwargs)
    457         else:
    458             self.logger.debug('observation using {0} at generation {1} and evaluation {2}'.format(self.observer.__name__, self.num_generations, self.num_evaluations))

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/cameo/strain_design/heuristic/evolutionary/plotters.py in __call__(self, population, num_generations, num_evaluations, args)
     48     def __call__(self, population, num_generations, num_evaluations, args):
     49         if not self.plotted:
---> 50             self._set_plot()
     51 
     52         self.iteration += 1

~/anaconda3/envs/cameov2/lib/python3.7/site-packages/cameo/strain_design/heuristic/evolutionary/plotters.py in _set_plot(self)
     43         self.ds = ColumnDataSource(data=dict(x=[], y=[]))
     44         self.plot.circle('x', 'y', source=self.ds)
---> 45         self.handle = show(self.plot, notebook_handle=True)
     46         self.plotted = True
     47 

TypeError: show() got an unexpected keyword argument 'notebook_handle'

I am not sure I know how to fix it. Prior to running the line I enter and run successfully

from bokeh.plotting import figure, show from bokeh.io import output_notebook, push_notebook, show output_notebook() and get : BokehJS successfully loaded

I am attaching my environment incase that helps pinpoint an issue. cameov2.pdf

Can you please help. Thanks in advance!

phantomas1234 commented 5 years ago

Sorry, we're a little spread thin currently on a number of projects so cannot fix this in the short term. Given the trouble that bokeh has been making, we've been considering to drop it actually. An easy fix right now would be to uninstall bokeh and install plotly as an alternative plot library. If you prefer bokeh, than you could install an older version of bokeh maybe and see if it works (pip install bokeh=PUT.OLDER.VERSION.HERE --upgrade). Also, pull requests always welcome 😄

dwelkie commented 5 years ago

Thanks for such a fast reply. Believe it or not, doing what you suggested and simlply pip uninstall bokeh did the trick. Thanks again and I hope this might help others! Cheers!