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

UndefVarError: @profview not defined #171

Closed
bardo84 opened this issue Jul 26, 2021 · 4 comments · Fixed by #172
Closed

UndefVarError: @profview not defined #171

bardo84 opened this issue Jul 26, 2021 · 4 comments · Fixed by #172

Comments

@bardo84
Copy link

bardo84 commented Jul 26, 2021

Hi,
when running the package example, I get the following error

`
julia> using ProfileView

julia> @profview profile_test(1) # run once to trigger compilation (ignore this one)
ERROR: LoadError: UndefVarError: @profview not defined
in expression starting at REPL[10]:1
`

(@v1.6) pkg> st ProfileView StatusC:\Users\xxx.julia\environments\v1.6\Project.toml`
[c46f51b8] ProfileView v0.6.10

help?> @profview
No documentation found.

Binding @profview does not exist.
`

@timholy
Copy link
Owner

timholy commented Jul 26, 2021

@bardo84 I am guessing you're using VSCode. If so, see #172.

Out of curiousity, which Julia version are you using? If you use 1.6 (highly recommended) it gives you an error

julia> @profview sum(1:5)
WARNING: both ProfileView and VSCodeServer export "@profview"; uses of it in module Main must be qualified
ERROR: LoadError: UndefVarError: @profview not defined

which seem fairly clear if you know what "qualified" means. But I'm guessing you must be using an older Julia that isn't as helpful?

@bardo84
Copy link
Author

bardo84 commented Oct 1, 2021

Hi,
sorry, have a problem with github notifications.

if you know what "qualified" means.

Well, I don't and did not understand the Julia doc from its search with qualified main. Guessing: in a function, not main, ..

the example was run on 1.6. But get the same when running the full example on 1.7:

function profile_test(n)
     for i = 1:n
         A = randn(100,100,20)
         m = maximum(A)
         Am = mapslices(sum, A; dims=2)
         B = A[:,:,5]
         Bsort = mapslices(sort, B; dims=1)
         b = rand(100)
         C = B.*b
     end
 end
 
 using ProfileView
 @profview profile_test(1)  # run once to trigger compilation (ignore this one)
 @profview profile_test(10)
julia> 

ERROR: LoadError: UndefVarError: @profview not defined   
in expression starting at o:\Julia\ProfileView_test.jl:15
in expression starting at o:\Julia\ProfileView_test.jl:15

But maybe most important

I am guessing you're using VSCode. If so, see #172.

Yes - Still open?

@bardo84
Copy link
Author

bardo84 commented Oct 1, 2021

put the whole in a module, runs under VScode!

@bardo84 bardo84 closed this as completed Oct 1, 2021
@timholy
Copy link
Owner

timholy commented Oct 1, 2021

Qualified means "qualified by module": ProfileView.@profview vs VSCodeServer.@profview.

timholy added a commit that referenced this issue Oct 9, 2021
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

Successfully merging a pull request may close this issue.

2 participants