code_prettify not working for Julia in Jupyter Notebook - jupyter-notebook

I am using Julia 1.8.4 in Jupyter, however, I get the following error message when I start it up.
[code_prettify] Sorry, can't use kernel language julia.
Configurations are currently only defined for the following languages: python, r, javascript
See readme for more details.
If I click "Ok", I am able to run the code in the cells but Jupyter does not highlight Julia code. It continues highlighting Python code and syntax. Is there a way I can fix this?
Or could someone refer me to the documentation?

Like the error message indicates, code_prettify only has configurations inbuilt for Python, Javascript, and R. From the docs:
Example implementations are provided for prettifiers for ipython, ir and ijavascript kernels which should work out of the box ...
Other languages may be added as defaults in the future
Support for Julia is yet to be added, hence the error message.
That said, code_prettify is only needed if you want to reformat your code (semi-)automatically. Syntax highlighting should work regardless, without any extension, and based on my testing, it does. Loading a notebook with a Julia kernel, the error message appears in the console, but the code is syntax-highlighted as usual.
So, if the syntax highlighting problem persists across notebook restarts, the issue must be with some other part of your notebook setup.

Related

Jupyter notebook spell checker with suggestions

I am running jupyter via anaconda in a web browser on windows. In nbextensions: I have tried,
calico-spell-check,
calico-spell-check,
spellchecker/main.
All highlight misspelled words fine but none suggest correct words.
Am I missing a set up step, my google fu is letting me down. Is there another extension that works as expected. I find it hard to believe that there is no true spell checker / corrector extension for a system designed around presenting of data, I must be missing a set up step or fundamental understanding of the system.
From what I've seen, such as this you just get highlighting in the classic Jupyter notebook interface. The limitations of what can be done with that interface is one of the reasons the current path forward for Jupyter development is JupyterLab and efforts based on similar underlying modern machinery, i.e., notebook version 7 is intended to look like the classic notebook interface while being based on the more modern components.
JupyterLab has spell check with suggestions available already added for editing markdown cells and editing markdown documents, see here. You can try it out in your browser now by going here and clicking launch binder to bring up a session where the extension is already installed and working.
For code, JupyterLab already has a nice autocomplete implementation that you'll get when you start typing a word and press tab to see suggestions. Additionally, some ideas have been offered for extending the current spell checking extension for JupyterLab to handle code cells, see tracking for this issue.

Julia's execution using Juno gets blocked because of not being able to access the console

In another question:
Juno IDE for Julia, how to interact?
One of the answers stated:
You can't enter commands into the console in Juno--that's for displaying output. Commands can be submitted from within the editor by setting your cursor in the line to submit and pressing Ctrl+Enter or Shift+Enter. The value will then be displayed in a small popup next to the line and the output will be printed to the console if you have the console visible.
Note that the inability to use the console as you desire is by design. See here for information about the console from the Juno docs.
I am encountering an issue that might make this design decision a bit impractical at times.
First, let me say that I am new to Julia and Juno (not to coding, just trying to learn Julia now), so there might be a way to fix this and I do not know about it.
I am using the package RCall, that allows to include R code into Julia, so I am trying to install some R packages. One of the packages is asking me a "y/n:" question and I cannot answer it because I cannot access the console, and sending code from the editor to the console using command+Enter is blocked (because the console line is executing).
To reproduce this issue (note that R 3.2.0 or above needs to be installed, and I had to restart Juno after installing RCall for it to work):
Pkg.add("RCall")
Pkg.build("RCall")
restart Juno
using RCall
reval("install.packages(\"rgdal\")")
A pop-up will appear asking to select a mirror, just choose 0 and OK. Then the package is asking me if I want to install some dependencies "y/n:" and the whole execution is blocked.
I guess that this can be fixed just by using Julia from the command line (and forgetting about Juno), but I like to use IDEs.
Do you have any ideas about how to circumvent this issue? or another IDE for Julia?

Trouble trying to run code comprised of many files

I recently began a project that consists of running simulations of cells. I am very new to programming and completely new to julia. I have to run this code written in julia. I downloaded the language in the juno bundle found here. I am running windows 8.1. I had previously installed the python anaconda bundle, and later installed python 3.5 because I read that it julia compiled in 3+ versions of python.
The problem is that when I attempt to use the code (use the evaluate or evaluate all commands), none of the files I run make the program do what it is supposed to. Often something is not defined, which I can sometimes fix if I run the files that define whatever wasn't defined, but I also get a bounds error (running the cell test file) and assorted other errors. I know that the code does work if run properly.
My question is: am I handling the code wrong and if so how should I run it, or is there something else going on that I am missing?

Input from STDIN in Light Table Juno

I recently came across with this awesome IDE, Juno for Julia. I have setup the IDE properly and it is successfully connecting to Julia. However, I'm facing with a small problem: How am I supposed to get data from STDIN in Juno using say, readline(STDIN)?
Appreciated!
Lighttable / Juno doesn't supply an input console. But the Julia REPL (command line version) does. I find it best to have both open. In asyncronous mode you can put trow-away code, shell commands (";") and command help ("?") in REPL and keep-code in Juno, and they share variables. You just can't run async in this case, since you want Juno to stop and wait.
On Windows default setting, you need to Evaluation -> Kill Julia
and then Ctrl+Space -> Julia: Connect to a running session. Leave out just '#async' when you want to wait for input.
If there is a better way already, I'd like to know too. Source: http://discuss.junolab.org/t/how-to-read-user-input-for-julia/110

How to pause Sweave Compilation in Rstudio to check variables

I've inherited a sweave file from a different author. I'd like to pause it after it finishes running the R code to interrogate the variables and see the objects in the console before it goes to PDF generation.
Is there a way to do this Rstudio conveniently? Or even in emacs if I must?
Thanks!
For debugging or checking Sweave documents, run the file through Stangle, e.g.
Stangle("a.rnw")
This produces a pure R-file, which you can debug separately. If the tangled files runs ok, but the Sweave'd does not, it is almost always due to some \Sexpr{} expression. These are difficult to locate, the error messages can be highly confusing.

Resources