<commit_before>---
layout: post
title: 'Jupyter Notebooks Best Practices: Use Virtual Environments'
excerpt: Bring the best practices established by the Python community to your Jupyter
  Notebooks.  You can add virtual environments to Jupyter Lab, giving each notebook
  it's own environment.  This post goes into detail explaining exactly how you can
  add virtual environments to your own notebooks on Google Cloud's AI Platform Notebooks
tags:
- Python
- Virtual Environments
- Jupyter Lab
- technical

---
iUsing Virtual Environments has become a standard best practice in the Python community.  They allow you to work on multiple python projects at the same time, without one accidentally corrupting the dependencies of another.  While using these Virtual Environments has become the norm with Python projects, they haven't yet caught on in Python notebooks.  However, they're easy to add to your Jupyter Notebook or Jupyter Lab setup.  This post will describe just how you can use them.

# What will this enable you to do?

By following these steps, you can have multiple notebooks running on the same machine in Jupyter Lab, where each notebook uses own versions of potentially conflicting python packages.<commit_msg>Update from Forestry.io <NAME> updated _posts/2019-11-08-jupyter-notebooks-best-practices-use-virtual-environments.md<commit_after>---
layout: post
title: Use Virtual Environments Inside Jupyter Notebooks & Jupter Lab - Best Practices
excerpt: Bring the best practices established by the Python community to your Jupyter
  Notebooks.  You can add virtual environments to Jupyter Lab, giving each notebook
  it's own environment.  This post goes into detail explaining exactly how you can
  add virtual environments to your own notebooks on Google Cloud's AI Platform Notebooks
tags:
- Python
- Virtual Environments
- Jupyter Lab
- technical

---
iUsing Virtual Environments has become a standard best practice in the Python community.  They allow you to work on multiple python projects at the same time, without one accidentally corrupting the dependencies of another.  While using these Virtual Environments has become the norm with Python projects, they haven't yet caught on in Python notebooks.  However, they're easy to add to your Jupyter Notebook or Jupyter Lab setup.  This post will describe just how you can use them.

# What will this enable you to do?

By following these steps, you can have multiple notebooks running on the same machine in Jupyter Lab, where each notebook uses own versions of potentially conflicting python packages.
{'fraction_non_alphanumeric': 0.03611650485436893, 'fraction_numerical': 0.0031067961165048546, 'mean_word_length': 4.575757575757576, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1466745', 'n_tokens_mistral': 644, 'n_tokens_neox': 612, 'n_words': 369}