switch-model / switch

A Modern Platform for Planning High-Renewable Power Systems
http://switch-model.org/
Other
127 stars 83 forks source link

Installation with pyomo 5.7 fails #130

Open tomaszG247 opened 4 years ago

tomaszG247 commented 4 years ago

Dear all,

thanks for your work on Switch. It seems really interesting. However, I failed to install Switch and run examples. I have installed both from conda and in dev mode with pip install with the same results. when running most tests or examples, I get the error

Traceback (most recent call last):
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\Scripts\switch-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\switch_model\main.py", line 39, in main
    main()
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\switch_model\solve.py", line 90, in main
    model = create_model(modules, args=args)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\switch_model\utilities.py", line 100, in create_model
    module.define_components(model)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\switch_model\generators\core\no_commit.py", line 83, in define_components
    rule=lambda m:
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\set.py", line 2208, in __init__
    Set.__init__(self, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\set.py", line 1934, in __init__
    IndexedComponent.__init__(self, *args, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\indexed_component.py", line 182, in __init__
    Component.__init__(self, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\component.py", line 402, in __init__
    % ( type(self).__name__, ','.join(sorted(kwds.keys())) ))
ValueError: Unexpected keyword options found while constructing 'AbstractOrderedSimpleSet':
        rule

It seems this has to do with Pyomo. I have tried installing older versions of Pyomo instead (4.4.1 and 5.6.4) but then there was another error:

Traceback (most recent call last):
  File "C:\Code\switch\switch-model\tests\utilities_test.py", line 26, in test_save_inputs_as_dat
    return_model=True, return_instance=True
  File "C:\Code\switch\switch-model\switch_model\solve.py", line 90, in main
    model = create_model(modules, args=args)
  File "C:\Code\switch\switch-model\switch_model\utilities.py", line 100, in create_model
    module.define_components(model)
  File "C:\Code\switch\switch-model\switch_model\generators\core\no_commit.py", line 83, in define_components
    rule=lambda m:
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\set.py", line 2208, in __init__
    Set.__init__(self, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\set.py", line 1934, in __init__
    IndexedComponent.__init__(self, *args, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\indexed_component.py", line 182, in __init__
    Component.__init__(self, **kwds)
  File "C:\Users\TGi\AppData\Local\Continuum\anaconda3\envs\switch\lib\site-packages\pyomo\core\base\component.py", line 402, in __init__
    % ( type(self).__name__, ','.join(sorted(kwds.keys())) ))
ValueError: Unexpected keyword options found while constructing 'AbstractOrderedSimpleSet':
        rule

I am using python 3.7. thank you for your help.

T

pjalet commented 4 years ago

Same here, with an install in a fresh Conda environment. Downgrading to Pyomo 5.6.9 and pyutilib 5.8.0 fixes the error (but many warnings: "The default domain for Param objects is 'Any'. However, we will be changing that default to 'Reals' in the future. If you really intend the domain of this Param (trans_dbid) to be 'Any', you can suppress this warning by explicitly specifying 'within=Any' to the Param constructor. (deprecated in 5.6.9, will be removed in 6.0))

tomaszG247 commented 4 years ago

Works for me. Same warnings. As a side note, the setup.py is missing glpk in the install_requires section I think. Finally, conda install coincbc does not work on Windows only on Mac and Linux according to the anaconda website.