FZNB FZNB - 1 year ago 101
Python Question

Installing Pyomo on Windows with Anaconda (Python)

I would like to solve LP and ILP with Pyomo (Coopr) but unfortunately I am so newbie and I cannot run it properly.

I have already installed Pyomo (Coopr) by following its instructions

pip install Coopr

I can import the module without problems:

$ python
Python 2.7.5 |Anaconda 1.8.0 (64-bit)| ...
Type "help", "copyright", "credits" or "license" for more information.
>>> import coopr.pyomo

At this point is where I get lost since I can't find the path where in theory I have installed the package

I think I have to create an enviroment but I have recently read that there is a better integration now with conda v. 2.1 (link)

There is a branch of conda (new-pypi-install) that adds better integration with pip and PyPI. In particular conda list will also show pip installed packages and conda install will first try to find a conda package and failing that will use pip to install the package.

My final goal is to implement this into an IPython notebook and be able obtain the results as output.

Note: I am trying to run the demo file

pyomo diet1.py diet.dat

Answer Source


the PATH on windows where is located pyomo.exe is indeed C:\Anaconda\Scripts

Besides, the PATH was set correctly since the cmd recognized the pyomo command at the beginning


echo %path%

on the cmd you can get a list of all the paths (where the C:\Anaconda\Scripts\ is inclueded"

So with Anconda it was only necessary to set the path where the glpsol.exe is located, to do that from the cmd.exe and considering that you have unzipped your winglpk on "C:\glpk\w64":

setx path "%path%;c:\glpk\w64"

After that, restart the cmd and navigate with the "cd" command where you have the data.py and data.dat

Finally it works! Thanks to the mailing list of pyomo project for the indications

For more information I recommend to read the next links:

wingplk: http://en.wikibooks.org/wiki/GLPK/Windows_executables

setting the path on windows 7: http://www.voidspace.org.uk/python/articles/command_line.shtml http://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them