Jupyter notebook MATLAB kernel: Runs, but does not display output - matlab

The issue is as shown in the image below. The kernel runs but the output is not displayed.
For installation, I followed the steps under 'Python side configuration' and 'MATLAB side configuration' here.
Have tried the following:
All other kernels work normally
The issue persists in both Firefox and Chrome
Edit: There were no issues in the installation of the python engine.
sudo python3 setup.py install
[sudo] password for tinkidinki:
running install
running build
running build_py
running install_lib
copying build/lib/matlab/engine/_arch.txt -> /usr/local/lib/python3.8/dist-packages/matlab/engine
running install_egg_info
Removing /usr/local/lib/python3.8/dist-packages/matlabengineforpython-R2020b.egg-info
Writing /usr/local/lib/python3.8/dist-packages/matlabengineforpython-R2020b.egg-info

Most likely your antivirus program is blocking the output (e.g. Adaware antivirus often causes this problem).
If this is not the case: sometimes the output is shown in the command prompt window instead of in the Jupyter notebook, check if this is the case.
Try restarting the kernel in kernel option (yup, more of a workaround...)

Related

Why has Jupyter notebook kernel stopped working after RStudio package installation

To date I have been using Jupyter Notebook to run R and sometimes Python code. I have also been using RStudio at times. Recently, while using RStudio, I was prompted to install some package (cannot exactly remember). At any rate, I installed this package. Dont know if only coincidence, but trying to run R in the notebook resulted in kernel not connecting. I found the same issue with Python, the Python kernel is also not connecting anymore.
Executing the below, I get;
(base) C:\WINDOWS\system32>jupyter kernelspec list
Available kernels:
ir C:\Users\Admin\AppData\Roaming\jupyter\kernels\ir
python3 C:\Users\Admin\anaconda3\share\jupyter\kernels\python3
How do I get Jupyter Notebook's kernels to work again.
Executing IRkernel::installspec() in R via Anaconda CMD prompt have resolved the issue. Note for others with this issue, you may be prompted to run install.packages(“rlang”) before.

Can't run CS50 command in VisualStudio code Terminal

Commands of CS50 are no more working anymore. I tried to redo steps of configuring SSH following the link https://cs50.readthedocs.io/github/#ssh , but I'm facing the message error present in the image below : CS50 command image error
After checking the documentation you provided and assuming it's what you followed,
https://cs50.readthedocs.io/projects/check50/en/latest/ states "Under Windows, please install the Linux subsystem. Then install check50 within the subsystem."
But in your picture you are using PowerShell (PS) so you can either start wsl from it by using the command wsl or you can open a new terminal from the vscode gui but make sure you selected wsl this time !

Can I execute a file (or some lines of python) within a running jupyterlab kernel for a notebook?

I've got a notebook that has got a bit unwieldy and I'm doing some refactoring which isn't fun.
I was wondering if it would be possible to execute code in this notebook from the command line for debugging.
Ideally, I would run something like:
run-in-jupyter $notebook file.py
and see the output from the command line. There is an interpreter in jupyterlab that can do this, so this make me think that it is possible.
I have a brief search but couldn't find much
How to run an .ipynb Jupyter Notebook from terminal? I explicitly don't want to do this (I want to run commands in an existing instace)
There is this library but this seems quite involved and some of the results I found on the internet where people not being able to use the library
jupyter console (pip install jupyter-console) connects to a running jupyter kernel from the kernel. Details on running kernels can be found amongst jupyter's run time files, on my box these live in ~/.local/share/jupyter/runtime. You can find the path to the kernel data file corresponding to an open workbook with %config IPKernelApp.connection_file which will look something like ~/.local/share/jupyter/runtime/kernel-55da8a07-b67d-4584-9ec6-f24e4a26cbbd.json.
You can then connect from the command line with
jupyter console --existing ~/.local/share/jupyter/runtime/kernel-55da8a07-b67d-4584-9ec6-f24e4a26cbbd.json
You can pipe commands into it as shown
echo h=87 | jupyter console --existing 55da8a07-b67d-4584-9ec6-f24e4a26cbbd 'h=57' --simple-prompt -y

Setting up jupyter kernel in remote VSCode notebook

I am trying to run some notebooks in my virtual environment in the VSCode (remotely connected). I install the venv as usual via python3 -m venv <venv-name>, activate it and install all the needed modules. When I run which ipython I get the one from the venv so I install the kernel via ipython kernel install --name "<name>" --user and it is successfully created in ~/.local/share/jupyter/kernels/ directory and the kernel.json points to the venv python. Then I open the VSCode and select both the Python: Select Interpreter and Jupyter: Select Interpreter to start Jupyter server to point to the virtual environment's python, sth. like .../<venv-name>/bin/python3.
However, when I try to run the cell it wants me to select kernel (I can also do it myself in the upper right corner of the VSCode), but my newly created kernel is not there. There are only two (same) ones from usr/bin/python.
It is really strange since twice in two days my kernel magically appeared for one notebook and worked as desired, but when I opened a new notebook, my kernel was gone again. I tried to remove/reinstall kernels, venvs, VSCode's Python and Jupyter extensions but nothing helped. Any suggestions?
For now, I start the kernel in remote command-line via jupyter notebook --no-browser --ip=<ip> and then insert the connection link to Jupyter Server in the bottom right corner of the VSCode status bar but am wondering if there is an easier way since all the stuff (except VSCode) is on a remote machine?
This way is not easy. You can set up Jupyter Kernel easily.
Firstly, using ssh to connect to the remote server.
Secondly, open Command Palette (⇧⌘P) and enter Python: Select Interpreter, you can directly connecting to remote kernel.
resource: https://code.visualstudio.com/docs/datascience/jupyter-notebooks

How do I install the Matlab MCR in Ubuntu 14.04 without "killing" Unity?

Background: I have created an Ubuntu VirtualBox from LAPP stack and added the Ubuntu desktop (Unity: sudo apt-get install ubuntu-desktop). Now I am attempting to install the MCR without loosing Unity.
Download MCR zip and extract to MCR_SOURCE
Go to my folder that contains the files: cd /media/sf_shared/MCR_ SOURCE
Change installer_input.txt file:
destinationFolder=/opt/MCR
agreeToLicense=yes
outputFile=/opt/install.log
mode=silent
product.MATLAB
product.MATLAB_Builder_JA
# Note: To find out the required toolboxes >> start Matlab >> run your code and find out which toolboxes were used with: license('inuse')
Install MCR: sudo ./install -inputFile /media/sf_shared/MCR_SOURCE/installer_input.txt >> success
Restart Ubuntu >> test whether Ubuntu’s Unity still exists >> everything is fine
Attention the next step will “ kill ” your Ubuntu desktop configuration!!! (i.e. copy your hardisk, anything you must do to recover quickly) – now configure: sudo gedit /etc/environment
LD_LIBRARY_PATH="/opt/MCR/v84/runtime/glnxa64:/opt/MCR/v84/bin/glnxa64:/opt/MCR/v84/sys/os/glnxa64:${LD_LIBRARY_PATH}"
XAPPLRESDIR="/opt/MCR/v84/X11/app-defaults"
# Note: X11/app-defaults folder has not been created during installation
Restart Ubuntu >> Unity is gone, recovery attempts such as deleting the above lines do not recover Unity; reinstalling the Ubuntu desktop does not help either.
I have tried an alternative route with exporting the variables, which also "kills" Unity. By the way this affects all users.
Any ideas?
It is not necessary to register these environment variables in /etc/environment, which means that the Unity sidebar will not be affected.
Instead register the environment variables temporarily either as local user or via sudo -i:
export LD_LIBRARY_PATH="/opt/MCR/v84/runtime/glnxa64:/opt/MCR/v84/bin/glnxa64:/opt/MCR/v84/sys/os/glnxa64:${LD_LIBRARY_PATH}"
export XAPPLRESDIR="/opt/MCR/v84/X11/app-defaults"
Now it is possible to run Matlab Apps without "killing" Ubuntu's desktop. For instance to run the Java compiled makesqr.m file.
java -classpath "/opt/MCR/v84/toolbox/javabuilder/jar/javabuilder.jar:/media/sf_shared/for_testing/makesqr.jar" makesqr.Class1 5
The Java package makesqr was created using Matlab's JavaBuilder tutorial. This was done on my Windows 7 machine, which runs Matlab R2014b.
Please ensure that the owner and permissions of the /opt/MCR and /media/sf_shared/for_testing folders are set correctly (see here for details).