Using QuantEcon lectures in Julia

Dear all,

I am new to computational economics, and am deciding between using Python and Julia.

I tried to use some code from the lectures in Julia 1.6.1 but the Kernel keeps failing. It says that it has ‘Failed to start kernel’ and has an ‘unhandled error’. Here are the details:

Traceback (most recent call last):
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/web.py”, line 1704, in _execute
result = await result
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/notebook/services/sessions/handlers.py”, line 69, in post
model = yield maybe_future(
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 762, in run
value = future.result()
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/notebook/services/sessions/sessionmanager.py”, line 98, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 762, in run
value = future.result()
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/notebook/services/sessions/sessionmanager.py”, line 110, in start_kernel_for_session
kernel_id = yield maybe_future(
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/tornado/gen.py”, line 762, in run
value = future.result()
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/notebook/services/kernels/kernelmanager.py”, line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/jupyter_client/multikernelmanager.py”, line 186, in start_kernel
km.start_kernel(**kwargs)
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/jupyter_client/manager.py”, line 341, in start_kernel
self.kernel = self._launch_kernel(kernel_cmd, **kw)
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/jupyter_client/manager.py”, line 249, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/site-packages/jupyter_client/launcher.py”, line 132, in launch_kernel
proc = Popen(cmd, **kwargs)
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/subprocess.py”, line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/Users/rdmorgan/opt/anaconda3/lib/python3.8/subprocess.py”, line 1706, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia’

Can anyone advise about how to get things working in the latest version of Julia. And are there views on whether Julia is preferable or not to Python, should I be able to get things up and running.

Side note: I did get things running in an older version of Julia 1.4.2 - but this didn’t seem to be too stable - it worked once and then didn’t seem to work again.

Best wishes,
Rowlando

Greetings! This issue doesn’t look specific to Julia’s quantecon lectures as far as I can tell.

Maybe consider reinstalling Julia 1.6 and then install the support for jupyter with ] add IJulia in the Julia repl.

If you can start off a fresh notebook with that, then great. If not then maybe the Julia discourse can help?

1 Like

As a side note, vscode support for Jupyter is progressing quickly. Later this month they are updating the Julia vscode extension to work with the jupyter extension for notebooks without any fragile conda setup steps…which you are running into here. See GitHub - julia-vscode/julia-vscode: Julia extension for Visual Studio Code and Working with Jupyter Notebooks in Visual Studio Code

But it will take a little time to work through!

1 Like

Thank you very much for you advice. I have done as you have advised. The problem now is that there is an error due to something called Grisu - something related to plotting that was in earlier versions but not 1.6.

If you’re able to advise on this then please do, it would be much appreciated. If not, I could raise it in a separate topic.

Thanks for letting me know…I was not aware of vscode prior to this. It’s certainly worth me checking this out as an alternative approach. Thanks again!

@Rowlando_Morgan Sorry for the delay in responding, but things should be working with 1.62 and the new release.

The jupyter notebook support that is native in vscode should be getting better over time (microsoft just put out a patch recently, and the julia vscode team is as well), but it isn’t something to rely on quite yet. Try it and submit bugs though!