Search code examples
pythonoptimizationpyomo

Pyomo access issues


I have managed to successfully install Anaconda and Pyomo using Conda. I would like to know how to access Pyomo and run examples. For example, if I use Spyder to run the example given in the ND Pyomo cookbook I get error message of syntax error: https://nbviewer.jupyter.org/github/jckantor/ND-Pyomo-Cookbook/blob/master/notebooks/02.02-Linear-Blending-Problem.ipynb

I am new to Python and Pyomo, so I need some help in getting started. Can someone explain step by step as to how to access Pyomo and run examples from the cookbook, e.g: 1. which GUI should be used (I have installed Anaconda); 2. do I need to past the code from the cookbook into Spyder, and save it and then run it?


Solution

  • You can run any of the examples in the ND Pyomo cookbook online using Google colab, just click on the blue badge at the top of the page. If you want to run them locally you need to run them using Jupyter. The cookbook examples are all Jupyter notebooks and not standard Python scripts. Jupyter is usually available in Anaconda so you should be able to launch it by typing the command jupyter notebook in an Anaconda prompt. You should then be able to navigate to the directory where you've downloaded the cookbook example and run it.