Hi All,
I am new to Jupyter world. I am trying to create a notebook but can not install the Notebook on my system due to office restrictions so is there any way to create the notebooks / playbooks without installing the Jupyter. Any documentation to follow for it ?
Yes and yes.
There’s several options. Two favorites:
- MyBinder-served temporary Jupyter sessions
- JupyterLite
Both of these are available via Try Jupyter. Sort of. I would suggest for the first one, which is the one I recommend for you for reasons outlined at the bottom of this post, read my notes below and access it the way I provide. For reasons of conserving resources, Try Jupyter site emphasizes JupyterLite.
Details on the two suggested options
MyBinder-served temporary Jupyter sessions
The easiest right now is using a temporary session in your browser provided on a virtual machine running remotely. There is no login needed and you can even add most packages/libraries as needed. (There is more room for customization by making your own repos with configuration files to specify what packages for the sessions to include upon launch referenced in the documentation.)
You can use MyBinder for a typical Python-based kernel online without signing in or installing anything on your machine. Go here and click ‘Launch Binder’ or just click here to launch a temporary session.
Because this session is running on a remote machine, you’ll want to immediately save anything useful you make right back to your local system. Save often. See below in this section about file upload and download.
The system will time out with inactivity! (This is probably the biggest drawback.)
Aside from saving to your local file system often, there is an additional safety net should your session time out and you need to get started in a new session. I would suggest practice using it before you need it, see here for more about that and a link to specifics.
Documentation on mybinder.org and making repos to customize your use.
Getting Started with JupyterLab. This should provide you with a nice overview. (Some of the videos may use an older versions so don’t get too hung up on exactly how things look.)
There is another interface where you can draft Jupyter .ipynb
files. Because you cannot install Jupyter locally on your company computer though, I’m going to suggest you stick with JupyterLab. This is because it offers a nice file navigation panel that lets you drag-and-drop files from your local system to upload them. (JupyterLite was first introduced in that JupyterLab interface, too.) You can also right-click and download files via that panel in order to save them to your local file system, and since you are going to be doing that often, you’ll want to make it as easy as possible.The document-centric interface, Jupyter Notebook, is not as convenient in this regard.
Package management on the MyBinder-served Jupyter sessions
You probably will be fine initially installing packages you need as you go along.
Where I sent you to get started already comes with several of the popular ones, like Pandas and Matplotlib already installed without you needing yo do anything. You can import them into the namespace of your running .ipynb
and be ready to take advantage of them. Eventually you’ll encounter ones that aren’t present and you’ll want to install them from the Python Package Index.
Say you want to try rich because you heard it makes Python’s error tracebacks better in Jupyter. You can make a new cell and run %pip install rich
in your Jupyter .ipynb
file and then restart the kernel (refreshing the browser page is sometimes needed, too) and you should be all set for that session.
If that adding in the session gets repetitive. I alluded to customizing above and this is covered in the referenced documentation. For example, you can make repos that specify what packages to launch with using configuration files. A requirements.txt
is the simplest and the one used in the resource I directed you to in order to get sessions started. You can make a repo and customize your own by listing the packages you need each on a single line, such as one of my customized requirements.txt
here. Then when I point the mybinder.org site at that repo, such as when you click on the ‘launch binder’ badge on the main page of the repo (URL for that link is https://mybinder.org/v2/gh/fomightez/cluster_analysis-binder/master?filepath=index.ipynb
which indeed points mybinder at that repo and specifies the interface), the MyBinder service checks if it already built an image for that repo, and it has it launches it with the specified packages already installed and ready to import.
JupyterLite
JupyterLite is another option.
You can go here and launch it in your browser by clicking on the teal color JupyterLab text next to the beaker symbol, to the right of the text ‘Open demo in a new tab’.
There’s several reasons that though that is absolutely the easiest way to quickly draft a Juputer .ipynb
file, I’m suggesting using a full Python kernel in a temporary virtual remote system served by MyBinder use at this time.
Reasons not prioritizing that right now:
A. There are limitations with what the Pyodide kernel can run vs a true Python kernel. Though it keeps improving dramatically, a lot of people get tripped up when they encounter things like this and it leads to frustration because it’s not just certain things and some of them are hard to understand and/or eliminate options that make learning Python enticing to new users or make difficult the things spelled out in examples as being easy. Examples are that input()
doesn’t work exactly like in Jupyter with an ipykernel
, and even if you make it work there are quirks with what you can put in a single cell. Another big example is that certain network communication channels are off the table because you are inside a browser’s security constraints, not on a server with unrestricted network access. Some of the next section on persistence and file access overlaps with some of this.
B. The ‘persistence’ is misleading and file access. You still need to treat the running session and files in the web assembly system as ‘remote’ at this time. Though everything is running on your computer, it’s not like running a typical software package on your system. It is more like running in your system. Specifically in your browser. I would caution you to save anything you make back out from the session in your browser to store the on your local system typical file system. Though if you start JupyterLite now and make a notebook in the session, you’ll see it there if you come back next week, it’s not stored where you can actually get at it separate from the session. You cannot navigate to the modified files because it is running in a virtual system inside your browser. And the ‘files’ can go away if you clear your browser cache or update your browser or want to work in a different browser, etc… Hence the need to store the produced .ipynb
elsewhere for actual persistence.
These are confusing concepts and limitations when you are trying to get started, and for that reason maybe typical Jupyter with a typical Python kernel MyBinder is easier at this time.
Documentation on Getting Started with JupyterLite. As I’ve outline above, you’ll want to start out ‘Using an existing JupyterLite deployment’.
Thanks lot fomightez!! It really helped.
Hi @fomightez, thanks so much for the great explanation! In your comment, you mention the section on:
file upload and download
I might miss something here, but you could you help me find how to download the output via the MyBinder Jupyter session? I tried doing this but as you can see on this screenshot, the export options were greyed out so that the export was not possible for me:
Thanks for your continued help!
I see ‘Console 1’ in the screen that is in the forefront there.
Because you are in a console, the ‘Save and Export Notebook As…’ is not a choice. The menus are context dependent.