Photo by Luis Cortés on Unsplash

Tips and tricks for Jupyter notebook issues

Everyone faces a lot of basic issues when they start with their coding and setting up the notebook remotely or locally, they are basic issues but takes a lot of our time while searching on the internet and due to the different OS everyone provides their solutions whatever works for them and we end up changing something in our OS environment libraries unknowingly. Here is something basic yet useful for notebook beginners.

Permission error while saving the jupyter notebook files or .py remotely

  1. Open terminal
  2. Login through ssh (ssh -X remote_username@remote_ip_address)
  3. Navigate to the working folder using cd command
  4. Check ls -ltrh in that folder path
    Check if the owner and group file is the root or your username
    If both are root, change it with chown command
  5. Run chown username folder name to change ownership
  6. Run chown username: username folder name to change both the ownership and group filename

Module import issues in Jupyter Notebook

  1. In terminal (If you are using an environment then activate the environment first),
  • Run
python
  • Then Run:
import sys
sys.executable
  • Copy the sys.executable path
  • Run the below command in new terminal window but in same environment or exit () in the running python and the run:
jupyter kernelspec list
  • Above command will show the available kernels.
  • Go the kernel path using cd command.
  • Run
open kernel.json
  1. In argv dictionary paste the path copied from sys.executable (replace the existing path)

Running jupyter notebook remotely

  1. Open terminal
  2. Login through ssh (ssh -X remote_username@remote_ip_address)
  3. Navigate to the working folder using cd command
  4. Run jupyter notebook — no-browser — port XXXX (any 4 digit number, 888X preferred like 8884)
  5. Open new local terminal
  6. Run ssh -NL XXXX:localhost:XXXX remote_username@remote_ip
  7. Open the browser in your system and run localhost:XXXX (use same port number everywhere)and enter token (mentioned in the remote terminal window, copy the token value and paste it in the browser)

--

--

--

Data Scientist @Sprinklr | IIT Bombay | IIT (ISM) Dhanbad

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Writing good sprint goals

Use API To Get LME Nickel Rates In Real-Time

Fix Your Web Scrapers with This 15 Point Checklist

DevOps — Top Links Last Week

How To Get LME Prices With An API

MVVM-1: A General Discussion

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Swatimeena

Swatimeena

Data Scientist @Sprinklr | IIT Bombay | IIT (ISM) Dhanbad

More from Medium

Types of Machin Learning

Techniques to break dependencies for testing purpose

Technology Mindfulness Project

Look into Recent Covid Data