1. Environments in Julia
I recently started using Conda environments for Python in my Class and realized how simple and efficient it is to use them.
Unlike how I do things in Julia - for each new project, I just create a new environment, add the required packages, and start working - in Anaconda, you define a globally available set of environments that you can choose at runtime.
This reduces the redundant environments I make for projects that use the same packages. I don’t need to create a new environment, copy the package name list and install all packages again. I do not need another copy of the same environment. Instead, I can just choose the environment I want to work with from a list of environments that are available as a choice in all my projects.
How do I do this in Julia? Specifically in VSCode.
I know you can simply add the interpreter path to open the Julia environment at a particular location. But in VSCode, we can only see environments defined within our folder in hand - not a global set of environments. Is there a way to not have to navigate to my global environments folder each time to select an environment?
Would I need to create some folder of my own, say Julia-Environments
, create all my environments there, and then add its path to environment variables in Windows? Or would I need to add the path somewhere in VSCode? Or both? Is that how that may work?
2. State of Package Compilation
To speed up the load-time of my environments, I was looking into a way to store the compiled machine code that Julia creates each time on the first run. I simply want a way to initialize my environment each time with a specific plot that I can then work on further.
I came across a few compilation packages - PackageCompiler and CompilerTools (I swear I could see its documentation until a few days ago, but now it seems to be discontinued. Maybe I was viewing some other package. But I know there was some other package that had in its description that it is akin to PackageCompiler.jl but has a different method of saving the compilation - not images).
I tried working with PackageCompiler.jl, trying to compile the Example in their documentation, which just plots a handful of points and displays it.
@time using Plots
@time p = plot(rand(10), rand(10));
@time display(p);
ran create_sysimage(["Plots"], sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")
And it still hasn’t been compiled.
Assuming it does in the next few minutes, how would I even run things in VSCode with this? I read online that they got rid of the sysimage support from Julia Extention in VSCode, saying not many people use it now.
What do people do? Does Julia actually natively store the compiled code? Is Julia faster now? Is PackageCompiler unnecessary? How do I speed things up on the first runtime surely, each time I open a new session, the same plotting code is compiled again, taking a minute each time I try to start working?