When you create a new notebook Pluto puts it with a temporary name under ~\.julia\pluto_notebooks
So if you simply tried to create a new notebook and do
begin
import Pkg
Pkg.activate(".")
end
You would not be activating the path from where you started Julia, but the temporary pluto_notebook subfolder.
Try either saving the notebook inside your project folder, or giving the full path of your project to Pkg.activate().
It is best to use the built-in package management, then you just need to import / using external packages. Pluto automatically pins the versions for reproducibility.
You only need to manage Pkg environments on your own if you are using unregistered packages, local dev packages or specific package git branches. Instructions for these cases are given in the link posted by @disberd .
@lungben It would be nice to do that, however every time I start Pluto, it offers me to install everything, rather then using the local Project.toml. Is there anyway to use Plutoâs own package manager on already defined Project.toml
The built-in package manager has the Project.toml and Manifest.toml integrated in the notebook.jl file. If the packages are already installed, Pluto does not re-install them, analogue to activating a Project.toml file (what is actually done under the hood).
To use an external Project.toml file see here: https://github.com/fonsp/Pluto.jl/wiki/đ-Package-management#pattern-the-shared-environment
Combining both approaches is not possible because it would be ambiguous.
Inside notebooks/notebook.jl I try to import Db but I canât get it to work. I tried adding
begin
import Pkg
Pkg.activate()
Pkg.instantiate()
end
and it does seem to install local packages but the using Db statement still doesnât work inside the notebook. In the classical Julia REPL this works for me.
Totally agree with the great advice given above. I also like using:
Pkg.activate(Base.current_project())
(included in the âshared environmentâ link @lungben shared above) if my notebooks are deeper down and I donât want to manually keep track of how many ../../ I need to do. Itâs my understanding that it has the same behavior as --project=@., which is super handy!
Ah OK I see whatâs wrong. My package name is Analyzer while in src I have multiple files, Analyzer.jl, Db.jl etc. So import Analyzer works while import Db doesnât. Same in your project. If I add src/Db2.jl then using Db2 wonât work.