# Simple Devcontainer vscode for Julia SciML + PyCall

**URL:** <https://discourse.julialang.org/t/simple-devcontainer-vscode-for-julia-sciml-pycall/117776>\
**Category:** General Usage\
**Tags:** vscode, developer-tools\
**Created:** [August 2, 2024, 10:45pm UTC](https://discourse.julialang.org/t/simple-devcontainer-vscode-for-julia-sciml-pycall/117776 "2024-08-02T22:45:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![msfz751](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@msfz751](https://discourse.julialang.org/u/msfz751)\
**Post date:** [August 2, 2024, 10:45pm UTC](https://discourse.julialang.org/t/simple-devcontainer-vscode-for-julia-sciml-pycall/117776/1 "2024-08-02T22:45:44Z")

</div>

I am exploring SciML with Julia and found that the best way to experiment with Julia advanced feature without touchingt the core OS was using Devcontainers via vscode. This could be useful for beginners.

This is is simplest Devcontainer I was able to build in 47 lines, and includes:

- Julia
- Quarto
- JupyterLab
- Essential SciML libraries
- Python 3 (to test PyCall)
- Examples

## Requirements

1. Docker
2. VS Code
3. VSCode Extensions: `Dev Containers`

## Files

### devcontainer.json

```julia-auto
{
	"name": "JuliaQuartoPycall",
	"image": "mcr.microsoft.com/devcontainers/base:ubuntu",

	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		// A Feature to install Julia via juliaup. More info: https://github.com/JuliaLang/devcontainer-features/tree/main/src/julia.
		"ghcr.io/julialang/devcontainer-features/julia:1": {
			"channel": "release"
		},
        "ghcr.io/devcontainers/features/common-utils:2": {
            "installZsh": "true",
			"configureZshAsDefaultShell": true,
            "username": "vscode",
            "upgradePackages": "true"
        },
    "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
		"version": "latest",
		"installTinyTex": false,
		"installChromium": false
		},
    // A comma separated list of Linux packages
    "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
		"packages": "libpython3-dev,python3-dev,python3-pip,qpdf"
	  }		
	},
	
	"onCreateCommand": "pip install --no-cache-dir jupyterlab jupyterlab-git jupyterlab-lsp notebook nbclassic nbconvert",
	"postCreateCommand": "julia ./.devcontainer/pkgs.jl",
	
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Configure tool-specific properties.
    "customizations": {
        "vscode": {
            "extensions": [
                "julialang.language-julia",
                "tamasfe.even-better-toml",
				"ms-python.python",
				"ms-toolsai.jupyter"
            ]
        }
    }	
	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}

```

### pkgs.jl

```julia-auto
using Pkg
# Pkg.add("BandedMatrices")
# Pkg.add("BenchmarkTools")
# Pkg.add("BlockBandedMatrices")
Pkg.add("ComponentArrays")
Pkg.add("Conda")
# Pkg.add("CSV")
# Pkg.add("Dates")
Pkg.add(["DataDrivenDiffEq", "DataDrivenSparse"])
# Pkg.add("DataFrames")
# Pkg.add("DelimitedFiles")
Pkg.add("DifferentialEquations")
# Pkg.add("Distributions")
# Pkg.add("Flux")
Pkg.add("ForwardDiff")
# Pkg.add("GLM")
# Pkg.add("HypothesisTests")
# Pkg.add(["Images", "ImageMagick"])
Pkg.add("IJulia")
# Pkg.add("IterativeSolvers")
# Pkg.add("JLD")
# Pkg.add("KernelDensity")
# Pkg.add("KrylovKit")
# Pkg.add("Libdl")
Pkg.add("LinearAlgebra")
Pkg.add("LineSearches")
# Pkg.add("LsqFit")
Pkg.add("Lux")
Pkg.add("MAT")
# Pkg.add("MatrixDepot")
# Pkg.add("Measurements")
# Pkg.add("Metalhead")
# Pkg.add("MLBase")
Pkg.add("ModelingToolkit")
Pkg.add("NonlinearSolve")
Pkg.add(["Optimization", "OptimizationNLopt", "OptimizationPolyalgorithms"])
Pkg.add(["OptimizationOptimisers", "OptimizationOptimJL"])
Pkg.add("OrdinaryDiffEq")
Pkg.add("NPZ")
Pkg.add("Plots")
# Pkg.add("Primes")
Pkg.add("PyCall")
# Pkg.add("Printf")
# Pkg.add("RData")
# Pkg.add("RDatasets")
Pkg.add("SciMLSensitivity")
# Pkg.add("SparseArrays")
Pkg.add("StableRNGs")
Pkg.add("Statistics")
# Pkg.add("StatsBase")
# Pkg.add("StatsPlots")
Pkg.add("SymPy")
# Pkg.add("Tables")
# Pkg.add("Test")
# Pkg.add("TSVD")
Pkg.add("UnicodePlots")
# Pkg.add("Unitful")
# Pkg.add("XLSX")
Pkg.add("Zygote")

# ENV["PYCALL_DEBUG_BUILD"] = "yes"

Pkg.build("IJulia")
Pkg.build("PyCall")
Pkg.precompile()

```

### File, folder structure

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/7/37629a654acbd3ef3bfb0cfe78e3601a71cf13bf.png)

## Installation

1. Create a folder, let’s say `julia-quarto-pycall`
2. Create a sub-folder `.devcontainer`
3. Copy the two files `devcontainer.json` and `pkgs.jl` under the sub-folder `.devcontainer`
4. Open the folder `julia-quarto-pycall` with VS Code
5. Press the green button on the bottom left corner of the IDE, and select “Reopen in Container”. That will start the building process.
6. Run any Julia file (.jl) or Julia Jupyter notebook (.ipynb) from the IDE.
7. That’s it

Link: [Dropbox](https://www.dropbox.com/scl/fi/cdp7zouzehyp9pcx6l4xr/julia-quarto-pycall.zip?rlkey=4d7djd0pvz18ci7wqf8mpbu2r&st=8v6vq2a7&dl=0)
