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

Step-by-step instructions to get examples up and running #78

Closed
robot-army opened this issue Oct 12, 2021 · 6 comments
Closed

Step-by-step instructions to get examples up and running #78

robot-army opened this issue Oct 12, 2021 · 6 comments

Comments

@robot-army
Copy link

Hi,

I'm having some difficulty getting the example code up and running. I cloned the github repo on a new Ubuntu linux VM and ran pip install .

I then ran python3 ./examples/simple/simple.py

The output looks like:

[Errno 2] No such file or directory: 'examples/simple/resources/Simple2R1C_ic_linux64.fmu'
[Errno 2] No such file or directory: 'examples/simple/resources/Simple2R1C_ic_linux64.fmu'
[Errno 2] No such file or directory: 'examples/simple/resources/Simple2R1C_ic_linux64.fmu'
[Errno 2] No such file or directory: 'examples/simple/resources/Simple2R1C_ic_linux64.fmu'
@robot-army
Copy link
Author

(oops, prematurely submitted this issue)

I don't spend much of my time in Python or Linux, so I'm sure it's something simple I'm missing... running from the wrong directory, some weird configuration or whatever, but I'd appreciate any help I can get on this.

Thanks!

@robot-army
Copy link
Author

OK, so I switched to Conda on windows instead, as I was running out of steam on this, and after installing the pyfmi dependency, and getting the visual C++ build tools to install that...6 GB or more... I can run this.

However, the version that seems to be shipping with Conda is the 0.0.9 release, and the simple example (as it's written) depends on MODESTGA, which was added since this release.

Anyone have any advice on next steps?

@robot-army
Copy link
Author

OK, so I had to:

pip install --upgrade --user pyqtwebengine==5.12
pip install --upgrade --user pyqt5==5.12
conda update anaconda
conda install spyder=5.0.5
pip install .\modest-py-master\

and I was able to run the example, with some fixes to the os.path.join() lines to get it pointing at the right directory.

Let's see how we go...

@krzysztofarendt
Copy link
Member

Hello, I reproduced this issue. When running examples/simple/simple.py and other examples I was getting:

[Errno 2] No such file or directory: 'examples/simple/resources/Simple2R1C_ic_linux64.fmu'

However, it was also followed by another error:

OSError: libgfortran.so.3: cannot open shared object file: No such file or directory

I'm not sure why it stopped working suddenly (some Ubuntu upgrade?), but this helped:

> sudo apt-get install libgfortran3

Also, it's better to first clone the repository if you want to run examples, because this way you make sure you have all needed files on disk. pip install modestpy does not download examples. It downloads only the modestpy package.

Therefore:

> git clone https://github.com/sdu-cfei/modest-py.git
> cd modest-py
> virtualenv -p python3 venv
> source venv/bin/activate
> pip install -e .
> python examples/simple/simple.py

Let me know if it helped.

@robot-army
Copy link
Author

robot-army commented Oct 15, 2021

OK great, I got it up and running in windows, but I'll try again under linux with these instructions.

As an aside, with my FMU and parameters I'm getting

C:\Users\rwhite\Anaconda3\lib\site-packages\pandas\core\arraylike.py:364: RuntimeWarning: overflow encountered in square
 result = getattr(ufunc, method)(*inputs, **kwargs)

or fmi2GetReal failed with status 3.quite regularly.

I'll try and sanitize my setup and make it into something that reproduces it reliably to post in a separate issue.

@krzysztofarendt
Copy link
Member

@robot-army , the overflow error means you are multiplying too large numbers (unable to save the result with a given number of bits). If your FMU works fine with the default parameters and fails during the parameter tuning in modestpy, then probably your parameter ranges are too large for this FMU. Try running modestpy with smaller parameter ranges.

I'm closing this issue as it seems the original problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants