analitics

Pages

Showing posts with label jupyter-book. Show all posts
Showing posts with label jupyter-book. Show all posts

Sunday, May 21, 2023

Python 3.11.3 : Using Jupyter Lab on Fedora linux distro.

JupyterLab is the latest web-based interactive development environment for notebooks, code, and data. Its flexible interface allows users to configure and arrange workflows in data science, scientific computing, computational journalism, and machine learning.
Follow these steps:
  1. Install the jupyterlab python package using pip. This will allow you to run Jupyter notebooks in the terminal.
    pip install jupyterlab
  2. Open a Jupyter Lab session in the terminal using the command:
    jupyter lab
  3. Create a new notebook file and save it with the .ipynb extension.
  4. In the notebook file, add the source code to work with the Python programming language and save the file notebook.
See the next screenshot how this works:

Tuesday, April 28, 2020

Python : Open any Jupiter notebook from GitHub in Colab.

In this tutorial I will show you how to open any Jupiter notebook from GitHub in the Google online Colab area.
First, go to the jupyter notebook in GitHub project.
Example:
https://github.com/catafest/colab_google/blob/master/catafest_001.ipynb
Change the link by adding the world tocolab after github, see the following example:
https://githubtocolab.com/catafest/colab_google/blob/master/catafest_001.ipynb
This will open the google colab notebook with the content of Jupiter notebook.
For more information about using Google Colab with GitHub, see this notebook from the Google Colab research.

Friday, February 15, 2019

Install , test and fix error of the jupyter-book into python 3.

Jupyter Books lets you build an online book using a collection of Jupyter Notebooks and Markdown files. Its output is similar to the excellent Bookdown tool, and adds extra functionality for people running a Jupyter stack.
Read more about this on the official webpage.
Today I start to test this python module named jupyter-book.
I find some errors and I fixed to running well a demo jupyter-book instance.

C:\Python364\Scripts>pip install jupyter-book
Collecting jupyter-book
...
Installing collected packages: ruamel.yaml, jupyter-book
Successfully installed jupyter-book-0.4.1 ruamel.yaml-0.15.88
First I try to create a jupyter-book named catafest but I got this error:
C:\Python364>jupyter-book create catafest --demo
Traceback (most recent call last):
...
from nbclean import NotebookCleaner
ModuleNotFoundError: No module named 'nbclean'
The next step was to fix the error by install the nbclean python module and see all dependencies of python modules:
C:\Python364\Scripts>pip3.6.exe install nbclean
Collecting nbclean
...
Collecting nbgrader (from nbclean)
...
Collecting sqlalchemy (from nbgrader->nbclean)
...
Collecting alembic (from nbgrader->nbclean)
...
Collecting ipython<=6.2.1 (from nbgrader->nbclean)
...
Collecting jupyter-console<=5.2.0 (from nbgrader->nbclean)
...
Collecting Mako (from alembic->nbgrader->nbclean)
...
Collecting prompt-toolkit<2 .0.0="">=1.0.4 (from ipython<=6.2.1->nbgrader->nbclean)
...
Collecting prompt-toolkit<2 .0.0="">=1.0.4 (from ipython<=6.2.1->nbgrader->nbclean)
...
Building wheels for collected packages: nbgrader, sqlalchemy, alembic, Mako
...
Successfully built nbgrader sqlalchemy alembic Mako
Installing collected packages: sqlalchemy, Mako, python-editor, alembic, prompt-toolkit, ipython, 
jupyter-console, nbgrader, nbclean
...
Successfully installed Mako-1.0.7 alembic-1.0.7 ipython-6.2.1 jupyter-console-5.2.0 nbclean-0.3.2 
nbgrader-0.5.5 prompt-toolkit-1.0.15 python-editor-1.0.4 sqlalchemy-1.2.17 
Using again the jupyter-book to create catafest I got another error:
C:\Python364>jupyter-book create catafest--demo
Copying new book to: .\catafest
Copying over demo repository content
This is an error when I start to buid first time:
C:\Python364>jupyter-book build catafest
Convert and copy notebook/md files...
  0%|                                                                       | 0/35 [00:00
  File "c:\python364\lib\site-packages\jupyter_book\main.py", line 31, in main
    commands[args.command]()
  File "c:\python364\lib\site-packages\jupyter_book\build.py", line 266, in build_book
    lines = ff.readlines()
  File "c:\python364\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 183: character maps to  
The reason is the python 3.x and can be fixed by change the encoding into this file:
c:\python364\lib\site-packages\jupyter_book\build.py with this:
with open(path_new_file, 'r',encoding='utf-8') as ff:
The next step is to build the catafest jupyter-book:
C:\Python364>jupyter-book build catafest
Convert and copy notebook/md files...
... 
My GitHub account is catafest and I used this link to create a new repo named catafest_jupyter-book:
https://github.com/new
You need to use root folder use this commands:
C:\Python364\catafest>cd ..

C:\Python364>git clone https://github.com/catafest/catafest_jupyter-book
Cloning into 'catafest_jupyter-book'...
warning: You appear to have cloned an empty repository.
Copy all files and folders from catafest folder to catafest_jupyter-book folder and use GITHUB commands to upload to the web:
C:\Python364>cd catafest_jupyter-book

C:\Python364\catafest_jupyter-book>git add ./*

C:\Python364\catafest_jupyter-book>git commit -m "adding my first jupyter book!"

C:\Python364\catafest_jupyter-book>git push
Username for 'https://github.com': catafest
Password for 'https://catafest@github.com':
Enumerating objects: 347, done.
Counting objects: 100% (347/347), done.
Delta compression using up to 2 threads.
Compressing objects: 100% (304/304), done.
Writing objects: 100% (347/347), 1.40 MiB | 541.00 KiB/s, done.
Total 347 (delta 74), reused 0 (delta 0)
remote: Resolving deltas: 100% (74/74), done.
To https://github.com/catafest/catafest_jupyter-book
 * [new branch]      master -> master
You can make GITHUB settings with a new gh-pages branch to see into your browser.