<jupyter_start><jupyter_text>Re-runnable virtual environment setupThis notebook is a re-runnable set of instructions to set up a virtual environment and install a package `fixnc` into it.  Set up your configuration for the venv<jupyter_code># Import the required packages
import os

# Change current working directory to top of the repository: ~/ceda-notebooks/
os.chdir('../..')

# This script allows the ability to create, activate and install into virtual environments.
# You can find the code used in ~/ceda-notebooks/scripts/utils/venv_utils.py
from scripts.utils import venv_utils

# Define the name of your venv you wish to create
venv_name = 'venv-notebook'

# You can also define the directory to create the venv,
# default a nb-venvs folder in your $HOME directory: $HOME/nb-venvs/
venvs_dir = ...

# List all the packages you want to install into a variable:
packages = [
    "fixnc",
]<jupyter_output>[INFO] "fixnc has been imported.
<module 'fixnc' from '/home/users/astephen/nb-venvs/venv-notebook/lib/python3.7/site-packages/fixnc/__init__.py'>
NOTE: You can now work with the package "fixnc" as usual...<jupyter_text>Step by step venv creationThis section will just go through the steps in which venv creation process works using the script.<jupyter_code># Step 1. Create the venv
# There is a `force_recreate` flag, default `False`.
# If set to `True`, then it will remove the old venv and create a new venv.
venv_utils.create_venv(venv_name=venv_name)

# Step 2. Install packages into the venv
venv_utils.install_packages(packages=packages, venv_name=venv_name)

# Step 3. Activate the venv into your notebook.
# If you had already created and venv and have installed packages. Skip steps 1 & 2,
# and activate the venv directly to reuse already made venvs.
venv_utils.activate_venv(venv_name=venv_name)<jupyter_output><empty_output><jupyter_text>All in one methodCreate, activate and install packages in one method with ready to go configurations.<jupyter_code>venv_utils.setup_venv(venv_name=venv_name, packages=packages)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07918879768227909, 'fraction_numerical': 0.003380009657170449, 'mean_word_length': 5.1301775147929, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '444560', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 652, 'n_tokens_neox': 637, 'n_words': 246, 'path': 'notebooks/training/rerunnable-virtualenv-maker.ipynb', 'repo_name': 'Mahir-Sparkess/ceda-notebooks', 'size': '2071'}