Anaconda, jupyter-lab and jupyter-notebooks and vscode
This presentation will cover the the following:
- Benefits of isolating projects environments
- Understand the Anaconda Navigator and prompts
- Creating a new environment using `conda create`
- Specifying Python version and dependencies
- Opening, Creating, and saving notebooks
- Executing code cells and adding markdown content
- Launching from Anaconda prompt
- Overview of JupyteLab Interface
- Choosing the interface that suits your needs
- Ensuring that your notebook uses the correct environment's Python
- Installing the python extension in Vscode
- Selecting the desired environment for your project
click here to download anaconda
Learn more about Anaconda
Why Environments Matter?
When working on software projects, especially in Python, managing dependencies and ensuring a consistent environment is crucial. Environments play a key role in achieving this goal.
Benefits of Using Environments
Isolation of Dependencies: Environments allow you to isolate the packages and libraries used in different projects. This isolation prevents conflicts between packages that might have incompatible versions, ensuring that your projects run smoothly.
Version Control: Environments make it easier to track the specific versions of packages used in your project. This is essential for maintaining reproducibility and sharing your work with others.
Easy Collaboration: Environments enable collaboration by providing a clear way to share the exact environment configuration with others. This means that anyone can recreate your project’s environment and run your code without worrying about compatibility issues.
Experimentation: Environments give you the freedom to experiment with new libraries, packages, and configurations without affecting your system-wide Python installation. This helps you test different setups without risking your overall development environment.
Development and Production Parity: Environments help ensure that the environment you develop in matches the production environment. This reduces the chances of unexpected issues arising when you deploy your code.
Clean and Organized Development: By creating separate environments for different projects, you keep your development environment clean and organized. This makes it easier to manage your projects and avoid clutter.
Streamlined Dependency Management: Environments, especially those managed by tools like conda or pip, simplify the process of installing, updating, and removing packages. This reduces the likelihood of package conflicts.
Interdisciplinary Work: Environments enable collaboration between developers from different disciplines, each with their own set of tools and libraries. Each developer can work in their own environment tailored to their needs.
After you have installed the anaconda
Benefits of Conda Environments
Using Conda Command:
Specify Python Version:
Adding Packages at Creation:
Activating and Deactivating Environments
1. Activate an Environment:
2. Deactivate an Environment
Listing and Managing Environments
- Using `conda env list` to list existing environments
- Using `conda remove —name flask-project —all` to remove an environment.
Creating virtual envs in Jupyterlab
first create new env
activate your env
install a the library
install the kernel
install the kernel to your env
Creating new env using pswh (Powershell)
- press ctrl + shift +` and write the following cmd:
- Activate the environment
- Install flask library using pip
- After installation:
In this section, we’ll compare Jupyter Notebook and JupyterLab, two popular environments for interactive coding and data analysis.
Explanation of Jupyter Notebook as a web application for creating and sharing documents that contain live code, equations, visualizations, and narrative text.
Showcase of Jupyter Notebook’s user interface and features.
Introduction to JupyterLab, an interactive development environment.
Highlighting JupyterLab’s enhanced capabilities, including a flexible UI and improved multi-document workflows.
Interface: Comparing the interfaces of Jupyter Notebook and JupyterLab.
Extension Ecosystem: Exploring the diverse extension ecosystem of JupyterLab.
User Experience: Discussing user experience enhancements in JupyterLab.
Factors to consider when choosing between Jupyter Notebook and JupyterLab.
Use cases and scenarios where each tool shines.
In this section, we’ll learn how to utilize Conda environments effectively within Jupyter environments.
Activating a Conda environment in your terminal.
Running jupyter notebook to launch the Jupyter Notebook interface.
Exploring how Conda environments are integrated as kernels in Jupyter.
Choosing the correct kernel to match your project’s environment.
Demonstrating how to install and manage additional kernels using Conda.
Using different Python versions in your notebooks.
Activating your Conda environment.
Running jupyter lab to launch JupyterLab.
Understanding JupyterLab’s environment-awareness.
Switching between Conda environments for different notebooks.
In this section, we’ll explore how to set up and use Visual Studio Code (VSCode) as a powerful integrated development environment (IDE) for Python projects.
Explanation of VSCode’s features: code editing, debugging, version control, extensions, and more.
How VSCode can enhance your Python development workflow.
How to install the Python extension in VSCode.
Demonstration of the extension’s capabilities.
Overview of creating a new project folder in VSCode.
Using VSCode’s integrated terminal for commands.
In this section, we’ll learn how to configure VSCode to work seamlessly with Conda environments.
How to select and configure the Python interpreter in VSCode.
Choosing the interpreter from your Conda environment.
Exploring VSCode extensions that enhance Python development.
Installing and configuring extensions for linting, formatting, and more.
Overview of managing Conda environments from within VSCode.
Using the integrated terminal for activating environments.
Running Python scripts within VSCode.
Setting breakpoints and debugging code with VSCode’s debugger.