PageSourceSearch

https://www.bsc.es/supportkc/assets/js/57a60745.18bb60c6.js

js bsc.es collected 2026-09-24 08:44:54 UTC 13,893 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunksupportkc_new=self.webpackChunksupportkc_new||[]).push([[4257],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>d});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),s=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):p(p({},t),e)),a},c=function(e){var t=s(e.components);return n.createElement(o.Provider,{value:t},e.children)},k="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),k=s(a),u=r,d=k["".concat(o,".").concat(u)]||k[u]||m[u]||i;return a?n.createElement(d,p(p({ref:t},c),{},{components:a})):n.createElement(d,p({ref:t},c))}));function d(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,p=new Array(i);p[0]=u;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[k]="string"==typeof e?e:r,p[1]=l;for(var s=2;s<i;s++)p[s]=a[s];return n.createElement.apply(null,p)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},6520:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>p,metadata:()=>o,toc:()=>c});var n=a(87462),r=(a(67294),a(3905)),i=a(25137);const p={},l="English",o={unversionedId:"Nord4/Installing packages/Julia/english",id:"Nord4/Installing packages/Julia/english",title:"English",description:"Install Julia packages",source:"@site/docs/Nord4/Installing packages/Julia/english.md",sourceDirName:"Nord4/Installing packages/Julia",slug:"/Nord4/Installing packages/Julia/english",permalink:"/supportkc/docs/Nord4/Installing packages/Julia/english",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Espa\xf1ol",permalink:"/supportkc/docs/Nord4/Installing packages/Julia/castellano"},next:{title:"R packages",permalink:"/supportkc/docs/Nord4/Installing packages/R/"}},s={},c=[{value:"Install Julia packages",id:"install-julia-packages",level:2},{value:"Requirements to install packages",id:"requirements-to-install-packages",level:3},{value:"Check the &#39;Pkg&#39; package manager",id:"check-the-pkg-package-manager",level:4},{value:"Install and manage packages",id:"install-and-manage-packages",level:3},{value:"Install packages",id:"install-packages",level:4},{value:"Update/rebuild/prebuild packages",id:"updaterebuildprebuild-packages",level:4},{value:"Uninstall packages",id:"uninstall-packages",level:4},{value:"Undo/redo changes during a session",id:"undoredo-changes-during-a-session",level:4},{value:"Work with environments",id:"work-with-environments",level:3}],k={toc:c},m="wrapper";
1function u(e){let{components:t,...a}=e;return(0,r.kt)(m,(0,n.Z)({},k,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"english"},"English"),(0,r.kt)("h2",{id:"install-julia-packages"},"Install Julia packages"),(0,r.kt)("h3",{id:"requirements-to-install-packages"},"Requirements to install packages"),(0,r.kt)(i.ZP,{mdxType:"Reqs"}),(0,r.kt)("h4",{id:"check-the-pkg-package-manager"},"Check the 'Pkg' package manager"),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"Pkg")," is Julia's built-in package manager that handles operations like installing, updating and removing packages."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Load Julia in the session, for example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"$> module load julia/1.4.2\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Ensure you can run Julia from the command line:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"$> which julia\n/apps/JULIA/1.4.2/bin/julia\n$> julia --version\njulia version 1.4.2\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Access the interactive command-line ",(0,r.kt)("em",{parentName:"p"},"REPL (read-eval-print loop)")," with all built-in functions:"),(0,r.kt)("ol",{parentName:"li"},(0,r.kt)("li",{parentName:"ol"},'Open a Julia terminal, by executing the command "julia"'),(0,r.kt)("li",{parentName:"ol"},'Type "]"'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Show ",(0,r.kt)("em",{parentName:"p"},"REPL")," help:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> help\n")),(0,r.kt)("p",{parentName:"li"},"Or:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> ?\n")))),(0,r.kt)("h3",{id:"install-and-manage-packages"},"Install and manage packages"),(0,r.kt)("h4",{id:"install-packages"},"Install packages"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Install a package (along with all its dependencies):"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> add SomePackage         # Latest version\n(v1.4) pkg> add [email protected]     # Specific version\n(v1.4) pkg> add SomePackage#master  # Unregistered version\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Install multiple packages at once:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> add A B C D\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Install a package by specifying the ",(0,r.kt)("em",{parentName:"p"},"URL")," or local path to a ",(0,r.kt)("em",{parentName:"p"},"git")," repository:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> add https://github.com/SomeProject/SomeProject.jl\n")))),(0,r.kt)("h4",{id:"updaterebuildprebuild-packages"},"Update/rebuild/prebuild packages"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Update one or more packages:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> update SomePackage\n(v1.4) pkg> up SomePackage\n(v1.4) pkg> up A B C D\n(v1.4) pkg> update              # All packages\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Rebuild a specific package (along with all its dependencies recursively):"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> build SomePackage\n")),(0,r.kt)("admonition",{parentName:"li",title:"REMARK",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"Note that the build step is automatically run when a package is first installed."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Precompile a project (maybe you also want to pre-update all project dependencies):"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(julia) pkg> update; precompile\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},'"Pin" a package:'),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> pin SomePackage\n")),(0,r.kt)("admonition",{parentName:"li",title:"REMARK",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"A pinned package will never be updated, showing up on the stack with a 'pin' symbol."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},'"Unpin" a package:'),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> free SomePackage\n")))),(0,r.kt)("h4",{id:"uninstall-packages"},"Uninstall packages"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Uninstall one or more packages:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> remove SomePackage\n(v1.4) pkg> rm SomePackage\n(v1.4) pkg> rm A B C D\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Uninstall a package that only exists as a dependency:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> rm --manifest SomePackage\n")),(0,r.kt)("admonition",{parentName:"li",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This action will also remove all dependencies of the package in question.")))),(0,r.kt)("h4",{id:"undoredo-changes-during-a-session"},"Undo/redo changes during a session"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Undo the last change in the current project:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(julia) pkg> undo\n")),(0,r.kt)("admonition",{parentName:"li",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"Only the states of the current session are stored, up to a maximum of 50 states."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Undo the last changes since the last ",(0,r.kt)("em",{parentName:"p"},"undo")," operation we did:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(julia) pkg> redo\n")))),(0,r.kt)("h3",{id:"work-with-environments"},"Work with environments"),(0,r.kt)("p",null,"By default, Julia sets '~/.julia' as the base directory of the initial active project, where it will place the project's packages and configuration files."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Change default location of the initial active project:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"$> export JULIA_PROJECT=/path/to/some/julia/project\n$> julia\n")),(0,r.kt)("p",{parentName:"li"},"Or:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"$>
1 julia --project=/path/to/some/julia/project\n")))),(0,r.kt)("p",null,"It is easy to work with independent projects in Julia by using environments. On the other hand,\nwhen two projects use the same package in the same version, the content of this package is not duplicated."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Show active environment information:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> st [ --project ]    # Show packages added by yourself\n(v1.4) pkg> st --manifest       # Show all packages in the environment, including recursive dependencies\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Create a new environment or switch to an existing one:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(v1.4) pkg> activate /path/to/NewProject\n  Activating new environment at `/path/to/NewProject/Project.toml`\n\n(v1.4) pkg> activate /path/to/ExistingProject\n  Activating environment at `/path/to/ExistingProject/Project.toml`\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},'Another kind of thing that you can do "hot" is the following:'),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"julia> mkdir(\"MyProject\")       # In 'julia' mode\n\njulia> cd(\"MyProject\")          # In 'julia' mode\n\n(v1.4) pkg> activate .          # In 'pkg' mode\n\n(MyProject) pkg> st             # Note that the REPL prompt changed\n Status `Project.toml`          # As this is a newly created project,\n                                # the 'status' command shows that it contains no packages\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Return to the default environment:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"(SomeProject) pkg> activate\n  Activating environment at `~/.julia/environments/v1.4/Project.toml`\n\n(v1.4) pkg>\n")))))}u.isMDXComponent=!0},25137:(e,t,a)=>{a.d(t,{ZP:()=>l});var n=a(87462),r=(a(67294),a(3905));const i={toc:[{value:"Requirements to install packages networked (must have Internet access)",id:"requirements-to-install-packages-networked-must-have-internet-access",level:4}]},p="wrapper";function l(e){let{components:t,...a}=e;return(0,r.kt)(p,(0,n.Z)({},i,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h4",{id:"requirements-to-install-packages-networked-must-have-internet-access"},"Requirements to install packages networked (must have Internet access)"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Connect to ",(0,r.kt)("em",{parentName:"p"},"login0")," of Nord4:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},"mylaptop$> ssh {username}@n4login0.bsc.es\n")),(0,r.kt)("admonition",{parentName:"li",title:"IMPORTANT",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"The Nord4 ",(0,r.kt)("em",{parentName:"p"},"login0")," is restricted to BSC staff and is only accessible from the BSC internal network or the Virtual Private Network (VPN)."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Check the Internet connectivity from ",(0,r.kt)("em",{parentName:"p"},"login0"),", for example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre"},'$> wget --tries=3 --timeout=5 -q --spider google.com && echo "Networked" || echo "Non-networked"\nNetworked\n')))))}l.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.