If you set an environment variable via export in the terminal, it will only be set within this session. That is, if you open jupyter in a different terminal or by “clicking on the jupyter application”, the environment variable won’t be set there.
There are three ways around it.
-
As I mentioned before, just put
export JULIA_NUM_THREADS=6into your~/.bashrcor~/.zshrc(depending on your shell, seeecho $SHELL). This will “globally” set the environment variable such that it should be respected by all applications (including jupyter and julia itself) irrespective of how you start them. -
Start jupyter via the terminal as follows:
JULIA_NUM_THREADS=6 jupyter -
Create an IJulia kernel that automatically sets
JULIA_NUM_THREADSbefore it starts the kernel.
using IJulia
installkernel("Julia (6 threads)", env=Dict("JULIA_NUM_THREADS"=>"6"))