1

I currently open Jupyter Notebook by running jupyter notebook in my terminal.

I have 2 questions that relate to a common goal.

1) How do I create a desktop icon (i.e. launcher) to start Jupyter Notebook on my Linux Mint computer?

2) I want to run some basic code upon double-clicking this launcher:

import numpy as np
import pandas as pd
import seaborn as sb
import sklearn as skl

I don't want to type this code whenever I open Jupyter Notebook, so it would be nice to automatically run it.

For #1, I'm trying to follow the steps here:

https://forums.linuxmint.com/viewtopic.php?t=256156#p1382045

However, I don't know where to find the path for the "Command" field. I tried browsing the Anaconda folder on my computer, but I can't find Jupyter Notebook there.

Iterator516
  • 187
  • 1
  • 11
  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. https://stackoverflow.com/help/how-to-ask – Rob Oct 18 '19 at 01:54
  • Although I asked two questions, they actually are necessary compliments toward a common, unified goal. I broke it down into two questions to make it clear. I think that I actually made my overall request easier to answer as a result. – Iterator516 Oct 18 '19 at 02:22

1 Answers1

2

For your first question, if you open up a terminal, you can find where programs are with which, like so

which jupyter

This should output where your particular jupyter is being called from.

For your second question, it looks like you can create a profile to start up certain functions.

In bash, you can run the following

# Create a new folder if it already doesn't exist
mkdir -p ~/.ipython/profile_default/startup

# Create Python file to put your favorite imports
touch ~/.ipython/profile_default/startup/start.py

So the start.py (that is located in ~/.ipython/profile_default/startup/) is where you can put your imports. So this start.py file should contain

import numpy as np
import pandas as pd
import seaborn as sb
import sklearn as skl

Resources:

In sum, if you implement both of the suggestions above, you can get both an icon to auto-load your favorite Python library packages as you start a Jupyter Notebook.

Warning: typically for reproducibility and transferability of Jupyter Notebooks to others, I would go against auto-loading libraries into your Jupyter Notebook. I understand the repetition of having to load the same libraries you use all the time, but if for whatever reason, you change computers or a colleague needs your code, then your notebook will not work correctly. Just my two cents to keep in mind if/when implementing this.

Eric Leung
  • 2,354
  • 12
  • 25