How to prevent removed packages from being updated in Julia? - julia

The question's title might seem confusing at first sight, but it's valid. I installed the Makie.jl package a while ago, then removed it successfully using pkg> rm Makie. Today I tried to update all the packages, if any are available, using pkg> up. But I got an exciting log:
...
Installed MLJ ────────── v0.18.6
Installed EvoTrees ───── v0.12.4
Installed Makie ──────── v0.18.1
Updating `C:\Users\Shayan\.julia\environments\v1.8\Project.toml`
[13f3f980] ↑ CairoMakie v0.9.0 ⇒ v0.9.1
[f6006082] ↑ EvoTrees v0.12.2 ⇒ v0.12.4
[e9467ef8] ↑ GLMakie v0.7.0 ⇒ v0.7.1
[add582a8] ↑ MLJ v0.18.5 ⇒ v0.18.6
[9eb5382b] ~ PkgDependency v0.2.0 `https://github.com/peng1999/PkgDependency.jl#master` ⇒ v0.2.0 `https://github.com/peng1999/PkgDependency.jl#master`
[91a5bcdd] ↑ Plots v1.35.4 ⇒ v1.35.5
Updating `C:\Users\Shayan\.julia\environments\v1.8\Manifest.toml`
[13f3f980] ↑ CairoMakie v0.9.0 ⇒ v0.9.1
[f6006082] ↑ EvoTrees v0.12.2 ⇒ v0.12.4
[e9467ef8] ↑ GLMakie v0.7.0 ⇒ v0.7.1
[add582a8] ↑ MLJ v0.18.5 ⇒ v0.18.6
[d491faf4] ↑ MLJModels v0.15.14 ⇒ v0.15.15
[ee78f7c6] ↑ Makie v0.18.0 ⇒ v0.18.1
[20f20a25] ↑ MakieCore v0.5.0 ⇒ v0.5.1
[91a5bcdd] ↑ Plots v1.35.4 ⇒ v1.35.5
Precompiling project...
59 dependencies successfully precompiled in 399 seconds. 431 already precompiled. 1 skipped during auto due to previous errors.
As you can see, I still get updates for Makie.jl, and its dependencies and core stuff. So I got suspicious if I indeed removed them or not. So I tried to check it using pkg> st Makie and pkg> rm Makie, and this is the result:
(#v1.8) pkg> st Makie
No Matches in `C:\Users\Shayan\.julia\environments\v1.8\Project.toml`
(#v1.8) pkg> rm Makie
ERROR: The following package names could not be resolved:
* Makie (ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a in manifest but not in project)
(#v1.8) pkg> rm MakieCore
ERROR: The following package names could not be resolved:
* MakieCore (20f20a25-4f0e-4fdf-b5d1-57303727442b in manifest but not in project)
So, according to this report, The Makie.jl package and its core still exist in the manifest file, leading to getting updates by Pkg for it and wasting much time for it to be precompiled while I don't want it at all! So the question is, "How to prevent removed packages from being updated in Julia?" or in other words, "How to remove a package permanently in Julia?"

In 1.9 there is a why command:
(#v1.9) pkg> why Makie
CairoMakie → Makie
So, it's used by CairoMakie which you have installed. If you rm CairoMakie too, I guess it will be gone.

Related

Cannot install PyCall.jl with Julia 1.6.3 build on FreeBSD 13

I am trying to install PyCall.jl but I get an error. I have installed (bulit) Python 3.10 in the FreeBSD 13. I also, have separately created a python 3.10 virtual environment on the OS from which, I intend to call python packages from. The error is as below.
(dataViz) pkg> add PyCall
Resolving package versions...
Installed VersionParsing ─ v1.2.1
Installed Conda ────────── v1.5.2
Installed MacroTools ───── v0.5.9
Installed JSON ─────────── v0.21.2
Installed PyCall ───────── v1.92.5
Updating `/usr/home/schroter/dataViz/Project.toml`
[438e738f] + PyCall v1.92.5
Updating `/usr/home/schroter/dataViz/Manifest.toml`
[8f4d0f93] + Conda v1.5.2
[682c06a0] + JSON v0.21.2
[1914dd2f] + MacroTools v0.5.9
[438e738f] + PyCall v1.92.5
[81def892] + VersionParsing v1.2.1
Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/299304989a5e6473d985212c28928899c74e9421/build.log`
Building PyCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4ba3651d33ef76e24fef6a598b63ffd1c5e1cd17/build.log`
ERROR: Error building `PyCall`:
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
ERROR: LoadError: Couldn't find libpython; check your PYTHON environment variable.
The python executable we tried was python3 (= version 3.10).
Re-building with
ENV["PYCALL_DEBUG_BUILD"] = "yes"
may provide extra information for why it failed.
Stacktrace:
[1] error(s::String)
# Base ./error.jl:33
[2] find_libpython(python::String; _dlopen::typeof(Base.Libc.Libdl.dlopen))
# Main ~/.julia/packages/PyCall/3fwVL/deps/buildutils.jl:72
[3] find_libpython(python::String)
# Main ~/.julia/packages/PyCall/3fwVL/deps/buildutils.jl:41
[4] top-level scope
# ~/.julia/packages/PyCall/3fwVL/deps/build.jl:82
[5] include(fname::String)
# Base.MainInclude ./client.jl:444
[6] top-level scope
# none:5
in expression starting at /home/schroter/.julia/packages/PyCall/3fwVL/deps/build.jl:43
The installed modules in Julia are as follows:
(dataViz) pkg> status
Status `/usr/home/schroter/.jlmain/dataViz/Project.toml`
[336ed68f] CSV v0.9.10
[54eefc05] Cascadia v1.0.1
[a93c6f00] DataFrames v1.2.2
[708ec375] Gumbo v0.8.0
[cd3eb016] HTTP v0.9.16
[c3e4b0f8] Pluto v0.17.1
[05625dda] WebDriver v0.1.2
EDIT:
My system wide python is at :/usr/local/bin/python3
My python virtual environment is at:~/.pymain/dataViz/bin/activate.csh
Would anyone be able to help me in this matter please?
Thanks & Best Regards
Schroter
You have not mentioned setting the PYTHON environment variable so this is the likely cause of problems:
ENV["PYTHON"]="/usr/local/bin/python3"
using Pkg
Pkg.build("PyCall")
For best results try use Miniconda/Anaconda Python, preferably let Julia install it (I do not know though how easy or difficult it is to install Miniconda on FreeBSD, on any Linux it usually "just works"):
ENV["PYTHON"]=""
using Pkg
Pkg.build("PyCall")
If you want to rather use some Miniconda:
ENV["PYTHON"]="/home/user/miniconda/bin/python"
using Pkg
Pkg.build("PyCall")
Let me know if this helped (I do not have a FreeBSD installation to test)

Julia "no method matching supports_default_copy_to(::GLPK.Optimizer, ::Bool)" declaring Model

I am new to Julia and tried to run the first example script in the Second Edition of Julia Programming for Operations Research, but the first two lines:
using JuMP, GLPK
m = Model(with_optimizer(GLPK.Optimizer))
throw the following error:
julia> m = Model(with_optimizer(GLPK.Optimizer))
ERROR: MethodError: no method matching supports_default_copy_to(::GLPK.Optimizer, ::Bool)
Closest candidates are:
supports_default_copy_to(::MathOptInterface.Utilities.AbstractModel, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/model.jl:693
supports_default_copy_to(::MathOptInterface.Utilities.MockOptimizer, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/mockoptimizer.jl:521
supports_default_copy_to(::MathOptInterface.Utilities.CachingOptimizer, ::Bool) at /home/mepstein/.julia/packages/MathOptInterface/C1XBe/src/Utilities/cachingoptimizer.jl:165
In case it's relevant, using JuMP, GLPK threw the following warning:
┌ Warning: Replacing module MathOptInterface
└ # Base loading.jl:942
And my versions are:
Julia: 1.3.1 (latest stable)
"GLPK" => v"0.12.0"
"JuMP" => v"0.20.1"
Issue solved by the book author at https://github.com/chkwon/jpor_codes/issues/4
Running ] up from the julia interpreter upgraded GLPK to 12.1 from 12.0. Interesting because I had just installed GLPK in the first place only a couple hours ago. In fact I'm not even sure I 'upgraded' the installed version; from the log it looks like ] up made certain config files consistent with the version that was already installed?
julia>
(v1.3) pkg> up
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Installed GLPK ─ v0.12.1
Updating `~/.julia/environments/v1.3/Project.toml`
[60bf3e95] ↑ GLPK v0.12.0 ⇒ v0.12.1
Updating `~/.julia/environments/v1.3/Manifest.toml`
[60bf3e95] ↑ GLPK v0.12.0 ⇒ v0.12.1
Building GLPK → `~/.julia/packages/GLPK/HjJiX/deps/build.log`
In any case, the code in the question above now works and gives the following output:
julia> using JuMP, GLPK
julia> m = Model(with_optimizer(GLPK.Optimizer))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: GLPK```

Julia package install fail with Please specify by known `name=uuid`

I have an error when trying to install any Julia package:
Pkg.add("Combinatorics")
Cloning default registries into `~/.julia`
Cloning registry from "https://github.com/JuliaRegistries/General.git"
Added registry `General` to `~/.julia/registries/General`
Resolving package versions...
ERROR: The following package names could not be resolved:
* Logging (56ddb016-857b-54e1-b83d-db4d58db5568 in manifest but not in project)
Please specify by known `name=uuid`.
What can be done to fix this?
I could fix this problem after the following two steps:
First: (not sure if absolutely needed)
rm(joinpath(homedir(), ".julia", "registries"); recursive=true)
Second: installing the package mentioned as missing in the error message:
Pkg.add("Logging")
Resolving package versions...
Installed MappedArrays ─────────── v0.2.2
Installed IntervalSets ─────────── v0.3.2
Installed PDMats ───────────────── v0.9.10
Installed ColorVectorSpace ─────── v0.7.1
etc
Then my Pkg install worked:
Pkg.add("Combinatorics")
Resolving package versions...
Installed Polynomials ─ v0.6.0
Updating `~/.julia/environments/v1.1/Project.toml`
[861a8166] + Combinatorics v1.0.0
Updating `~/.julia/environments/v1.1/Manifest.toml`
[861a8166] + Combinatorics v1.0.0
[f27b6e38] + Polynomials v0.6.0
julia> using Combinatorics
[ Info: Precompiling Combinatorics [861a8166-3701-5b0c-9a16-15d98fcdc6aa]

Julia: be sure to use dev version of a package

I'm developping a package that is also registered. So I have a version in my dev folder ("C:/Users//.julia/dev"), and I have also the most recent registered version installed as if I didn't develop it.
So my question is, how can I be sure to use the dev version when I need to ?
It appears that if I don't remove the registered version, it only uses this version instead of the dev one, even so I add my dev path to the load path of Julia.
You should use Pkg.develop and Pkg.free to move to and from development version of the package (or dev and free commands in pkg manager mode). Then you can use Pkg.status to see which version is currently active. Here is an example:
julia> Pkg.status("DataFrames")
Status `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
[a93c6f00] DataFrames v0.19.4
julia> Pkg.develop("DataFrames")
[ Info: Path `C:\Users\bogum\.julia\dev\DataFrames` exists and looks like the correct package, using existing path
Resolving package versions...
Updating `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
[a93c6f00] ↑ DataFrames v0.19.4 ⇒ v0.19.4+ [`C:\Users\bogum\.julia\dev\DataFrames`]
Updating `C:\Users\bogum\.julia\environments\v1.2\Manifest.toml`
[a93c6f00] ↑ DataFrames v0.19.4 ⇒ v0.19.4+ [`C:\Users\bogum\.julia\dev\DataFrames`]
[9a8bc11e] + DataStreams v0.4.2
julia> Pkg.status("DataFrames")
Status `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
[a93c6f00] DataFrames v0.19.4+ [`C:\Users\bogum\.julia\dev\DataFrames`]
julia> Pkg.free("DataFrames")
Resolving package versions...
Updating `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
[a93c6f00] ↓ DataFrames v0.19.4+ [`C:\Users\bogum\.julia\dev\DataFrames`] ⇒ v0.19.4
Updating `C:\Users\bogum\.julia\environments\v1.2\Manifest.toml`
[a93c6f00] ↓ DataFrames v0.19.4+ [`C:\Users\bogum\.julia\dev\DataFrames`] ⇒ v0.19.4
[9a8bc11e] - DataStreams v0.4.2
julia> Pkg.status("DataFrames")
Status `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
[a93c6f00] DataFrames v0.19.4
As you can see in status result you have an information which version of the package is used.
See also:
https://julialang.github.io/Pkg.jl/dev/managing-packages/#Developing-packages-1 (about developing packages)
https://julialang.github.io/Pkg.jl/dev/managing-packages/#Adding-registered-packages-1 (about reading status output)

Julia does not update its packages

I installed DifferentialEquations by using:
Pkg.add("DifferentialEquations")
Then I used the below line to check the version:
Pkg.status("DifferentialEquations")
It returns 1.0.0 while, it must be 4.0.0.
I tried Pkg.update() or Pkg.update("DifferentialEquations). However, the version is still 1.0.0 and re-installing Julia did not help neither.
What can be done to update the DifferentialEqautions package?
The version of Julia is 0.6.2.
Edit
This time I not only uninstalled Julia, but I also deleted its folder in appdata. After installing Julia again and adding the package, now it is up to date.
Have you tried :
Pkg.pin("DifferentialEquations",v"4.0.0")
You can force Pkg to find a solution by giving an explicit version.
For example, going from version 5 to version 6 of the DifferentialEquations package:
(TestProject) pkg> status
Status `/tmp/TestProject/Project.toml`
[0c46a032] DifferentialEquations v5.0.0
(TestProject) pkg> add DifferentialEquations#6.0.0
Resolving package versions...
Updating `/tmp/TestProject/Project.toml`
[0c46a032] ↑ DifferentialEquations v5.0.0 ⇒ v6.0.0
Updating `/tmp/TestProject/Manifest.toml`
[1520ce14] - AbstractTrees v0.2.1
[79e6a3ab] - Adapt v1.0.0
[4fba245c] ↓ ArrayInterface v2.3.1 ⇒ v0.1.1
[9e28174c] - BinDeps v1.0.0
...
(TestProject) pkg> status
Status `/tmp/TestProject/Project.toml`
[0c46a032] DifferentialEquations v6.0.0
The equivalent API syntax:
julia> import Pkg
julia> Pkg.add(Pkg.PackageSpec(; name="DifferentialEquations", version=v"6.0.0"))

Resources