The add packages lines cause a lot of problem
CaiYitao opened this issue · 9 comments
import Pkg
Pkg.activate(mktempdir())
Pkg.add([
Pkg.PackageSpec(name="Images", version="0.22.4"),
Pkg.PackageSpec(name="QuartzImageIO"),
Pkg.PackageSpec(name="PlutoUI", version="0.7"),
Pkg.PackageSpec(name="HypertextLiteral", version="0.5"),
Pkg.PackageSpec(name="ForwardDiff"),
Pkg.PackageSpec(name="NonlinearSolve"),
Pkg.PackageSpec(name="StaticArrays")
])
this cause a lot of problem, when opening the notebook every time it shows I need to add another packages, even though the packages do exists, these lines acutually does not add any packages to Julia, so it makes opening the notebook a pain.
Could you please do not add those lines in Notebook?
Thanks in advance
@YTCai: We need to add those lines so that everybody can use the notebook with the same versions of the packages, and for the online versions of the notebook.
You can open a notebook with a text editor to remove these lines from your local copy.
Which problems does it cause you?
1, When I open the notebook next time it requires me to add some new packages which is not listed in those lines. it works when opening at the first time and then problems arises after that.
2, after I delete those lines it requires to install packages which is already exists, but it said it is not in current path!
3, I have checked in Package REPL, like type "st", those packages are actually not added to Julia.
I have been using Pluto since Sept.2020 (fall 2020 computational thinking course) have not run into any such problem.
when adding packages, simpler lines like
using Pkg; Pkg.add(" Packages") works, but those complicated lines does not.
Thank you for prompt and kind reply, David, I love the course and learned a lot from you!
Julia has a global package installation cache. The command Pkg.add
just add package specifications to your currently activated list of packages, packages are only downloaded and installed if that version has never been installed before.
So your points 2 and 3 are the intended behavior. I am not sure what you mean with 1, can you be more specific about:
it requires me to add some new packages which is not listed in those lines
What do you mean with:
- it
- some new packages
- those lines
Hi Fons,
Thanks for your prompt reply.
For example:
The following are "those lines" ,
the first time is ok to use, but later when load the notebook it requires to add "QuartzImageIO" ( "some new packages")which it does not need when loading first time.
"It " means "notebook which have those lines".
import Pkg
Pkg.activate(mktempdir())
Pkg.add([
Pkg.PackageSpec(name="Images", version="0.22.4"),
Pkg.PackageSpec(name="ImageIO"),
Pkg.PackageSpec(name="PlutoUI", version="0.7"),
Pkg.PackageSpec(name="HypertextLiteral", version="0.5"),
Pkg.PackageSpec(name="ForwardDiff"),
Pkg.PackageSpec(name="NonlinearSolve"),
Pkg.PackageSpec(name="StaticArrays")
])