Open kuzha opened 1 year ago
@kuzha When I test with python 3.9.5 I actually don't get this error, but I do with 3.9.0. The unit test .travis.yml
specifies python "3.9", which I think might pull a 3.9.x version where x > 0, which is why our unit test for this doesn't catch the error. I suggest we actually update the python version of unit tests to 3.10 or 3.11 at this point. I will create a branch that does this and see if unit tests still pass.
@kuzha Can you confirm you don't see the error if tested with python >=3.9.5?
Updated unit test python version to 3.11.4 here: https://github.com/ibpsa/project1-boptest/tree/issue550_scenarioExample.
Also suggest updating readme as in here: https://github.com/ibpsa/project1-boptest/commit/1d8f3968a9bdb3cddbc174fcf6700b764e167b80.
Hi @dhblum, I tested this example in Python3.6.9, Python3.9.5 and Python3.9.16 and all did not work with the same error message. I then checked the packages in travis, which specifies pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1. I noticed that my package versions are all different from those packages. After a few trials, I identified that it is the package "requests" gives errors. When I install "requests" using pip install, the versions I got are all higher than 2.25.1. I then installed the version 2.25.1 for requests, the example works well without errors for all the three python versions I have. You could also have a check at the "requests" version you have in your pythons. If they are all 2.25.1, then try to update to a higher version and see if you get the same error as I had.
Thanks @kuzha for looking into this further. Indeed, I replicated what you found. It seems to be the requests package if it is a higher version than 2.25.1. I suggest a fix for this to be as you indicated, final_time = start_time + 14*86400
. Will make a PR, also with later package versions. Python 3.11.4 seems to not be available in travis, but will try the latest available.
Or @kuzha feel free to implement the fix and update Package versions in the .travis.yml (see if Python 3.11 works and then most up to date compatible versions of the utilized packages) and make a PR to see how unit tests do with those updates. I might not get to it immediately.
Sounds good, I will make a pull request @dhblum
travis returns the following error
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2g 1 Mar 2016'. See: https://github.com/urllib3/urllib3/issues/2168
I will take a look later.
ha, see https://github.com/ibpsa/project1-boptest/pull/553#issuecomment-1621781078 where I also posted :)
When running the Python-based example controller testcase1_scenario.py using Python3 (tested in Python3.6 and 3.9), it will return the following error: "ValueError: Out of range float values are not JSON compliant". However, it works well in Python2.
The issue occurs from the line 145 in examples/python/interface.py, where np.inf is assigned to the final_time for the /results API request done later. The np.inf is probably not json serializable.
In the meantime, we can use any float value for that assignment as a workaround, for example, assigning a value equal to 14 days later than the start time since all scenarios are two-week periods, so that final_time = start_time + 14*86400.