How can I install Pyomo's “extras” using pip?

2020-05-02 09:27发布

问题:

I am writing because I am having trouble installing Pyomo using pip on Python 3.6 on Mac OSX 10.14

I'm following the installation instructions here.

I can successfully execute the first command:

pip install pyomo

But when I run into trouble when I'm supposed to run the following command to install additional dependencies:

pyomo install-extras

Running this command produces the following error:

Traceback (most recent call last):
  File "/usr/local/bin/pyomo", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/pyomo_main.py", line 82, in main
    retval = _options.func(_options)
  File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/driver_help.py", line 46, in install_extras_exec
    pyutilib.subprocess.run(command, tee=True)
  File "/usr/local/lib/python3.6/site-packages/pyutilib/subprocess/processmngr.py", line 690, in run_command
    th.join()
UnboundLocalError: local variable 'th' referenced before assignment

There is a post about this here on Google Groups but no solution yet.

回答1:

This is a documented issue on the github for Pyomo: https://github.com/Pyomo/pyomo/issues/243

They don't appear to have solved the pip installation of pyomo extras.

However, if you have conda installed - https://docs.conda.io/en/latest/

You should be able to use the terminal commands from:

https://pyomo.readthedocs.io/en/latest/installation.html

run this in terminal after conda has been successfully installed:

conda install -c conda-forge pyomo.extras

I know this isn't pip, but it's at least a workaround until pyomo fixes their documentation.

  • confirmed working on python 3.x and ubuntu 18.04


回答2:

I got the problem too (in Ubuntu 18.04).

Try installing it from the git project (https://github.com/Pyomo/pyomo):

In Ubuntu 18.04:

git clone https://github.com/Pyomo/pyomo.git
python3 pyomo/scripts/get_pyomo_extras.py

Use the corresponding commands for Mac OSX (I had never used it).

I hope that it works for you.



标签: pyomo