prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add venv into docker image to enable editable `pip install`
  When trying to install composer with `pip install -e .` from within the docker image, we are seeing this error:
  ```
  Traceback (most recent call last):
    File "/usr/bin/composer", line 33, in <module>
      sys.exit(load_entry_point('mosaicml', 'console_scripts', 'composer')())
    File "/usr/bin/composer", line 22, in importlib_load_entry_point
      for entry_point in distribution(dist_name).entry_points
    File "/usr/lib/python3.8/importlib/metadata.py", line 445, in distribution
      return Distribution.from_name(distribution_name)
    File "/usr/lib/python3.8/importlib/metadata.py", line 169, in from_name
      raise PackageNotFoundError(name)
  importlib.metadata.PackageNotFoundError: mosaicml
  ```
  This seems to be remedied by running the `pip install` from within a virtualenv. Can we bake a virtualenv into the docker image as a workaround?
  
  </issue>
  <code>
  [start of setup.py]
  1 # Copyright 2021 MosaicML. All Rights Reserved.
  2 
  3 import os
  4 import sys
  5 import textwrap
  6 
  7 import setuptools
  8 from setuptools import setup
  9 
  10 
  11 def package_files(directory: str):
  12     # from https://stackoverflow.com/a/36693250
  13     paths = []
  14     for (path, _, filenames) in os.walk(directory):
  15         for filename in filenames:
  16             paths.append(os.path.join('..', path, filename))
  17     return paths
  18 
  19 
  20 with open("README.md", "r", encoding="utf-8") as fh:
  21     long_description = fh.read()
  22 
  23 install_requires = [
  24     "pyyaml>=5.4.1",
  25     "tqdm>=4.62.3",
  26     "torchmetrics>=0.6.0",
  27     "torch_optimizer==0.1.0",
  28     "torchvision>=0.9.0",
  29     "torch>=1.9",
  30     "yahp>=0.0.14",
  31     "numpy==1.21.5",
  32 ]
  33 extra_deps = {}
  34 
  35 extra_deps['base'] = []
  36 
  37 extra_deps['dev'] = [
  38     "custom_inherit==2.3.2",
  39     'junitparser>=2.1.1',
  40     'coverage[toml]>=6.1.1',
  41     'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners
  42     'pytest>=6.2.0',
  43     'yapf>=0.13.0',
  44     'isort>=5.9.3',
  45     'ipython>=7.29.0',
  46     'ipykernel>=6.5.0',
  47     'jupyter>=1.0.0',
  48     'yamllint>=1.26.2',
  49     'pytest-timeout>=1.4.2',
  50     'recommonmark>=0.7.1',
  51     'sphinx>=4.2.0',
  52     'sphinx_copybutton>=0.4.0',
  53     'sphinx_markdown_tables>=0.0.15',
  54     'sphinx-argparse>=0.3.1',
  55     'sphinxcontrib.katex>=0.8.6',
  56     'sphinxext.opengraph>=0.4.2',
  57     'sphinxemoji>=0.2.0',
  58     'sphinx_rtd_theme>=1.0.0',
  59     'testbook>=0.4.2',
  60     'myst-parser>=0.15.2',
  61 ]
  62 extra_deps['logging'] = ['wandb>=0.12.2', 'apache-libcloud>=3.4.1']
  63 
  64 extra_deps['nlp'] = [
  65     'transformers>=4.11.3',
  66     'datasets>=1.14.0',
  67 ]
  68 
  69 extra_deps['unet'] = [
  70     'monai>=0.7.0',
  71     'scikit-learn>=1.0.1',
  72 ]
  73 
  74 extra_deps['deepspeed'] = [
  75     'deepspeed>=0.5.5',
  76 ]
  77 
  78 extra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)
  79 
  80 setup(
  81     name="mosaicml",
  82     version="0.3.1",
  83     author="MosaicML",
  84     author_email="team@mosaicml.com",
  85     description="composing methods for ML training efficiency",
  86     long_description=long_description,
  87     long_description_content_type="text/markdown",
  88     url="https://github.com/mosaicml/composer",
  89     include_package_data=True,
  90     package_data={
  91         "composer": ['py.typed'],
  92         "": package_files('composer/yamls'),
  93     },
  94     packages=setuptools.find_packages(exclude=["tests*"]),
  95     classifiers=[
  96         "Programming Language :: Python :: 3",
  97     ],
  98     install_requires=install_requires,
  99     entry_points={
  100         'console_scripts': ['composer = composer.cli.launcher:main',],
  101     },
  102     extras_require=extra_deps,
  103     dependency_links=['https://developer.download.nvidia.com/compute/redist'],
  104     python_requires='>=3.7',
  105     ext_package="composer",
  106 )
  107 
  108 # only visible if user installs with verbose -v flag
  109 # Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)
  110 print("*" * 20, file=sys.stderr)
  111 print(textwrap.dedent("""NOTE: For best performance, we recommend installing Pillow-SIMD
  112     for accelerated image processing operations. To install:
  113     \t pip uninstall pillow && pip install pillow-simd"""),
  114       file=sys.stderr)
  115 print("*" * 20, file=sys.stderr)
  116
  [end of setup.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -1,12 +1,16 @@
   # Copyright 2021 MosaicML. All Rights Reserved.
   
   import os
  +import site
   import sys
   import textwrap
   
   import setuptools
   from setuptools import setup
   
  +# From https://github.com/pypa/pip/issues/7953#issuecomment-645133255
  +site.ENABLE_USER_SITE = "--user" in sys.argv[1:]
  +
   
   def package_files(directory: str):
       # from https://stackoverflow.com/a/36693250
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -1,12 +1,16 @@\n # Copyright 2021 MosaicML. All Rights Reserved.\n \n import os\n+import site\n import sys\n import textwrap\n \n import setuptools\n from setuptools import setup\n \n+# From https://github.com/pypa/pip/issues/7953#issuecomment-645133255\n+site.ENABLE_USER_SITE = \"--user\" in sys.argv[1:]\n+\n \n def package_files(directory: str):\n     # from https://stackoverflow.com/a/36693250\n", "issue": "Add venv into docker image to enable editable `pip install`\nWhen trying to install composer with `pip install -e .` from within the docker image, we are seeing this error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/composer\", line 33, in <module>\r\n    sys.exit(load_entry_point('mosaicml', 'console_scripts', 'composer')())\r\n  File \"/usr/bin/composer\", line 22, in importlib_load_entry_point\r\n    for entry_point in distribution(dist_name).entry_points\r\n  File \"/usr/lib/python3.8/importlib/metadata.py\", line 445, in distribution\r\n    return Distribution.from_name(distribution_name)\r\n  File \"/usr/lib/python3.8/importlib/metadata.py\", line 169, in from_name\r\n    raise PackageNotFoundError(name)\r\nimportlib.metadata.PackageNotFoundError: mosaicml\r\n```\r\nThis seems to be remedied by running the `pip install` from within a virtualenv. Can we bake a virtualenv into the docker image as a workaround?\n", "before_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nimport os\nimport sys\nimport textwrap\n\nimport setuptools\nfrom setuptools import setup\n\n\ndef package_files(directory: str):\n    # from https://stackoverflow.com/a/36693250\n    paths = []\n    for (path, _, filenames) in os.walk(directory):\n        for filename in filenames:\n            paths.append(os.path.join('..', path, filename))\n    return paths\n\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\ninstall_requires = [\n    \"pyyaml>=5.4.1\",\n    \"tqdm>=4.62.3\",\n    \"torchmetrics>=0.6.0\",\n    \"torch_optimizer==0.1.0\",\n    \"torchvision>=0.9.0\",\n    \"torch>=1.9\",\n    \"yahp>=0.0.14\",\n    \"numpy==1.21.5\",\n]\nextra_deps = {}\n\nextra_deps['base'] = []\n\nextra_deps['dev'] = [\n    \"custom_inherit==2.3.2\",\n    'junitparser>=2.1.1',\n    'coverage[toml]>=6.1.1',\n    'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners\n    'pytest>=6.2.0',\n    'yapf>=0.13.0',\n    'isort>=5.9.3',\n    'ipython>=7.29.0',\n    'ipykernel>=6.5.0',\n    'jupyter>=1.0.0',\n    'yamllint>=1.26.2',\n    'pytest-timeout>=1.4.2',\n    'recommonmark>=0.7.1',\n    'sphinx>=4.2.0',\n    'sphinx_copybutton>=0.4.0',\n    'sphinx_markdown_tables>=0.0.15',\n    'sphinx-argparse>=0.3.1',\n    'sphinxcontrib.katex>=0.8.6',\n    'sphinxext.opengraph>=0.4.2',\n    'sphinxemoji>=0.2.0',\n    'sphinx_rtd_theme>=1.0.0',\n    'testbook>=0.4.2',\n    'myst-parser>=0.15.2',\n]\nextra_deps['logging'] = ['wandb>=0.12.2', 'apache-libcloud>=3.4.1']\n\nextra_deps['nlp'] = [\n    'transformers>=4.11.3',\n    'datasets>=1.14.0',\n]\n\nextra_deps['unet'] = [\n    'monai>=0.7.0',\n    'scikit-learn>=1.0.1',\n]\n\nextra_deps['deepspeed'] = [\n    'deepspeed>=0.5.5',\n]\n\nextra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)\n\nsetup(\n    name=\"mosaicml\",\n    version=\"0.3.1\",\n    author=\"MosaicML\",\n    author_email=\"team@mosaicml.com\",\n    description=\"composing methods for ML training efficiency\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/mosaicml/composer\",\n    include_package_data=True,\n    package_data={\n        \"composer\": ['py.typed'],\n        \"\": package_files('composer/yamls'),\n    },\n    packages=setuptools.find_packages(exclude=[\"tests*\"]),\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n    ],\n    install_requires=install_requires,\n    entry_points={\n        'console_scripts': ['composer = composer.cli.launcher:main',],\n    },\n    extras_require=extra_deps,\n    dependency_links=['https://developer.download.nvidia.com/compute/redist'],\n    python_requires='>=3.7',\n    ext_package=\"composer\",\n)\n\n# only visible if user installs with verbose -v flag\n# Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)\nprint(\"*\" * 20, file=sys.stderr)\nprint(textwrap.dedent(\"\"\"NOTE: For best performance, we recommend installing Pillow-SIMD\n    for accelerated image processing operations. To install:\n    \\t pip uninstall pillow && pip install pillow-simd\"\"\"),\n      file=sys.stderr)\nprint(\"*\" * 20, file=sys.stderr)\n", "path": "setup.py"}]}