WSL2 Jupyter Notebook error Powershell cannot find file specified - powershell

I am excited about the wsl2 and then straightaway installed Anaconda for setting up my DS environment.
Following this article
After I typed
jupyter notebook
I see this error.
Could anyone give some hints?

Found another article
It seems that this error is cause by missing of browser(GUI) in the WSL, so that is why this error happens.
I then run
jupyter notebook --no-browser
No it doesn't show the error.
Could someone confirm my guess?

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.

After the latest update of VSCode, I can't run Jupyter notebooks anymore

After updating VSCode, I have been unable to run Jupyter notebooks anymore. I am using VSCode on a MacBook Pro Max M1 and am encountering the following error:
Failed to start the Kernel.
Jupyter server crashed. Unable to connect.
Error code from Jupyter: 1
usage: jupyter.py [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
[--paths] [--json] [--debug]
[subcommand]
Jupyter: Interactive Computing
positional arguments:
subcommand the subcommand to launch
options:
-h, --help show this help message and exit
--version show the versions of core jupyter packages and exit
--config-dir show Jupyter config dir
--data-dir show Jupyter data dir
--runtime-dir show Jupyter runtime dir
--paths show all Jupyter paths. Add --json for machine-readable
format.
--json output paths as machine-readable json
--debug output debug information about paths
Available subcommands: kernel kernelspec migrate run troubleshoot
Jupyter command jupyter-notebook not found.
View Jupyter log for further details.
Unfortunately, none of the steps I tried have worked.
I am using January 2023 (version 1.75) release and extesion versions are as follows:
Python v2023.2.0
Jupyter v2023.1.2010391206
Has anyone else faced this issue? I would greatly appreciate any suggestions or solutions.
Thank you!
I have tried a number of steps to resolve the issue, including:
Making sure that jupyter-notebook is running in the terminal
Installing Jupyter in new conda and Python virtual environments
Removing VSCode and its related directories completely and downloading it again
Trying the "Switch to Pre-Release Version" for both Jupyter and Python extensions in VSCode
Tried updating jupyter and notebook liberaries
Tried running VSCode with code --no-sandbox
solved downgrading to previous version (November 2022) then updating to latest version again. Running same Python and Jupyter version. Good luck
I ran into this too. I was able to work around it by switching the Jupyter extension to the pre-release version (which was a suggestion in a different question that I can't find anymore).

Jupyter Notebook will not open on Mac (.zsh)

I know for this issue there are some solutions but they didn't work for me. And I don't understand how I can do. I guess I have to change PATH stuff, but I don't understand to be honest.
My terminal .zsh (I can't change this with .bash, because I have to use it.)
My system Mac OS Catalina
I installed Anaconda. When I try to launch Jupyter Notebook on Anaconda, Jupiter notebook doesn't open on the web browser, it says waiting for localhost.
And when I try to launch Jupyter Notebook in terminal with code 'jupyter notebook'. It says 'zsh: command not found: jupyter'
Please help, this thing drive me crazy.
I solved this problem. The reason for this was the Antivirus program. It blocks to open Jupyter Notebook on the web browser. If you have same problem, remove your antivirus program.

Jupyter: magic %qtconsole doesn't work

I am trying to use the magic %qtconsole from jupyter notebook.
I am working on my local connected to a remote server.
WHen typing %qtconsole and shift-enter in a cell of the notebook, nothing happens. No error message, but not qt console either.
Does that have to do with the remote server? Anyone has an idea how to resolve that problem?
You don't say much about your environment, but you may need to install qtconsole. If you are in a conda environment try...
conda install qtconsole
... or in general...
pip install qtconsole

Can not create a "notebook" using ipython Notebook

I have recently installed ipython using Enthought's EPD python install - and when starting the iPython HTML notebook from the command prompt by typing:
ipython notebook --pylab=inline
I manage to get the localhost browser notebook screen pop up correctly.
However when I try to create a new notebook by clicking "New Notebook" I get the following error message:
"Creating Notebook Failed The error was: Unexpected error while autosaving notebook: C:\Windows\System32\Untitled0.ipynb [Errno 17] No usable temporary file name found"
I am assuming this i sbecause I may not have write privilege for that particular drive. So I have tried to go into the "ipython_notebook_config.py" file and change the following:
# The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = u'C:\Users\Stuart\Documents\iPython'
and
c.FileNotebookManager.notebook_dir = u'C:\Users\Stuart\Documents\iPython'
I have then closed down all the cmd windows and started the ipython notebook agaion. But when I click on "New Notebook" I get the same error message as before:
"Creating Notebook Failed The error was: Unexpected error while autosaving notebook: C:\Windows\System32\Untitled0.ipynb [Errno 17] No usable temporary file name found"
Could someone please help me as to how I can get this working? Any help very much appreciated.
The answer kindly provided by #Jakob in the comments above did the trick:
"Can you try switching to C:\Users\Stuart\Documents\iPython in the terminal before starting the notebook?"
Just change the directory where are run your iPython notebook. For make it, you right-click on the shortcut and edit properties. In this properties, a field named "run directory" or something like that. Put your link in this field.
I just experienced the same problem. I even erased all the untitled.ipynb files in the directory. Then I realized that I had other copies of Anaconda terminal open. When I closed them and tried again, things went back to normal.
If you run the IPython as administrator you won't run into error for starting a new notebook. To do that right click on the Ipython shortcut and click on run as administrator.
I also had the same problem, I was not able to create the new notebook or access existing notebook present in that directory.
Error Message - Unexpected error while saving file:/path/ database is locked
Turns out my old anaconda jupyter notebook terminals were open and running in the background. Every time I started jupyter notebook I used the new instance that led me to this problem. When I closed all terminals and restarted new Jupyter notebook terminal it started working again.
Many of the problems with Anaconda/Jupyter/Notebooks can be solved by examining and cleaning up what you have in your environmental variables such as Path or, if you trying to set up files to store Notebooks that you develop.
There is a very good discussion of environmental variables here:
http://johnatten.com/2014/12/07/adding-and-editing-path-environment-variables-in-windows/
It is obvious that if Anaconda/Jupyter/Notebook can't find the files they can't run them.
At a minimum your path in environmental variables should contain:
c:\users\*******\Anaconda3 where ******** is your user name
c:\users\*******\Anaconda3\Scripts
then you could create environmental variables that point to your personal Notebook code directories: (note: there can't be any spaces in the addresses) in Windows Environmental Variables (System Properties --> Environmental Variables --> add to User and System variables
variable value
NOTEBOOK address of your personal Notebook location
TESTING address of your Notebook Testing location
With this setup you can on the Anaconda Command
jupyter notebook %TESTING%
or
jupyter notebook %NOTEBOOK%
Another way you can go to your own Notebook directory is to change
jupyter_notebook_config.py
Go to:
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'your Notebook directory address goes here'
remove the ## and enter your directory using \'s instead of \ in the address
Then anytime you enter 'jupyter notebook' you will start at your Notebook Directory.