others- how to solve 404 problem when using python notebook or ipynb in pycharm?

1. Problem

In pycharm, when I open .ipynb I got a 404 error:

2. Environment

PyCharm 2023.1.5 (Community Edition)
Build #PC-231.9414.12, built on February 14, 2024
Runtime version: 17.0.10+10-b829.26 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
Metal Rendering is ON
Non-Bundled Plugins:
    co.bito.bito-intellij (1.3.1)
    IdeaVIM (2.7.5)
    com.github.copilot (

3. The basics

1) What is python Jupyter Notebook

An .ipynb file is a file format used by Jupyter Notebook, which is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Jupyter stands for “Julia, Python, and R,” which are the three programming languages for which the application was initially designed, though it now supports over 40 programming languages.

Here’s a brief overview of what a Jupyter Notebook is and its uses:

  1. Interactive Computing: It enables a way to combine code execution with text, making it a powerful tool for data analysis, machine learning, and scientific research.

  2. Multiple Programming Languages: While it was initially designed for Python, Julia, and R, it now supports many other languages through the use of different kernels.

  3. Document Sharing: Notebooks can be shared with others, allowing for collaboration and easy demonstration of code and its results.

  4. Web-Based Interface: It provides a web-based interface for interactive computing, which can be accessed from any device with a web browser.

  5. Version Control: Notebooks can be version-controlled like any other text file, which is useful for tracking changes over time.

  6. Integration with Other Tools: It integrates well with many data science and machine learning tools, making it a central platform for various workflows.

  7. Educational Use: It is widely used in educational settings to teach programming and data science due to its interactive nature.

  8. Notebook Extensions: There are numerous extensions available that can enhance the functionality of Jupyter Notebooks.

In summary, a Jupyter Notebook is a versatile tool for interactive computing that supports multiple programming languages and is widely used in data analysis, machine learning, and education. The .ipynb file is a JSON-formatted file that contains the code, text, and metadata for a Jupyter Notebook.

2) Examples of Jupyter Notebook

Certainly! Here are some examples of what you can do with .ipynb files, which are Jupyter Notebook files:

  1. Interactive Python Coding: You can write and execute Python code interactively. For instance, you might define a function and call it to get a result.
    # Example of a code cell
    def greet(name):
        return f"Hello, {name}!"
  2. Data Analysis with Libraries: Use libraries like pandas for data manipulation and matplotlib for plotting.
    import pandas as pd
    import matplotlib.pyplot as plt
    # Load a dataset
    data = pd.read_csv('data.csv')
    # Plot a graph
    plt.plot(data['x'], data['y'])
  3. Markdown Text Cells: Include text cells with Markdown formatting to explain your code or analysis.
    # My Notebook Title
    ## Introduction
    This notebook demonstrates how to use Markdown cells within Jupyter Notebooks.
    ## Usage
    - Lists
    - Links
    - Headings
  4. Mathematical Formulas: Utilize LaTeX within Markdown cells to display mathematical formulas.
    E = mc^2
  5. Importing Modules: Import external Python modules to use in your notebook.
    import numpy as np
    import scipy.stats as stats
  6. JSON Output: Display JSON data or convert Python objects to JSON format.
    import json
    data = {'name': 'John', 'age': 30, 'city': 'New York'}
  7. Shell Commands: Execute shell commands by prefixing an exclamation mark.
    !ls -l
  8. Working with Images: Display images within the notebook.
    from IPython.display import Image
  9. Magic Commands: Use IPython’s magic commands that start with % or %% for special operations.
    %matplotlib inline
  10. Customizing Notebooks: Change the behavior of the notebook using configuration options.
    %config InlineBackend.figure_format = 'retina'
  11. Running External Code: Execute code written in other languages by setting up the appropriate kernel.
    for i in {1..5}; do
      echo "Hello $i times"
  12. Version Control: Show the diff of changes in a cell using version control system commands.
    %%diff a.py b.py
  13. Using %store Magic: Pass variables between notebooks.
    %store df
  14. Creating Interactive Widgets: Use ipywidgets for interactive components.
    import ipywidgets as widgets
    slider = widgets.FloatSlider(value=1, min=0, max=10, step=.1)

These examples illustrate the versatility of Jupyter Notebooks, which can be used for a wide range of tasks from simple coding and data analysis to complex interactive visualizations and teaching materials.

4. Solution

Open terminal in pycharm and then input:

pip install jupyter

Then open the ipynb again:

It works!