Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Pyomo version bug? #50

Closed
samgdotson opened this issue Feb 29, 2024 · 3 comments · Fixed by #65
Closed

New Pyomo version bug? #50

samgdotson opened this issue Feb 29, 2024 · 3 comments · Fixed by #65
Assignees
Labels
Comp:Build This issue has to do with the build system of the code/doc (makefiles, cmake, install errors) Difficulty:3-Expert This issue is not only complicated, but also complex. It may require special advanced skills. Priority:1-Critical This is the highest priority (i.e. it is blocking other work or facing a deadline). Status:1-New No one has claimed this issue yet. It is in need of solving. Type:Bug Something is wrong or broken. This issue or PR is related to a bug in code.

Comments

@samgdotson
Copy link
Collaborator

Here's what I know, last week (2/20/2024) I could run an osier.CapacityExpansion problem just fine and the output would look something like this

Working configurations

platform python version pyomo version
Win10 3.9.3 6.4.1
==========================================================
n_gen  |  n_eval  | n_nds  |      eps      |   indicator  
==========================================================
     1 |       10 |      1 |             - |             -
     2 |       20 |      1 |  0.000000E+00 |             f
     3 |       30 |      1 |  0.000000E+00 |             f
     4 |       40 |      1 |  0.000000E+00 |             f
     5 |       50 |      1 |  0.000000E+00 |             f

Now, the problem still runs but the output is a lot less pretty

Broken configurations

platform python version pyomo version
Win10, MacOS Monterey 12.6 3.9.3. 3.10.13 6.7.1
==========================================================
n_gen  |  n_eval  | n_nds  |      eps      |   indicator  
==========================================================
     1 |       10 |      1 |             - |             -
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[NaturalGas_Conv,0]
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[NaturalGas_Conv,0]
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
     2 |       20 |      1 |  0.000000E+00 |             f
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[NaturalGas_Conv,0]
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[NaturalGas_Conv,0]
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
     3 |       30 |      1 |  0.000000E+00 |             f
ERROR: evaluating object as numeric value: x[NaturalGas_Conv,0]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object x[NaturalGas_Conv,0]
     4 |       40 |      1 |  0.000000E+00 |             f
     5 |       50 |      1 |  0.000000E+00 |             f

What I have tried

  1. I plugged the error into Google, found this post from 2018. I can verify that this problem only occurs when a model is unfeasible. However, that will be the case for many many models tested in osier because that's just how genetic algorithms work so it would be nice to turn off whatever error message is causing this.
  2. I checked the verbosity settings -- the verbosity is as high as it can possibly go.
logging.getLogger('pyomo.core').setLevel(verbosity)`   # default = logging.Critical
  1. I also tried
import warnings
warnings.filter('ignore')
  1. I reinstalled osier in two fresh conda environments. One with Python 3.9 and the other with Python 3.10. I also tested it with Pyomo versions 6.4.1 and 6.7.1 (see above configurations) -- this behavior is only present with the most recent pyomo version, 6.7.1. This pyomo update was released this week which is consistent with the timeline where my code was working fine on Friday and today it is not. Especially since it was previously working on two other machines with more recent versions of pyomo, bet less recent than the current (until I updated them today and now they're broken).
  2. I have tried specifying the pyomo version in setup.py under the install_requires parameter, however doing so results in the following error message
Obtaining file:///C:/Users/samgd/Research/osier
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\samgd\Research\osier\setup.py", line 113, in <module>
          setup(**opts)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\_distutils\core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\dist.py", line 303, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\_distutils\dist.py", line 258, in __init__
          getattr(self.metadata, "set_" + key)(val)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\_distutils\dist.py", line 1255, in set_requires
          distutils.versionpredicate.VersionPredicate(v)
        File "C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\_distutils\versionpredicate.py", line 122, in __init__
          raise ValueError("expected parenthesized list: %r" % paren)
      ValueError: expected parenthesized list: '<=6.7.0'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

What needs to change

This issue can be closed when setup.py specifies a version of pyomo<=6.7.0.

OR

Update the way osier is installed per the line in the error message C:\Users\samgd\anaconda3\envs\pyomo64\lib\site-packages\setuptools\__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.

@yardasol would you mind helping with this?

@samgdotson samgdotson added Comp:Build This issue has to do with the build system of the code/doc (makefiles, cmake, install errors) Difficulty:3-Expert This issue is not only complicated, but also complex. It may require special advanced skills. Priority:1-Critical This is the highest priority (i.e. it is blocking other work or facing a deadline). Status:1-New No one has claimed this issue yet. It is in need of solving. Type:Bug Something is wrong or broken. This issue or PR is related to a bug in code. labels Feb 29, 2024
@samgdotson samgdotson self-assigned this Feb 29, 2024
@samgdotson samgdotson mentioned this issue Mar 4, 2024
@yardasol
Copy link
Contributor

@samgdotson I think your best bet for now is to fix your setup.py so you aren't using the deprecated setuptools.installer, AND put a version requirement on pyomo.

@samgdotson
Copy link
Collaborator Author

@yardasol Do you have a recommendation for migrating the installer?

@yardasol
Copy link
Contributor

yardasol commented Sep 9, 2024

I do not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Comp:Build This issue has to do with the build system of the code/doc (makefiles, cmake, install errors) Difficulty:3-Expert This issue is not only complicated, but also complex. It may require special advanced skills. Priority:1-Critical This is the highest priority (i.e. it is blocking other work or facing a deadline). Status:1-New No one has claimed this issue yet. It is in need of solving. Type:Bug Something is wrong or broken. This issue or PR is related to a bug in code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants