unable to execute .ipynb files from terminal - terminal

referring to this question
#minrk in his answer mentioned that
jupyter nbconvert --execute --to notebook --inplace <notebook>
would replace the existing notebook with the new output:
But when I tried executing the above command in the terminal I am getting an error. I have attached the relevant photos below.
Thanks in advance
ERROR:
This is my .ipynb file:

Related

Can not run jupyter notebook using anaconda promt

I used Anaconda prompt to run Jupyter notebook by command: jupyter notebook but get the error
'jupyter' is not recognized as an internal or external command, operable program or batch file.
How can I fix this? I try google but look like I'm the only one have this error.

Unable to open a new Jupyter notebook [Permission denied]

I have installed Jupyter Notebook on Windows 10. When I run the
jupyter notebook
command from cmd, the notebook dashboard opens in the browser. But when I try to create a notebook using the new>python3 option, I get an error message which says 'Permission denied.'
Please help me out.
You could use jupyter-lab --notebook-dir=%USERPROFILE% to always open in your home folder, which should have writable permissions
By default, Jupyter will use the directory where you started the command

Can't open Jupyter notebook from command prompt

I have always opened the jupyter notebooks from the Anaconda prompt. The problem is that whenever I try to open the Jupyter notebook from the command prompt, the following error is displayed:
Picture of the Error shown on my command prompt window
ImportError: DLL load failed: The specified module could not be found.
What am I doing wrong ? What should I do?
Opening Jupyter Notebook from command prompt is useful, especially when you would like to open the Jupyter Notebook from a specific folder.
The following 2 steps might help you to resolve this issue.
open command prompt
activate base
The prompt might change to begin with "(base)", which is expected. Then type,
Jupyter-notebook
If Jupyter notebook opens up now, this means Jupyter is correctly installed within your conda environment. In OS like Windows 10, it was an expected behavior not to recognize Python outside of Conda environment, which extends to Jupyter Notebook as well.
If the 1st step works properly, then add the below paths to your
environment variable. If you would not like to add the path to your
system environment variable, you can choose to update in your
account environment variable.
In windows 10 >> search "environments" and "Edit environment
variables for your account"
Select "PATH" and edit.
Add below paths
C:\Users\\Anaconda3;
C:\Users\\Anaconda3\Scripts;
C:\Users\\Anaconda3\Lib;
C:\Users\\Anaconda3\Library\bin;
C:\Users\\Anaconda3\Library\mingw-w64\bin;
Now you should be able to open Jupyter Notebook directly from command prompt.

Open new named jupyter notebook from terminal

I can open an existing jupyter notebook with a single command (from the docs):
When starting a notebook server from the command line, you can also open a particular notebook directly, bypassing the dashboard, with ipython notebook my_notebook.ipynb. The .ipynb extension is assumed if no extension is given.
However, when I want to open a new notebook it seems as if I have to follow 3 steps:
Run ipython notebook.
Open a new notebook by clicking New > Python 3.
Edit the name of the notebook
Question
Is there a command that allows me to combine these 3 steps in a single command, similar to the command to open existing notebooks? E.g., something like this pseudo code: ipython notebook --new my_notebook.ipynb.
Using this command you can create and open a new notebook without getting into the application. This command will work only in Linux operating system
jupyter notebook $(cat Untitled.ipynb >filename.ipynb && echo filename.ipynb)

Root access for Jupyter/iPython Notebook

I'm trying to use the bash kernel in iPython/Jupyter notebook, but I need sudo access within the notebook itself.
I've tried $ sudo jupyter notebook to run the notebook as root, but that only returns:
$ jupyter: 'notebook' is not a Jupyter command
So, I'm left with running $ jupyter notebook (unless there's a way to run Jupyter notebook as root).
I also can't do su root in the notebook itself because that requires an input and the notebook won't let me give an input.
Finally, there is allegedly an --allow-root option for Jupyter notebook:
http://jupyter-notebook.readthedocs.io/en/latest/config.html
However, it looks like --allow_root is no longer an option. (I've tried modifying the config file by adding NotebookApp.allow_root=True, but that doesn't work.)
Any ideas guys? Maybe I'm doing something wrong?
Just login as root, then do the following command to start the notebook :
jupyter notebook --allow-root
The solution as described here. Is to use
sudo -E env "PATH=$PATH" jupyter notebook
Basically the binary to call jupyter notebook is in the user's PATH variable, but not for root.
Best regards.
Add c.NotebookApp.allow_root=True from the root configuration files. That you don't need ask to allow-rootevery time then you start the notebook.
Edit:
Before edit the configuration file you need to run jupyter notebook --generate-config as root to make the file.
I am running the neopixel library from a jupyter notebook.
The only thing that worked for me was first running the "sudo su" command to move into the root environment and then run "jupyter notebook" (--allow-root alone didn't work for me).
You should try running the command sudo jupyter notebook --allow-root , I'm not sure why but this works. On the server it'll ask you for a password, if you have set up a password for it just type it in the box that will be shown, otherwise, type jupyter notebook password to set up a new password
Generate config
root#user# jupyter notebook --generate-config
root/.jupyter/jupyter_notebook_config.py
root#user# cd .jupyter/
root#user:/.jupyter/# gedit jupyter_notebook_config.py
Add line in jupyter_notebook_config.py
c.NotebookApp.allow_root=True
When I need to execute command as root in my notebook, I use the -A flag, that allows to access an helper program used to read the user's password when no terminal is available.
You need to modify the sudo.conf file before to declare the helper program. On a Debian Buster, I personnaly added:
Path askpass: /usr/libexec/seahorse/ssh-askpass
See the main page of sudo.conf for more information.
In case anyone is still looking for an answer, this is what worked for me:
sudo ~/.local/bin/jupyter-notebook --allow-root
Switching user using su didn't work because I didn't have jupyter installed on root. Using just --allow-root by itself also didn't work for me. This allows you to run sudo with jupyter notebook without running into the issue of "notebook" not being a valid command. Because I am using a linux terminal, jupyter-notebook is installed at ~/.local/bin/jupyter-notebook. See After installing with pip, "jupyter: command not found" for more information about where jupyter may be installed.

Resources