3.1. How to run jupyter notebooks locally - HenriquesLab/NanoPyx GitHub Wiki

How to run NanoPyx's "Codeless" notebooks on a local installation

In this tutorial, we'll walk through the process of creating a virtual environment using Conda and launching Python Jupyter Notebooks within that environment. Conda is a popular package manager and environment management system.

Check out our video tutorial here if you want to follow along!

Step 1: Install Conda

If you don't have Conda installed, you can download and install Miniconda (a minimal Conda installer) from the official website: Miniconda Installers

Follow the installation instructions for your operating system.

Step 2: Create a Conda Environment

Open a terminal or command prompt and create a new Conda environment using the following command:

# Replace 'myenv' with your preferred environment name
# You can also set your prefered python version (NanoPyx supports 3.9, 3.10 and 3.11)
conda create --name myenv python=3.10

Step 3: Activate the Conda Environment

Activate the Conda environment with the following command:

conda activate myenv

Your terminal or command prompt should now show the active Conda environment.

Step 4: Install NanoPyx and its Jupyter depencencies

While the Conda environment is active, install NanoPyx using the following command:

# depending on your terminal you might need to use quotes around "nanopyx[jupyter]"
pip install nanopyx[jupyter]

If you already have jupyter lab installed on your environment, you cna skip this step (#4) as the notebook will check whether you have nanopyx installed and if not will install it.

Step 5: Launch Jupyter Lab

Now that NanoPyx and Jupyter are installed, you can launch it by running:

jupyter lab

Step 6: Open NanoPyx's Notebook

Once the Jupyter Lab interface opens in your web browser, you can navigate to your local folder that contains the NanoPyx's "Codeless" Notebooks. If you haven't downloaded the notebooks yet, you can do so on this link. Select the notebook you want to use by clicking on it and on the new page simply click on the download raw file button on the top right of the notebook file. Once you have it saved on your local computer you can then open it from within Jupyter Lab interface.

For more details on how to use Jupyter Lab you can check their official documentation.

Step 7: Run your analysis

With the notebook open on Jupyter Lab you can simply run the notebook cells sequentially and use the automatically generated graphical user interface to interact with the methods. Cells that are marked as optional, can be skipped and are not essential for the analysis.

Step 8: Deactivate the Conda Environment (Optional)

When you're done working with your Jupyter Notebook, you can deactivate the Conda environment by running:

conda deactivate

Conclusion

You've successfully set up a Conda environment and launched Python Jupyter Notebooks within that environment. Conda provides a convenient way to manage environments and dependencies for your Python projects.

Feel free to explore the methods implemented in NanoPyx's "Codeless" Jupyter Notebooks

Happy coding!