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

Load Error with getfieldspecs #128

Closed
francispoulin opened this issue Nov 4, 2020 · 21 comments
Closed

Load Error with getfieldspecs #128

francispoulin opened this issue Nov 4, 2020 · 21 comments
Labels
🐞 bug Something isn't working

Comments

@francispoulin
Copy link

I tried to run the barotropic QG example and unfortunately got an error in the first importing step.

Is this a known problem? I'm using julia 1.5.2, in case that helps.

https://fourierflows.github.io/GeophysicalFlowsDocumentation/dev/generated/barotropicqg_betadecay/

julia> import GeophysicalFlows.BarotropicQG
[ Info: Precompiling GeophysicalFlows [44ee3b1c-bc02-53fa-8355-8e347616e15e]
ERROR: LoadError: LoadError: UndefVarError: getfieldspecs not defined
Stacktrace:
 [1] include(::Function, ::Module, ::String) at ./Base.jl:380
 [2] include at ./Base.jl:368 [inlined]
 [3] include(::String) at /home/fpoulin/.julia/packages/GeophysicalFlows/mZXo8/src/GeophysicalFlows.jl:1
 [4] top-level scope at /home/fpoulin/.julia/packages/GeophysicalFlows/mZXo8/src/GeophysicalFlows.jl:13
 [5] include(::Function, ::Module, ::String) at ./Base.jl:380
 [6] include(::Module, ::String) at ./Base.jl:368
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:331 [inlined]
 [9] eval(::Expr) at ./client.jl:467
 [10] top-level scope at ./none:3
in expression starting at /home/fpoulin/.julia/packages/GeophysicalFlows/mZXo8/src/barotropicqg.jl:27
in expression starting at /home/fpoulin/.julia/packages/GeophysicalFlows/mZXo8/src/GeophysicalFlows.jl:13
ERROR: Failed to precompile GeophysicalFlows [44ee3b1c-bc02-53fa-8355-8e347616e15e] to /home/fpoulin/.julia/compiled/v1.5/GeophysicalFlows/xFqhg_lrx0p.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923
@glwagner
Copy link
Member

glwagner commented Nov 4, 2020

This is example is broken for me too, although the error I get is different than @francispoulin:

~/Projects/GeophysicalFlows.jl/examples$ julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.2 (2020-09-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("barotropicqg_betadecay.jl")
ERROR: LoadError: MethodError: no method matching Problem(::CPU; nx=128, Lx=6.283185307179586, β=10.0, μ=0.0, dt=0.05, stepper="FilteredRK4")
Closest candidates are:
  Problem(; nx, Lx, ny, Ly, dt, f0, β, eta, ν, nν, μ, stepper, calcFU, calcFq, stochastic, T, dev) at /Users/gregorywagner/.julia/packages/GeophysicalFlows/i9qG7/src/barotropicqg.jl:34
Stacktrace:
 [1] top-level scope at /Users/gregorywagner/Projects/GeophysicalFlows.jl/examples/barotropicqg_betadecay.jl:45
 [2] include(::String) at ./client.jl:457
 [3] top-level scope at REPL[1]:1
in expression starting at /Users/gregorywagner/Projects/GeophysicalFlows.jl/examples/barotropicqg_betadecay.jl:45

julia> 

@glwagner
Copy link
Member

glwagner commented Nov 4, 2020

It's a bit perplexing, because presumably the example is run to generate the documentation. I'm not sure what's happening.

@glwagner
Copy link
Member

glwagner commented Nov 4, 2020

@francispoulin your error may arise because you are trying to run the example with a different version of GeophysicalFlows than what you've cloned from github.

Try navigating to examples/ and typing

julia --project

and then

julia> include("barotropicqg_betadecay.jl")

@glwagner
Copy link
Member

glwagner commented Nov 4, 2020

Oh my. The Manifest.toml in the examples is extremely outdated.

Ok, it's on users to keep this updated.

@glwagner
Copy link
Member

glwagner commented Nov 4, 2020

@francispoulin I think the issue is unfortunately partly due to the fact that we don't provide a Manifest.toml which means that your environment can drift even when you're on the master branch of the git repo.

Let me know if these steps solve it for you:

  1. Navigate to the root directory, eg /GeophysicalFlows.jl/.
  2. Type git checkout master; git pull.
  3. Open julia with the project's environment: julia --project.
  4. Within julia, update the Manifest.toml file by typing julia> using Pkg; Pkg.update().
  5. Now try running the example by typing julia> include("examples/barotropicqg_betadecay.jl").

This sequence of steps worked for me.

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

I'll streamline the process!
Thanks @francispoulin for pointing this out.

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

@glwagner, did you follow what the examples Readme suggests?

Perhaps we should update that also + add some basic instructions in the Docs.

@francispoulin
Copy link
Author

Thanks for all the feedback.

First, I did go to examples and try julia --project and then the inclue but that gave the same error.

Second, I verified I was on master and pulled. No changes. The updating worked fine and including command does work without any error. And the annimation works great! Unfortunately, I can't view ti using vlc but mplayer works fine in ubuntu.

Also, when I try the first commands in the script, which failed before, they work fine now.

Do I gather that the problem was that my package was not update date? If I was supposed to udpate something, sorry for not trying that before.

I will keep this open in case you two feel like something needs to be modified. But if you like I'm happy to close it.

@navidcy navidcy added the 🐞 bug Something isn't working label Nov 4, 2020
@francispoulin
Copy link
Author

Maybe I should have said that the following command, which didn't work before, does work now.

import GeophysicalFlows.BarotropicQG

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

Could you print the output of

using Pkg; Pkg.status()

@francispoulin
Copy link
Author

Sure thing:

julia> using Pkg; Pkg.status()
Status `~/.julia/environments/v1.5/Project.toml`
  [7a1cc6ca] FFTW v1.2.4
  [2aec4490] FourierFlows v0.6.3
  [44ee3b1c] GeophysicalFlows v0.8.0
  [da04e1cc] MPI v0.15.1
  [91a5bcdd] Plots v1.7.3
  [37e2e46d] LinearAlgebra
  [de0858da] Printf
  [9a3f8284] Random

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

The problem was the the BarotropicQG module was importing an old, now deprecated, function from FourierFlows.jl package (named getfieldspecs). I've removed this import but have forgotten to make a new patch release of GeophysicalFlows.jl package. So when you did

] add GeophysicalFlows

you installed the latest released version of GeophysicalFlows and it wasn't working. When you followed @glwagner steps you installed the version on master...

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

An "easy" fix for now is to do

add GeophysicalFlows#master

until I make a new release. Sorry for that :)

