<commit_before># Check that the packages are installed.
from pkgutil import iter_modules
import sys


def check_import(packagename):
    if packagename in (name for _, name, _ in iter_modules()):
        return True
    else:
        return False


# If there are new packages that you can import, add them to the list.
package_names = ['networkx', 'numpy', 'matplotlib', 'hiveplot', 'pandas',
                'jupyter', 'nxviz', 'tqdm']
packages = {n:n for n in package_names}
# Only add the packages whose import names are different from the 
# package name (what we `pip install` or `conda install`).
packages['community'] = 'python-louvain'


def print_error(p, i):
    """
    Returns the error message. 

    :param str p: The name of the package to install.
    :param str i: The name of the package when imported.
    """
    error_message = f"""
    {i} not present. Please do the installation using either:
<commit_msg>updated checkenv docstrings<commit_after># Check that the packages are installed.
from pkgutil import iter_modules
import sys


def check_import(packagename):
    if packagename in (name for _, name, _ in iter_modules()):
        return True
    else:
        return False


# If there are new packages that you can import, add them to the list.
package_names = ['networkx', 'numpy', 'matplotlib', 'hiveplot', 'pandas',
                'jupyter', 'nxviz', 'tqdm']
packages = {n:n for n in package_names}
# Only add the packages whose import names are different from the 
# package name (what we `pip install` or `conda install`).
packages['community'] = 'python-louvain'


def print_error(p, i):
    """
    Returns the error message for package installation issues.

    :param str p: The name of the package to install.
    :param str i: The name of the package when imported.
    """
    error_message = f"""
    {i} not present. Please do the installation using either:

{'fraction_non_alphanumeric': 0.09563846558066211, 'fraction_numerical': 0.0, 'mean_word_length': 3.4074074074074074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '284900', 'n_tokens_mistral': 572, 'n_tokens_neox': 554, 'n_words': 240}