How to open terminal in jupyterlab directly where notebook is present? - jupyter-lab

When I create a new terminal in JupyterLab, it creates a new terminal at the home folder. Considering that I'm logging in to JupyterLab from outside, and I don't know where my current notebook is present, how can I open the location of the notebook (e.g. "E:\Python") in the new terminal (which defaults to "C:\Users<USERNAME>")?

You can open two types of terminals from within JupyterLab:
Python terminal
Right click in a notebook and select New Console for Notebook.
This will open a python terminal at the bottom of the notebook.
System command line terminal
In the toolbar, click File -> New -> Terminal
This will open a system terminal as a new tab.

Related

How can I open another console window

I am trying to open a new console terminal from Rust. With the help of documentation, I was capable of starting a terminal in the current terminal window, but not in another one.
For example, imagine I have one folder with two files main.py and bb.py and the following code does the thing I want
import os
os.system("start cmd /K python bb.py")
It opens a new terminal, and in this new terminal the command python bb.py is executed. How can I do this in Rust?

Problem Loading Jupyter Notebook in Windows 10 Pro

I am new in Anaconda (Jupyter Notebbok) and training python. After I installed Anconda when I open Jupyter notebook, the program won't be loaded.
First I run 'jupyter notebook' from the 'command prompt':
Second, when InterneTExplorer loaded and then I click the New>Python3
Finally I expected to have 'jupyter notebook' to write python codes, but I see below picture:
Desired Page:
Can you help me to find the reason for the problem?
In the following link I have attached a video from my Desktop view.
https://www.youtube.com/watch?v=lDvYwHlvghI
Did you try to open the file from the terminal? Create an empty file. In terminal, go to that empty file directory and open that empty file from terminal in Jupyter notebook. Then try to create new .ipynb inside of that file. Just another way to test if it's browser issue or Anaconda download issue.
Command for terminal-
~cd file directory
~jupyter notebook
It will automatically open the Jupyter in your web browser from your terminal.
I copied the 'localhost' link from command prompt in the Firefox browser and solved the problem.

How to change Jupyter lab Working Directory

I'm using the latest version of Jupyter lab on a Windows 10 64 bit machine inside Firefox. When I start the Jupyter lab (via cmd) the default working directory appears to be
c:/windows/system32
(i.e the folder tab on the left) which is a terrible place to be meddling with, at leat for me. I don't know why Jupyter lab starts there. I've installed Jupyter lab using cmd with administrator privileges. Is that why? Should I have it installed just for a user? (My machine has only one user;me).
I tried changing the directory by using
jupyter notebook --generate-config
And inserted a path to my documents folder (in the path for kernels and notebooks line) , edited out the commentary ("#"). And when I restarted Jupyter lab nothing has changed. It shows the
c:/Windows/system32
as default directory which has so many windows folders and is too messy to deal with.
Any solutions will be greatly appreciated. Thanks in advance:)
A late answer to one of the most common Jupyter Notebook or Jupyter Lab questions most new users have about the file/folder structure when they first begin using Jupyter.
For those Windows users who may still be using that old school Windows Command Prompt - which is actually being phased out of Windows, the Windows Command Prompt will normally start-up and display the location where the Windows Command Prompt application is located on the Windows PC:
c:/Windows/system32
In a nutshell, the OP opened the Windows Command prompt, and then the OP typed the following code to start Jupyter Notebook:
Jupyter notebook
But when the OP created / saved the new Notebook file, it was saved to the Windows / system 32 folder - definitely not a location where anyone wants to save their files.
To avoid saving Jupyter Notebook files in the wrong place, the Command Prompt must be started in a different folder or be moved to another directory. One way to move the Command Prompt is by using an old dos command, Change Directory. Just type cd for Change Directory.
Best advice, create a new folder on the C drive and call it Jupyter_Files. Then use old dos, Change Director command, navigate from the location where the command prompt opens and move to that new folder. Do the following to navigate to the new folder.
cd..
cd..
cd Jupyter_Files
Now the Command Prompt is in the location where the Notebook files want to be saved. At the Command Prompt, type: Jupyter notebook. This will create and save those notebook files in this new folder.

Terminal doesn't open window on top Mac - Atom

I am currently using Atom to code in Python3 on my Mac and I have a package installed ("atom-python-run") which launches a terminal window with the command "python3 {path}" with 'path' being the current working directory with filename.py included. It opens just fine and runs perfectly, but the window doesn't open on top of my atom window but behind it instead. I have to click it every time to see the terminal window and it's really frustrating. I also hate using CMD+Tab to find it as well.
This is a bug in the package I'm using (I think) and I don't want to wait for them to fix it. Are there any methods in OS X to ALWAYS open Terminal on top of every other window? Or a third-party application? I can't find a solution to this problem anywhere online.
If you install the scripts package and use it, the output will be written to a window in the Atom application and will be shown at completion. Go to the Atom package page and search for the word script. You should get a hit on the "script" package. Install this package by just clicking on the install button and then open Atom and the python script you wish to run. Now in Atom go to the packages menu item and from that menu select "script". You'll be given several options, choose "run script" and your script should run showing the output in a window at the bottom of the Atom window.

launch jupyter notebook in specified browser on cmd line

I'm working on a computer that belongs to my company. I don't have admin privileges, in case that's relevant.
My default browser in Windows 10 is set to InternetExplorer. This is mandated by my company. (Edge or Chrome not allowed as default browser) Although I do have Edge and Firefox installed.
I know that I can change the default browser for jupyter notebook sessions by editing the Jupyter config file. But I don't want to change the default in Jupyter.
Instead, I would like to invoke "jupyter notebook" on the command line (Anaconda prompt) while specifying which browser I want it to pick up.
something like:
jupyter notebook --useBrowser edge
or similar. Is this possible?
Try this:
jupyter notebook --browser="C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe %s --new-window"
It is supposed to work like this too: jupyter notebook --browser="firefox" but doesn't in practice for me, because the python webbrowser library (which is used here) is only aware of the default browser. This needs to be manually registered.
You can check this on your system, by running a python prompt and checking:
import webbrowser
list(webbrowser._browsers)
Out: ['windows-default', 'c:\\program files\\internet explorer\\iexplore.exe']
Noticed that if I open Firefox, use the cli command from Kai Aeberli above, as...
jupyter notebook --browser="C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe %s --new-window"
and copy and paste one of the URLs from the cli output into the Firefox (non-default browser) address bar, Jupyter Notebook opens in Firefox!
Thanks for this solution! :))

Resources