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

Running OWENS in a python wrapper #16

Open
kevmoor opened this issue Feb 23, 2024 · 7 comments
Open

Running OWENS in a python wrapper #16

kevmoor opened this issue Feb 23, 2024 · 7 comments
Assignees

Comments

@kevmoor
Copy link
Collaborator

kevmoor commented Feb 23, 2024

No description provided.

@kevmoor
Copy link
Collaborator Author

kevmoor commented Feb 23, 2024

Desire is to run Julia functions directly in Python WEIS, see https://discourse.julialang.org/t/calling-julia-functions-from-python/6885/2

Would possibly still start with file dump, system run, and then read file

Need others to be able to run this easily.

@kevmoor kevmoor self-assigned this Feb 23, 2024
@kevmoor
Copy link
Collaborator Author

kevmoor commented Mar 1, 2024

This works, assuming you have julia and OWENS running. It took just a few minutes to implement.

# juliaup update
# pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install juliacall
from juliacall import Main as jl
from juliacall import Pkg as jlPkg

jlPkg.activate("../../../")  # relative path to the folder where `MyPack/Project.toml` should be used here 

jl.seval("using OWENS")

testdata = jl.OWENS.runOWENS(jl.OWENS.MasterInput("./sampleOWENS.yml"),"./").to_numpy()

@kevmoor
Copy link
Collaborator Author

kevmoor commented Mar 1, 2024

So, the next step is aligning the inputs and outputs with potential design optimization needs, which is being defined in #18

Need to review with NREL folks and then this should be completed.

@dzalkind
Copy link

dzalkind commented Mar 14, 2024

Hi Kevin,

I may need some on-line support with running this tomorrow. Here are a few things I've tried:

Running as-is give me:

ERROR: LoadError: ArgumentError: Package GyricFEA [3cd7cb04-a333-4aed-a1f1-c87982f3ae73] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

So, I added a jlPkg.instantiate() to the script.

Then, I get a

juliacall.JuliaError: expected package `PreComp [19f83dec]` to be registered
Stacktrace:

I tried several other things we can go over, but never get further than the PreComp registration notice.

Any ideas?

@kevmoor
Copy link
Collaborator Author

kevmoor commented Mar 15, 2024 via email

@dzalkind
Copy link

Okay, I made some progress on this:

Within the python script, I had to jlPkg.activate('/Users/dzalkind/.julia/environments/v1.9/Project.toml')

In chatting with @yqliaohk, I learned that she had installed several dependencies in developer mode. Perhaps that's also another source of our differences in set up?

@kevmoor
Copy link
Collaborator Author

kevmoor commented Mar 15, 2024

Great! Maybe, mine are in developer mode as well, so that could be it.

Also, I just pushed a patch to the dev branch of OWENS.jl that fixes the post processing errors. If you have a developer install of owens (cloned locally, cd path2directory/OWENS.jl, julia, ] dev .) then you can just pull and check out the branch and then it will use the branch.

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

No branches or pull requests

2 participants