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
Julia/CondaPkg.jl doesn't install a Julia package required by Python dependency #95
Comments
Yeah CondaPkg/JuliaPkg doesn't support recursive Julia -> Python -> Julia dependencies. It's too hard. I think the best solution right now is to add OpenMDAOCore as a dependency to OpenMDAO. |
Gotcha, thanks. To be clear, OpenMDAOCore.jl was always a dependency of OpenMDAO.jl. The error occurs when installing OpenMDAO.jl in an environment where OpenMDAOCore.jl isn't explicitly installed (i.e., where OpenMDAOCore.jl isn't in the environment's Project.toml). The solution I came up with was adding this to OpenMDAO.jl: function __init__()
PythonCall.pycopy!(om, PythonCall.pyimport("openmdao.api"))
Pkg.add("OpenMDAOCore")
PythonCall.pycopy!(omjlcomps, PythonCall.pyimport("omjlcomps"))
end which I think installs OpenMDAOCore.jl in the current environment just before attempting to import the python package omjlcomps. I'm fine with that solution, just want to make sure that's what you're suggesting. |
Oh I see! Even though OpenMDAOCore is a dep of OpenMDAO, if you install OpenMDAO into some other project, then You could use Edit: I'd recommend against stuff like calling |
Also, is it important to have these 3 separate packages. Could you instead have one |
Interesting, I haven't heard of
That's how it was set up originally, but it wasn't great for a couple of reasons. First, I think putting it all in one package would lead to a circular dependency:
So if all the Julia code was in just one package, omjlcomps would need OpenMDAO.jl, and OpenMDAO.jl would need omjlcomps. That actually seemed to work, though I would get scary warnings re: the OpenMDAO.jl module being loaded twice. Also, with the way things are right now, OpenMDAOCore.jl is a very lightweight dependency—actually has no dependencies other than Julia itself. So it allows Julia package developers to support OpenMDAO without messing around with the omjlcomps Python package, or Python at all, which is nice. |
All valid reasons. I think you can do something like Base.require(Base.PkgId("name", "uuid")) to import a specific package. |
Gotcha, I tried Base.require(Base.PkgId(Base.UUID("24d19c10-6eee-420f-95df-4537264b2753"), "OpenMDAOCore")) at both the top level of the "parent" package |
Big fan of PythonCall.jl, JuliaCall.jl, etc.. Thanks so much for these packages.
In my application, I have a chain of tools like this:
The problem: if I create a clean Julia environment and try to install OpenMDAO.jl, I get an error when I attempt to import OpenMDAO.jl. For some reason omjlcomps can't find OpenMDAOCore.jl. Here's what that looks like:
You also might be able to see the error from the AutoMerge workflow for the Julia General registry: https://github.com/JuliaRegistries/General/actions/runs/5244999369/jobs/9471800986?pr=85376.
I was able to work around this by just explicitly adding OpenMDAOCore.jl using Pkg in OpenMDAO.jl's
__init__()
:https://github.com/byuflowlab/OpenMDAO.jl/blob/892afe54b78dca25a6b66237ed24a584f5dc1c47/julia/OpenMDAO.jl/src/OpenMDAO.jl#L15
But I wonder if I'm doing something wrong, or if there's a better way?
The text was updated successfully, but these errors were encountered: