WebIO is not being detected by Jupyter Notebook - jupyter-notebook

I am trying to open a Jupyter Notebook file in classic Jupyter Notebook interface. I am attempting to create an interective app that uses Julia programming language in interactive codes. For that I am trying to use the Interact library, because I know it features things such as buttons, sliders, etc. It requires the WebIo extension to be installed. However, from what I have experienced so far, Jupyter notebook does not detect the WebIO extension.
I tried following the instructions at https://juliagizmos.github.io/WebIO.jl/stable/gettingstarted/ and at https://juliagizmos.github.io/WebIO.jl/stable/troubleshooting/not-detected/. In the last link I found that another extension needed to be install and I found more information in this link (https://juliagizmos.github.io/WebIO.jl/latest/providers/ijulia/). I tried executing this command in my Windows prompt and it had apperently been succesful. When executing the command suggested at the second link, I got an error in the Julia REPL saying that WebIO extension for Jupyter Lab must be installed through Python or Conda, which I had already done.
I am also a bit confused as to how I can check to see if the extension is enabled.
I believe the problem has to do either with the installation of IJulia or the pip installation of WebIO. I rarely use pip, so I don't know if I did it correctly.
Thank you.

Related

Has anyone been able to successfully run julia on a Jupyter notebook over ssh?

I've had so much trouble trying to install Julia and learn how to use it with jupyter over ssh (ssh for reasons that are to complicated to explain). I am unable to even install IJulia without error. I've followed steps from here and several other places with no luck. When I initially run Pkg.add("IJulia") it's able to install the dependencies but IJulia itself doesn't compile. I try running Pkg.build("IJulia") with no issue, but when I open a julia notebook, the kernel never actually runs. When I try to go back to the julia prompt and run using IJulia, I get errors like the following:
ERROR: LoadError: InitError: SystemError: opening file "[blabla]/mambaforge/envs/jul/share/julia/cert.pem": No such file or directory
and
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to [blabla]/mambaforge/envs/jul/share/julia/compiled/v1.7/IJulia/jl_yfN9Cx.
I've been suffering this for weeks. I feel like it shouldn't be this difficult to get into this language. Has anyone else had issues like this and been able to solve them?
Are you using Ubuntu? I encountered a similar problem in Ubuntu 20.04 recently. I wanted to install IJulia under an anaconda environment but faced the problem that the file {JULIA_DIR}/share/julia/cert.pem (in my case, this file has a path of /home/pc/anaconda3/envs/julia-workspace/share/julia/cert.pem).
The first reference I find on the internet is a solution on the julia discourse. (Actually there is a mistake in this answer, at least on my operation system, that the file that the symbolic link is created from, is /etc/ssl/certs/ca-certificates.crt , not /etc/ssl/certs/ca-certificates.crt )
The problem I faced at this time is that the file /etc/ssl/certs/ca-certificates.crt does not exist! How can it happens? I find this reference that guides me to generate the file ca-certificates.crt (by the way, you may need sudo to run the command update-ca-certificates, which updates the directory /etc/ssl/certs to hold SSL certificates and generates ca-certificates.crt)

Differences between various consoles in Python

I am trying to make run a script for webscraping. However, I feel the problem could be that I keep running the written script in the wrong console.
So far I could not really understand the differences between the consoles cmd and Anaconda Prompt. Anaconda Navigator looks rather like an administrative tool, but it seems still to make a difference for my code whether I use a terminal from there or not. Could anyone elaborate on that?
Much appreciated
cmd: command-prompt, that used to run our python script, especially for scripts with .py extension. Besides that, we can used to install python library
Anaconda Prompt: almost similar to cmd. But usually we used to open jupyter notebook or other console on Anaconda Navigator.
Anaconda Navigator: a GUI desktop application that is included in the Anaconda installation package. Through Anaconda Navigator, programmers can easily run and manage Conda packages, environments and channels without the need to use command prompt commands. Anaconda Navigator can search for packages in the anaconda cloud repository.
So, the difference depends on what we want to do. You can't judge the problem arises because of the wrong console. It depends on the error message that appears.
Suggestion: read the error message, and analyze or find a way to solve the problem

Using jupyter R kernel with visual studio code

For python jupyter notebooks I am currently using VSCode python extension. However I cannot find any way to use alternative kernels. I am interested in jupyter R kernel in particular.
Is there any way to work with jupyter notebooks using R kernel in VSCode?
Yes, it is possible. It just requires an additional configuration to connect with the R kernel in VSCode.
It's worth noting that, if you prefer, you can use the notebook in VSCode Insiders where there is native support for notebooks in many languages, including R.
If you're using Jupyter in VSCode, firstly install IRkernel (R kernel).
According to the docs, run both lines to perform the installation:
install.packages('IRkernel')
IRkernel::installspec() # to register the kernel in the current R installation
Now, you should:
Reload Window Ctrl + R
Type Ctrl + Shift + P to search for "Jupyter: Create New Blank Notebook"
Click on the button right below ellipsis in upper right corner to choose kernel
Switch to the desired kernel, in this case, R's
That's it!
Agreed with #essicolo, if you are 100% stuck on using vscode this is a no-go.
[About kernels] Sorry, but as of right now this feature is only supported with Python. We are looking at supporting other languages in the future.
Yeah, that's the case for now, even if you start an external server. I hate having to say that, as we really want to support more of the various language kernels. But we started out with a Python focus and we still are pretty locked into that for the near future. Polyglot support is coming, but it won't be right away
per Microsoft Employee IanMatthewHuff
https://github.com/microsoft/vscode-python/issues/5109#issuecomment-480097310
preface - based on the phrasing of your question, I am making the assumption that you are trying to perform IRkernel in-line execution from your text ide without having to use a jupyter notebook / jupyterlab.
That said, if you're willing to go to the dark side, there might be some alternatives:
nteract's Hydrogen kernel for Atom IDE - the only text ide that I'm aware of that still supports execution against IRkernel. I know, I know - it's not vscode but it's as close as you'll probably get for now.
TwoSigma's Beaker notebook - it's been a lonngggg time for me but this a branch of jupyter that used to support polyglot editing, I'm not sure if that's still supported and it seems like you aren't that interested in notebooks anyway.
#testing_22 it works with me too
just add some note from my experience
It will failed If you run IRkernel::installspec() from RStudio or from Jupyter Conda environment failed way
Please run this syntax with VSCode terminal
install.packages('IRkernel')
IRkernel::installspec()
The rest is same, please restart VSCode and select "R" kernel from VSCode

Why can't I connect to local runtime? Following google's tutorial gives me syntax errors

I'm running a topic modeling project and I need to run it on a much larger dataset (a 2GB xml file). The file won't upload to google drive and I decided to just try to run the code on my machine so because I need to run it faster as well. I decided to install Jupyter on my machine and tried to understand how to use my GPU on my local runtime I found another source here, where they provide a tutorial from google on how to connect to the local runtime:
How to make Jupyter Notebook to run on GPU?
However, the very first line of code there gave me a syntax error!
!pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
File "<ipython-input-2-77e87048a5d2>", line 2
jupyter serverextension enable --py jupyter_http_over_ws
^
SyntaxError: invalid syntax
I don't understand python code that well and I just want this thing to work. I don't know how to fix these syntax errors. I tried to run the other lines of code as well but all of them have syntax errors. I tried pasting that code to my original colab file on google colab and on my local copy on jupyter and it won't work.
The first line can be run either on a terminal or in python shell.
However, the second shell is to be run on a terminal and for this, of course, you need to have jupyter installed in your local system.
$ jupyter serverextension enable --py jupyter_http_over_ws
I was having this problem myself and saw this question unanswered. The above did the trick for me !

what is the ipython notebook "Terminals" menu option

I am running ipython notebook on my OSX machine and/or my ubuntu 14.04 machine. I am using ipython 3.0.0, and ipython (jupyter) notebooks.
When I start an ipython notebook, under New there is a terminal option, but it's unavailable for me.
I haven't been able to find any documentation on this feature, how to activate it or what it does.
The ipython notebook --help command doesn't mention it and I haven't found anything in the documentation either.
I haven't discovered the special keywords to search google for to get any information either.
What does this feature do? How do I activate it? Is there any documentation on this available?
IPython/Jupyter appears to support browser-based interactive terminal sessions. This is enabled on my machine by installing the terminado package with pip or conda. This fixes the "Terminals Unavailable" message on the drop-down, and lets me start up a (bash) terminal session in a new tab.
See this commit:
IPython on GitHub
Here's the code in Lib/site-packages/IPython/html/notebookapp.py responsible for this item (located the file by searching the source for "Terminals" case-sensitively):
def init_terminals(self):
try:
from .terminal import initialize
initialize(self.web_app)
self.web_app.settings['terminals_available'] = True
except ImportError as e:
log = self.log.debug if sys.platform == 'win32' else self.log.warn
log("Terminals not available (error was %s)", e)
As you can see, there should be a message in the console log specifying what went wrong (you may need to increase log verbosity with ipython notebook --log-level=<level> to see it). In my case, it said:
Terminals not available (error was No module named fcntl)
The html.terminal module that is being imported appears to provide a web-based IPython interactive console.
Support for Windows terminals with terminado dependency was added in Jupyter 5.3.0:
https://github.com/jupyter/notebook/pull/3087
Actually it's jupyter notebook 5.3.0, not jupyter. the two versions is not the same thing.
- jupyter --version
- jupyter notebook --version
I ever suffered from this.

Resources