Local copy of MathJax on a Jupyter notebook - python

I´m using the new Jupyter notebook (neé ipython notebook) and the docs indicate that it renders MathJax from a CDN. I have some situations when outside connections are blocked, so I need to configure a local copy of MathJax for all notebooks. How can I accomplish that?

As of 4.0 mathjax is part of the notebook as a dependency. There is no need for any extra installation.
I am currently experimenting with jupyter on a RaspberryPi. After installation of python 3.4 and jupyter I found MathJax in:
/usr/local/lib/python3.4/site-packages/notebook/static/components/MathJax
from my jupyter_notebook_config.py file:
# c.NotebookApp.mathjax_url = ''
c.NotebookApp.enable_mathjax = True
Credits go to #minrk who clarified this to me!

On Arch Linux, installing 'community/mathjax' solves the problem.

Open any notebook and write:
From IPython.external import mathjax
Then you can read how to install by writing: 'mathjax?' but basically you execute a function 'install_mathjax()'. Haven't tried it though.

Related

How to install ExecuteTime extension of Jupyter notebook?

I installed Jupiter Notebook extensions according to https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html but the ExecuteTime one isn't working. It shows the message 'This nbextension is disabled in the notebook json config, but doesn't provide a yaml file to tell us how to configure it. You can still enable or disable it from here, though'. However, the folder execute_time in nbextensions contains file ExecuteTime.yaml. I am on MacOS.
Uninstall/reinstall doesn't help. I have looked for the answer across a lot of threads but there is no solution to this.
Does someone have a clue to that problem?
You should enable the execution time. For this:
pip install jupyterlab_execute_time
Then, reload the jupyterlab page.
Finally, go to the notebook section in jupyterlab advanced settings and paste:
{"recordTiming" : true,}
If it didn’t work visit: https://github.com/deshaw/jupyterlab-execute-time/tree/master/jupyterlab_execute_time

VS Code using Jupyter: Connecting to kernel: Python 3.6.9: Waiting for Jupyter Session to be idle

I am having trouble running my import statement in VS code Jupyter. I split them into individual cells. I find when I run
import numpy as np
the cell hangs and I get a message
Connecting to kernel: Python 3.6.9: Waiting for Jupyter Session to be idle
How do I fix this?
To solve it, I uninstalled the extension Jupyter notebook (which requires a reload), and then installed it.
This may be related to the extended version. I hope this article is helpful to you.
Alright so this one surprised me..
I was using Jupyter-like code cells "#%%" (see docs) to run jupyter notebook in VSCode. And I ran into the same issue as OP.
The error disappeared when I renamed my file, from "inspect.py" to "tmp.py".
I found my solution was to select the correct version of Python. I had 2 choices for Python 3.6.9. I chose the one called "base(Python 3.6.9)" which had a different location to "Python 3.6.9" and the base version worked. Something odd if going on here, maybe I should remove the other version?
For me, upgrading ipython to version 7.34.0 (from 7.32.0) fixed it. I'm using jedi version 0.18.1. Related
Update: this broke again for me when I upgraded my virtual environment to Python 3.8. I just upgraded my ipykernel package and now the notebook runs.

Jupyter Notebook is not showing the output of any Python code executed on the cell

I have downloaded Jupyter Notebook to practice coding Python. My issue is that when I execute any Python code, the Out [ ] cell will never display. I have explored disabling all my antivirus software, and the issue persists. Is there some setting I have accidentally enabled??
I have attached a picture to this post to illustrate the problem.
Thank you in advance for any suggested fixes; this has been very frustrating. Happy holidays,
Emma
There is no problem with the Jupyter Notebook, You are not printing any of the variables. Thast the reason it is not showing the output. Just add
print(c)
try python -m ipykernel install --user and then using the notebook again
In the jupyter notebook if you want to show the output you should to You must set the value to the print function
These 3 lines that you wrote are executed in this format in cmd and display the output
Thus row
pip install -U --ignore-installed psutil
From this topic
Apache Airflow ImportError: cannot import name '_psutil_linux'
is fix this bag for me

Why can't I use Pandas in Jupyter even with "Requirement already satisfied"

Hey there. So I'm trying to learn Python for data manipulation. Obviously pandas is needed. I am using Windows 10 and have installed Jupyter through the console. I have had no problem getting into the jupyter notebook on my localhost and running basic commands like print. However, I cannot use pandas for some reason. Any guidance of where to look would be appreciated.
Is this a new kernel? If so, !pip runs pip using the system environment, not the kernel environment. Delete the ! at the beginning.

unable to open jupyter notebook due to accent characters

I just installed Anaconda, which also install jupyter. I'm unable to run jupyter notebook on windows 8.1 command, because it seems to be using the default installation path for jupyter even though I explicitly set Anaconda to install in a different path.
The default path which jupyter is trying to load is C:\Users\Vinícius\.jupyter and I set Anaconda to install at C:\Vinicius. The first path has an accent, and the second doesn't.
When I try to run jupyter notebook or jupyter notebook --notebook-dir=C:\\Temp\\ or jupyter notebook --generate-config commands, they all fail due to the first path with an accent? What should I do to fix this?
The errors for jupyter notebook or jupyter notebook --notebook-dir=C:\\Temp\\ are:
Could not decode 'C:\Users\Vin\xedcius.jupyter' for unicode trait
'config_dir' of a NotebookApp instance.
According to this github issues python 2.7 have a lot of problem with non-ascii path.
I would recommend using python 3 who have less problem with that (according to the research I've made most people said using python 3 fixed the problem).
If you still need to use 2.7 for any reasons then according to the same github issues some people managed to use 2.7 with non-ascii path by changing some files.
Here is what they said:
I found the decision: in file
C:\Path\to\Lib\site-packages\jupyter_core\paths.py you need to append
.decode(sys.getfilesystemencoding()) at the line end:
in function get_homedir:
homedir = os.path.realpath(homedir).decode(sys.getfilesystemencoding())
in function jupyter_data_dir:
appdata = os.environ.get('APPDATA', None).decode(sys.getfilesystemencoding())
After that jupyter notebook started on my Windows!
While it may fix the problem I can't say if it won't cause other problem later.
Edit: I want to add that while there may be a lot of work around to avoid this error (changing the patch of config_dir for one without non ascii character?) if you have this problem in one case you may have it with other modules or command, switching to python 3 who handle it better would, I think, be easier.

Categories