Is there a Python-like virtualenv environment simulator for Julia where one can do development in a local, virtual environment?
Asked
Active
Viewed 1.1k times
39
-
I haven't come across anything like python's virtualenv, but you might be able to accomplish what you're looking for by setting the JULIA_PKGDIR environment variable. Have a look at what it does in the docs: http://docs.julialang.org/en/release-0.4/stdlib/pkg/?highlight=julia_pkgdir. – Chisholm Nov 22 '15 at 12:58
-
@Chisholm [This](http://docs.python-guide.org/en/latest/dev/virtualenvs/) is virtualenv, the one I have included as an example in the question – Dawny33 Nov 22 '15 at 13:00
-
Sorry, I should have been more clear. I meant to say that I haven't come across anything like python's virtualenv for Julia. – Chisholm Nov 22 '15 at 13:35
3 Answers
34
Currently (julia 1.2) is able to manage virual environments via it's builtin Pkg
standard library module:
julia> ]
(v1.2) pkg> activate tutorial
[ Info: activating new environment at `/tmp/tutorial/Project.toml`.
(tutorial) pkg>
(tutorial) pkg> status
Status `/tmp/tutorial/Project.toml`
(empty environment)
(tutorial) pkg> add Example
...
(tutorial) pkg> status
Status `/tmp/tutorial/Project.toml`
[7876af07] Example v0.5.1
There is Playground.jl
A package for managing julia sandboxes like python's virtualenv (with a little influence from pyenv and virtualenvwrapper)

HarmonicaMuse
- 7,633
- 37
- 52
-
4This answer should probably be no longer considered the best answer as i believe the best practice is to generate virtual environments through the standard library. – Francis Smart Nov 22 '19 at 17:00
20
Nowadays Julia has this built into its package manager. They're called environments. It boils down to this:
- Enter the package mangement REPL by hitting
]
- Use the command
activate $dir
to switch to the environment described in$dir
- Use the command
instantiate
to install the packages described in the environment
-
You can find a more in depth description here: https://docs.julialang.org/en/v1/manual/code-loading/#Environments-1 – BallpointBen Apr 19 '21 at 14:44
-3
What's wrong with just having a separate Julia installation in another directory? Then you just need to set the JULIA_PKGDIR environment variable appropriately, for the Julia setup you want to run.

a06e
- 18,594
- 33
- 93
- 169
-
**That** you need to manually set the environment variable. Delegate this responsibility. – Mayou36 Sep 30 '21 at 15:14