ibpsa / project1-boptest

Building Optimization Performance Tests
Other
105 stars 69 forks source link

import name 'trapz' from 'scipy.integrate' #657

Closed Norah135 closed 1 month ago

Norah135 commented 1 month ago

I am having an issue deploying the test case in Docker using TESTCASE=test_case docker-compose up. Here is an image that describes the problem(cannot import name 'trapz' from 'scipy.integrate').

Screenshot 2024-07-16 at 9 54 24 AM

Do you have any suggestions on how I can fix it?"

dhblum commented 1 month ago

Hey @Norah135, I just ran $ TESTCASE=bestest_air docker-compose up using the master branch and on Ubuntu 18 running Docker version 24.0.2 and it built and deployed ok. Can you be more specific about the version of BOPTEST, Docker, and platform/OS you are deploying on, and whether you made any changes to the Dockerfile or otherwise? The version of scipy used within the test case container should be consistent across image builds.

Norah135 commented 1 month ago

@dhblum I really appreciate your quick response. I tried using both an Apple and a Windows device running Docker version 26.1.4, but I'm facing the same issues on both. I downloaded the latest version (6) of BOPTEST from the website and haven't made any changes to the Docker file.

Norah135 commented 1 month ago

@dhblum I wanted to ask if you can help me use the BOPTEST API without running it on Docker. I'm facing issues with Docker. I found an example on Colab, but I'm a little confused about how to connect this example with a simple control algorithm to understand how the system works. I am looking for examples similar to what we have in the GitHub repository (the test case and the interface file). Sorry to bother you, but I am new to this field and using the software. I really appreciate any guidance and help from you.

dhblum commented 1 month ago

Ok I've reproduced your error on a MacBook (Intel). This needs to be looked into. I don't know why Docker would be trying to, potentially, use a different version of scipy for Mac OS vs Ubuntu.

If you open the colab of the first tutorial listed here, it will take you through using the BOPTEST public web service to test a simple controller. Using the web service, you don't need to build BOPTEST locally.

Hopefully that's helpful for you to get started and thanks again for reporting the issue.

dhblum commented 1 month ago

Ok specifying the version of scipy to 1.13.0 in this line fixes this issue. On the MacBook it was operating with scipy v1.14.0, while on Ubuntu it was operating with v1.13.0. Using pip install is the preferred approach over conda install I think as it seems to solve environments and install all the packages faster.

I could PR this fix and then treat updating package versions to a new issue. But any ideas from anyone why two different scipy versions would be installed in a Docker container depending on Platform under which Docker is operating? @kbenne @javiarrobas @EttoreZ?

This might be related to what I'm observing in https://github.com/ibpsa/project1-boptest/issues/655.

EttoreZ commented 1 month ago

Hey @dhblum maybe this link? It seems that depending on the situation, Docker may not download the latest version of the image.

Jaap-Neven commented 1 month ago

Hi @dhblum, @EttoreZ and @Norah135, I have encountered exactly the same issue using the most recent version of boptest (master branch) and v4.32.0 of docker desktop on Windows 10 OS. A couple of weeks ago, the testcases ran fine for me, so I tested the deployment with the previous version of docker desktop (v4.31.1) and now if works fine. So it should have something to do with the recent docker desktop release notes.

Hope this was helpful!

Norah135 commented 1 month ago

Hi @dhblum
Thank you for sharing the Colab link. It was very helpful. I wanted to ask if it is possible to create my own test case for BOPTEST instead of using the predefined cases listed on the BOPTEST website.

dhblum commented 1 month ago

Thanks @Jaap-Neven your insight is helpful. In any case, I will specify the version of scipy for now to fix this issue. Looking at removing reliance on scipy in the first place will be another issue. Note this will be included in this existing PR https://github.com/ibpsa/project1-boptest/pull/659, and I'll close this issue when PR is merged.

@Norah135 Here is documentation for how test cases are designed: https://ibpsa.github.io/project1-boptest/docs-design/testcasedev.html. Additionally, here is a basic tutorial for putting together a test case: https://github.com/ibpsa/project1-boptest/blob/master/docs/tutorials/tutorial1_developer/BOPTEST_Tutorial1_developer_20230416.pdf.

dhblum commented 1 month ago

Closed by https://github.com/ibpsa/project1-boptest/pull/659.