I'm very new to vscode and have been using previously jupyter notebooks. The problem is that when I try to run julia in vs code, it doesn't find any of the packages that have been installed with jupyter. Do I have to reinstall everything or is there some way to fix this?
The julia code works, but not the packages.
1. Create a project in Julia REPL and activate it
in vs-code: install Julia
extension, then ctr+shift+P
, Julia: Start Repl
julia> cd("path/to/my/project/folder")
julia> pdw()
julia> ]
pkg> generate myProjectName
pkg> activate .
(myProjectName) pkg>
# hit backspace to go back to julia REPL promt
2. Install a package in the active project
You only need to do this once per package:
julia> ]
(myProjectName) pkg> add aPackageName
3. Check files
path/to/my/project/folder/Manifest.toml
path/to/my/project/folder/Project.toml
These files holds all package related infos for your project.
4. Organize Sourcecode
Suggestions:
*.jl
source-files in a sub-folder, eg ./src
.module
per file:module MyModule1
export function1, function2
include("./MyModule2.jl")
const A_CONSTANT_VALUE = "fooBar"
function function1()
MyModule2.function3()
...
end
function function2()
...
end
...
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With