IJulia problem?

Hello,

I created a package called GeometriaPlana at my projects. In the iteractive terminal this dev project run perfectly, but at Jupyter via IJulia, this project throw an error.

ArgumentError: Package GeometriaPlana [d1eaa649-aac2-5819-91da-40fa014b2dd7] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.


Stacktrace:
  [1] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1920
  [2] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1806
  [3] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
  [4] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1797
  [6] macro expansion
    @ Base ./loading.jl:1784 [inlined]
  [7] macro expansion
    @ Base ./lock.jl:267 [inlined]
  [8] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1747
  [9] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
 [10] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
 [11] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1740

This problem happen when I do the command using GeometriaPlana at Julia version 1.10.0 only via Jupyter Notebook.

At the terminal, all works perfectly:

(@v1.10) pkg> status
Status `~/.julia/environments/v1.10/Project.toml`
  [d1eaa649] GeometriaPlana v0.0.9 `../../../git/julia/geometriaplana`
  [7073ff75] IJulia v1.24.2
  [ed5c6046] Matematica v0.1.4 `../../../git/julia/matematica`

(@v1.10) pkg> resolve
  No Changes to `~/.julia/environments/v1.10/Project.toml`
  No Changes to `~/.julia/environments/v1.10/Manifest.toml`

(@v1.10) pkg> build
    Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/51cab8e982c5b598eea9c8ceaced4b58d9dd37c9/build.log`
    Building IJulia → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/47ac8cc196b81001a711f4b2c12c97372338f00c/build.log`

julia> using GeometriaPlana

But the problem still persists at Jupyter Notebook.

Do someone knows this problem? I noticed this problem at others dev projects too, this is only a example.

Possibly you are running your notebook in a different environment. You can install a different IJulia kernel with a --project=/some/path argument to use a specified environment.

Hi @stevengj ,

I installed IJulia only with:

(@v1.10) pkg> add IJulia
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.10/Project.toml`
  No Changes to `~/.julia/environments/v1.10/Manifest.toml`

(@v1.10) pkg> build
    Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/51cab8e982c5b598eea9c8ceaced4b58d9dd37c9/build.log`
    Building IJulia → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/47ac8cc196b81001a711f4b2c12c97372338f00c/build.log`

And I runned Jupyter with:

$ jupyter notebook

So I think I’m running at default enviroment (not virtual env.).

Now, I noted that if I copy the notebook to another folder, the code runs, but why?

Guys,

I discovered a new fact. Every time I change the dev code, the problem happen.

So, I tried to recompile the code via terminal, with the command:

(@v1.10) pkg> build
    Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/51cab8e982c5b598eea9c8ceaced4b58d9dd37c9/build.log`
    Building IJulia → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/47ac8cc196b81001a711f4b2c12c97372338f00c/build.log`
Precompiling project...
  1 dependency successfully precompiled in 2 seconds. 160 already precompiled.

And the code can be runned at Jupyter Notebook.

This Conda dependency, I don’t know why it’s here. Is IJulia creating a virtual env? What package has this dependency?

IJulia will install its own miniconda version by default, see:

https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-IJulia

As explained in the IJulia manual,

The default Jupyter kernel that is installed by IJulia starts with the Julia command line flag --project=@.. A Project.toml (or JuliaProject.toml) in the folder of a notebook (or in a parent folder of this notebook) will therefore automatically become the active project for that notebook. Users that don’t want this behavior should install an additional IJulia kernel without that command line flag (see section Installing additional Julia kernels).