Implement the use of open ports in the local jupyterlab remote operation server
====== >>>> Summary:
- Into the base environment
- ps -ef | grep jupyter-lab # Gets process ID
- which jupyterlab # view the current jupyterlab
- # kill -9 process ID to kill the process
- conda activate boot environment name their environment #
- nohup jupyter-lab --config = / home / data / jupyter / jupyter_notebook_config.py & # "&" can suspend the process
- Input terminal jupyter-lab --config = / home / data / jupyter start jupyter-lab to verify. Success can ctrl + c y terminate the program
- Input terminal the nohup jupyter-Lab - -config = / Home / Data / & jupyter
- cd jupyter to the next jupter own directory path to the folder
- Copy the existing config file to jupter own folder inside
- To their data files folder create a new folder jupyter
- If there jupyter_notebook_config.py path under their own folder, delete
- Config file to find a path (or a new generated according to step a)
- Log Server
- conda activate their environment
- Create a profile
Specific operation:
jupyter notebook configuration
1. Open the browser jupyter, a new python file, the first line:
from notebook.auth import passwd
2.shift + enter commands and execute the next line. The next line enter: passwd (), prompted for a password, enter it twice after the carriage return.
3. hash password sha1: 158c74966eda: 9533217697d0c62f0db43414ec4e06d4072c1cecc2e97d
4. Open the configuration file jupyter_notebook_config.py again, find c.NotebookApp.password = The third step of the hashed password, you can restart jupyter notebook
use
1. Input terminal: jupyter-lab --generate-config generates a configuration file, the file path is displayed (/Users/kyousugi/.jupyter/jupyter_notebook_config.py) after successful
2. Open jupyter_notebook_config.py configuration file path, find c.NotebookApp.notebook_dir = modify for their own working directory
Also you need to modify the configuration is as follows
c.NotebookApp.allow_root = True
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:bf8121ab2205:18c7e60055ed79ec2a19fcdb9241b2770b75b976'
c.ContentsManager.root_dir = '/storage/st2/testcode/'
Second, start jupyterlab
(Otherwise start jupterlab is the base environment, will lead to jupterlab environment is not their own virtual environment)
Eg. /home/data/jupyter/jupyter_notebook_config.py
rm jupyter_notebook_config.py
mkdir jupyter
cp /home/data/jupyter/jupyter_notebook_config.py ./
Modify jupyter_notebook_config.py file by vim
vim jupyter_notebook_config.py
Keyboard, press i to enter edit mode
Changed their folder path and set the port number
eg:
c.NotebookApp.notebook_dir = '/home/data'
= c.NotebookApp.port 8889 # port number
c.LabApp.user_settings_dir = '/home/data/jupyter/lab/user-settings'
c.LabApp.workspaces_dir = '/home/data/jupyter/lab/workspaces'
Press esc to exit edit mode
Keyboard Input : wq to save and exit
Enter to
& Hang in the background with the program so that it does not automatically exit
nohup jupyter-lab --config = / home / data / jupyter / jupyter_notebook_config.py & # "&" can suspend the process
QA : If jupyterlab virtual environment right?
1. Review the virtual environment jupyterlab of:
ipython中
import os
os.sys.path
If not in the anaconda / envs / python own environment, then kill the process and restart jupyterlab in the corresponding virtual environment
2. Operation
3. Check
ipython中
import os
os.sys.path
# os.sys.path.insert(0,"/home/anaconda3/envs/my/lib/python3.6/site-packages/")
View the current PATH environment variable
If successful handover jupyterlab background virtual environment,
We can successfully import package under their own environments such as import tensorflow
① modify the settings terminal
eg:
{
// Terminal
// @jupyterlab/terminal-extension:plugin
// Terminal settings.
// *************************************
// Font family
// The font family used to render text.
"fontFamily": "'DejaVu Sans Mono', 'Noto Sans Mono', 'Everson Mono', FreeMono, Menlo, Terminal, monospace",
// Font size
// The font size used to render text.
"fontSize": 16,
// Line height
// The line height used to render text.
"lineHeight": 1,
// Paste with Ctrl+V
// Enable pasting with Ctrl+V. This can be disabled to use Ctrl+V in the vi editor, for instance. This setting has no effect on macOS, where Cmd+V is available
"pasteWithCtrlV": true,
// Screen Reader Mode
// Add accessibility elements for use with screen readers.
"screenReaderMode": false,
// Scrollback Buffer
// The amount of scrollback beyond initial viewport
"scrollback": 1000,
// Shut down on close
// Shut down the session when closing the terminal.
"shutdownOnClose": false,
// Theme
// The theme for the terminal.
"theme": "inherit"
}
② modify the settings editor
{
// Text Editor
// @jupyterlab/fileeditor-extension:plugin
// Text editor settings.
// ***************************************
// Editor Configuration
// The configuration for all text editors.
// If `fontFamily`, `fontSize` or `lineHeight` are `null`,
// values from current theme are used.
"editorConfig": {
"autoClosingBrackets": true,
"fontFamily": null,
"fontSize": 15,
"lineHeight": null,
"lineNumbers": true,
"lineWrap": "on",
"matchBrackets": true,
"readOnly": false,
"insertSpaces": true,
"tabSize": 4,
"wordWrapColumn": 80,
"rulers": [],
"codeFolding": false
}
}
Change the font to suit your habits
reference: