Can jupyter notebook be executed on another pc in network? - python

I have a jupyter notebook that creates a report which is then saved to a shared network folder. The report is saved over every time the notebook is run. Colleagues would like to get up-to-date reports but do not have jupyter notebook installed on their machines. Is there a way to execute a jupyter notebook on another pc on the network? There are desktops which are always on and connected to the network. I was thinking something along the lines of creating a .ps1 file that the user would run in powershell from their machine:
magic to execute notebook
Start-Sleep -s 2 #pause to make sure notebook runs and finishes
Invoke-Item "\path_to_shared_folder\report.pdf" #open the up-to-date report that was just created

Related

Can´t make jupyter notebook work in Anaconda

On my windows PC, i have Anaconda installed, but today i could not open Jupyter Notebook correctly. When i use these commands to set up an enviornment, i can open the Jupyter notebook.
conda activate [name_of_the_environment]
jupyter notebook
The error occurs when internet explorer opens the Jupyter notebook, because i can't access to my ipynb files or any other. The page just stays like this (in blanc, like it does not end loading):
Internet explorer general site
Trying to open a file
I am not having any connection problems and this happens regardless of the file size.
I also tried updating Anaconda, but it didn´t work.
Code written in the terminal:
Code

Google colab, run python script (.py) from jupyter Notebook (.ipynb)

I'm trying to run a .py script for trainning a Neural Network from a jupyter notebook in Colab. I'm doing that because the python script needs some input arguments. Both, python script and jupyter notebook are Colab files and they are in synchronized Google Drive.
I attach an example:
(execution file in jupyter notebook)
enter image description here
I execute the python script as follows from the jupyter notebook:
!python3 /content/gdrive/My\ Drive/Tesis/prueba1.py --lr-find 1
Where --lr-find 1 is the input argument that my Neural Network needs.
Anyway, this doesn't work for me. The neural network don't show sign of starting training.
Have you tried something similar?
Thank you very much in advance.

Jupyter Notebooks in VS Code using WSL 2 are not working

I want to use Jupyter Notebooks inside VS Code running within WSL 2. Regular Python works within WSL without a problem, that means the base conda enviroment is connected and I can run .py files. Moreover, I’m able to run the command jupyter notebook which will start the notebook server within WSL exposing the localhost to the Windows system.
However, I want to test the new Jupyter Notebook feature within VS Code, which is not working for me; VS Code shows: Jupyter Server: No Kernel and Python: Not Started (see screenshot below).
My testing machine is:
WSL 2 (using Pengwin distribution) on Windows 20H1 (19041.21)
VS Code 1.41 (having the Python extension installed)
Anaconda
What I did:
Open WSL
Open VS Code in my target directory (code .)
Create a new Notebook file from the command palette Python: Create New Blank Jupyter Notebook
Create dummy print("test")
Run Cell will trigger the warning:
Is there anything I’m missing?
The VS Code insiders actually works out of box with Jupyter notebooks. Just remember to run code-insiders . instead of code ..
Another solution would be, according to this website, start the VS Code in windows, then use WSL 2 as a remote server.
The code installation on wsl2 needs a restart to work properly, I was told by a notification, and in the question's comments you may see people experiencing the same issue(' it's working now. not sure why'). So before looking upon any elaborate solution, just restart code.

Open a Jupyter notebook within running server from command line

My Jupyter/IPython notebooks reside in various directories all over my file system. I don't enjoy navigating hierarchies of directories in the Jupyter notebook browser every time I have to open a notebook. In absence of the (still) missing feature allowing to bookmark directories within Jupyter, I want to explore if I can open a notebook from the command line such that it is opened by the Jupyter instance that is already running. I don't know how to do this....
Option 1: Run multiple jupyter notebook servers from your project directory root(s). This avoids navigating deeply nested structures using the browser ui. I often run many notebook servers simultaneously without issue.
$ cd path/to/project/; jupyter notebook;
Option 2: If you know the path you could use webbrowser module
$ python -m webbrowser http://localhost:port/path/to/notebook/notebook-name.ipynb
Of course you could alias frequently accessed notebooks to something nice as well.

How to run a script when a notebook is loaded

I am writing a set of notebooks that has some common start up script. I want to put this startup script(a somefile.py file) in the notebook folder, and when the notebook's kernel is started(or restarted), I want this script run in the kernel.
I know that I can put this file in the profile folder, but since I am working on the set of notebooks on a few PC, and I only want the script been run for the set of notebooks. A global startup script is not very good for this case.

Categories

Resources