Hi, I am using Ubuntu Linux 18.04.1 LTS. I just installed Julia version 1.0.0 and was trying to install the IJulia package to use Julia in a Jupyter Notebook environment. This resulted in the following error:
Pkg.add("IJulia")
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at none:0
The same error occurred when I tried to add the Atom package. Not sure what to do from here
You need import Pkg first. Or use the repl mode with ] and then add IJulia.
I am trying to build Julia 1.0.0 in Docker on Raspberry pi, and have the same error.
Unfortunately Import Pkg does not help in my case. I also was unable to install any package or IJulia specifically in REPL 1.0.0. Previous version 0.6.2 worked perfectly.
Here's a list of typical errors I've got:
root@e51fa3a09494:~/work# julia -e 'Pkg.add("IJulia")'
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at none:0
root@e51fa3a09494:~/work#
root@e51fa3a09494:~/work# julia -e 'import Pkg\ Pkg.add("IJulia")'
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
ERROR: MethodError: no method matching adjoint(::Nothing)
Closest candidates are:
adjoint(!Matched::Missing) at missing.jl:79
adjoint(!Matched::Number) at number.jl:193
adjoint(!Matched::LinearAlgebra.Adjoint) at /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.0/LinearAlgebra/src/adjtrans.jl:104
...
Stacktrace:
[1] \(::Nothing, ::Nothing) at ./operators.jl:536
[2] top-level scope at none:0
root@e51fa3a09494:~/work# julia -e 'using IJulia'
ERROR: LoadError: Blosc not installed properly, run Pkg.build("ZMQ"), restart Julia and try again
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] top-level scope at /home/jovyan/.julia/packages/ZMQ/ABGOx/src/ZMQ.jl:14
[3] include at ./boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1038
[5] include(::Module, ::String) at ./sysimg.jl:29
[6] top-level scope at none:2
[7] eval at ./boot.jl:319 [inlined]
[8] eval(::Expr) at ./client.jl:389
[9] top-level scope at ./none:3
in expression starting at /home/jovyan/.julia/packages/ZMQ/ABGOx/src/ZMQ.jl:13
ERROR: LoadError: Failed to precompile ZMQ [c2297ded-f4af-51ae-bb23-16f91089e4e1] to /home/jovyan/.julia/compiled/v1.0/ZMQ/CaaO6.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] require(::Module, ::Symbol) at ./logging.jl:311
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:389
[14] top-level scope at ./none:3
in expression starting at /home/jovyan/.julia/packages/IJulia/6sod5/src/IJulia.jl:36
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to /home/jovyan/.julia/compiled/v1.0/IJulia/nfu7T.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] require(::Module, ::Symbol) at ./logging.jl:311
root@e51fa3a09494:~/work# julia -e 'Pkg.build("ZMQ")'
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at none:0
root@e51fa3a09494:~/work# julia -e 'import Pkg \ Pkg.build("ZMQ")'
Building ZMQ → `~/.julia/packages/ZMQ/ABGOx/deps/build.log`
ERROR: MethodError: no method matching adjoint(::Nothing)
Closest candidates are:
adjoint(!Matched::Missing) at missing.jl:79
adjoint(!Matched::Number) at number.jl:193
adjoint(!Matched::LinearAlgebra.Adjoint) at /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.0/LinearAlgebra/src/adjtrans.jl:104
...
Stacktrace:
[1] \(::Nothing, ::Nothing) at ./operators.jl:536
[2] top-level scope at none:0
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using IJulia
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: IJulia not properly installed. Please run Pkg.build("IJulia")
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] top-level scope at none:0
[3] include at ./boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1038
[5] include(::Module, ::String) at ./sysimg.jl:29
[6] top-level scope at none:2
[7] eval at ./boot.jl:319 [inlined]
[8] eval(::Expr) at ./client.jl:389
[9] top-level scope at ./none:3
in expression starting at /home/jovyan/.julia/packages/IJulia/6sod5/src/IJulia.jl:45
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to /home/jovyan/.julia/compiled/v1.0/IJulia/nfu7T.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] require(::Module, ::Symbol) at ./logging.jl:311
julia> Pkg.build("IJulia")
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at none:0
julia> Pkg.add("IJulia")
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at none:0
julia>
md5-cd172fa9fd491dcd053dc8699f11edab
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(v1.0) pkg> add IJulia
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
(v1.0) pkg>
root@e51fa3a09494:~/work# julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using IJulia
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: IJulia not properly installed. Please run Pkg.build("IJulia")
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] top-level scope at none:0
[3] include at ./boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1038
[5] include(::Module, ::String) at ./sysimg.jl:29
[6] top-level scope at none:2
[7] eval at ./boot.jl:319 [inlined]
[8] eval(::Expr) at ./client.jl:389
[9] top-level scope at ./none:3
in expression starting at /home/jovyan/.julia/packages/IJulia/6sod5/src/IJulia.jl:45
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to /home/jovyan/.julia/compiled/v1.0/IJulia/nfu7T.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] require(::Module, ::Symbol) at ./logging.jl:311
Unfortunately
import Pkgdoes not help in my case.
You didn't do this in any of your examples though. You need e.g. julia -e 'import Pkg; Pkg.add("IJulia")'
Wow, silly me, it worked. Thank you!
Use
using Pkg
Pkg.add("IJulia")
kindly help to solve the below issue
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.2 (2020-05-23)
_/ |__'_|_|_|__'_| | Official https://julialang.org/ release
|__/ |
julia> using Pkg
julia> Pkg.add("IJulia")
Cloning default registries into C:\Users\venna\.julia
Cloning registry from "https://github.com/JuliaRegistries/General.git"
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffa21fdd501 -- strlen at C:WindowsSystem32msvcrt.dll (unknown line)
in expression starting at REPL[2]:1
strlen at C:WindowsSystem32msvcrt.dll (unknown line)
git_buf_puts at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
gitno_extract_url_parts at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
winhttp_stream_connect at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
winhttp_stream_read at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
git_smart__recv_cb at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
git_smart__store_refs at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
git_smart__connect at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
git_remote_fetch at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
git_clone at C:Usersvennajuliajuliabinlibgit2.DLL (unknown line)
macro expansion at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4LibGit2srcerror.jl:99 [inlined]
clone at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4LibGit2srcrepository.jl:459
clone##kw at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4LibGit2srcLibGit2.jl:559 [inlined]
clone##kw at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcGitTools.jl:127 [inlined]
mktempdir at .file.jl:680 [inlined]
mktempdir at .file.jl:680 [inlined]
clone_or_cp_registries at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:920
clone_or_cp_registries at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:911 [inlined]
clone_or_cp_registries at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:911 [inlined]
clone_default_registries at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:829
find_registered! at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:1176
registry_resolve! at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcTypes.jl:735
jfptr_#add#28_11384 at C:Usersvennajuliajulialibjuliasys.dll (unknown line)
add at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcAPI.jl:112
add at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcAPI.jl:109 [inlined]
add at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcAPI.jl:107 [inlined]
add at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4PkgsrcAPI.jl:106
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/srcjulia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/srcinterpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/srcinterpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/srcinterpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/srcinterpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/srcinterpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/srctoplevel.c:819
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/srctoplevel.c:769
jl_toplevel_eval at /cygdrive/d/buildbot/worker/package_win64/build/srctoplevel.c:828 [inlined]
jl_toplevel_eval_in at /cygdrive/d/buildbot/worker/package_win64/build/srctoplevel.c:848
eval at .boot.jl:331
eval_user_input at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4REPLsrcREPL.jl:86
macro expansion at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.4REPLsrcREPL.jl:118 [inlined]
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/srcjulia.h:1700 [inlined]
start_task at /cygdrive/d/buildbot/worker/package_win64/build/srctask.c:687
Allocations: 2504 (Pool: 2495; Big: 9); GC: 0
I think we updated LibGit2 for Julia 1.5. Could you try with the 1.5 beta (available from the standard Julia download page)?
@KristofferC Thank you for help now its working fine.....
Most helpful comment
You need
import Pkgfirst. Or use the repl mode with]and thenadd IJulia.