Import the same package after activating new environment

The key concept here is an environment. One environment is always active. It’s the one shown by the pkg> prompt.

when you start Julia (unless you use certain command line switches) you activate the vX.X environment. Adding a package (or updating or resolve etc) essentially edits Project/Manifest.toml for that environment.

When you say you “usually ]up in the user depot” – well it doesn’t work that way. The depot contains all versions of all packages ever used (and not garbage collected due to unuse for some time). If you look inside packages in the depot dir, you will actually find copies of the package code.

If you want to work in project “Y”, then indeed you need to activate “Y” each time after starting Julia. Otherwise, the toml files from vX.X will be used to resolve dependencies.

I think the first entry in LOAD_PATH is Base.

It may be useful to read the section on package in Notes on the Julia language. Perhaps that reduces confusion a little.

1 Like