@francispoulin
Copy link
Author

Ah, I guess adding what you suggest above is a good fix for now.

When I know it's been fixed I will add the regular version without #master.

@francispoulin
Copy link
Author

I tried removing the old package and then adding the master version and both have an Error.

(GeophysicalFlows) pkg> remove GeophysicalFlows
ERROR: The following package names could not be resolved:
 * GeophysicalFlows (not found in project or manifest)


(GeophysicalFlows) pkg> add GeophysicalFlows#master
   Updating git-repo `https://github.com/FourierFlows/GeophysicalFlows.jl.git`
ERROR: package `GeophysicalFlows [44ee3b1c]` has same name or UUID as the active project

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

Seems you have activated the repo's project now. I guess you started julia with julia --project from the your GeophysicalFlows.jl local repo folde. Notice that

(GeophysicalFlows) pkg>

So in that case, the GeophysicalFlows will be the version in the local repo you cloned.

Boy... it's not as easy as I would have thought for people to run the examples :(

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

(Perhaps, some of the confusions that I may have created about "activated project" can be alleviated via julia's docs...)

@francispoulin
Copy link
Author

Thanks for the link @navidcy . That was helpful.

I'm used to using virtual environments in python, and I guess I created one without realizing it. Good to know.

I left Julia, re-entered and saw that I was in the (@v1.5) so I guess I am in a "normal" environment now, not virtual.

I then managed to rm GeophysicalFlows, even though I might not have had to, and then added GeophysicalFlows#master, as suggested. That worked.

Then, I coudl import GeophysicalFlows.BarotropicQG, without a problem

That was a bit of a steap learning curve but I am glad to have learned it and hope not to make that mistake again. But will certainly make others.

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

I'll try to add some more clarifications in the docs and I may ping you to give me your opinion whether they are clearer :)

@francispoulin
Copy link
Author

I am happy to help and please ask. I am a novice now so a good target audience.

@navidcy
Copy link
Member

navidcy commented Nov 4, 2020

v0.8.1 was released and that should have dealt with this issue; I'm closing it in favour of #132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants