Can't install any packages with Pkg.jl

OS: MacOSX 12.6
Julia VersionInfo: Julia Version 1.8.5

Commit 17cfb8e65ea (2023-01-08 06:45 UTC)

After I typed “] add <package_name>” in REPL it will always return an Unsatisfiable requirements Error, for example this is to install “MLUtils”:

How to solve the problem?

To truly diagnose this we will need the output of the following command.

using Pkg
Pkg.status()
Pkg.status(mode=PKGMODE_MANIFEST)

The main issue is that you likely have too many packages in your environment creating a very complicated situation to solve.

The recommended work around is to use a distinct environment for each project. A temporary work around would be to create a temporary environment.

using Pkg
pkg"activate --temp"
pkg"add MLUtils"
1 Like

To expand on this, it is generally discouraged to use the default environment (in your case, @v1.8) for anything other than development- or interface- focused packages. Eg, my default environment has OhMyREPL, MiniLoggers, Revise, BenchmarkTools, and not much else.

Julia’s built-in support for distinct projects with their own package “environments” (a la virtualenv for python) is really great, I’d encourage you to use them. I’d also encourage you to check out https://modernjuliaworkflows.github.io/

3 Likes