prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  opentelemetry-instrument command fails if incompatible instrumentation is found
  If an instrumentation is installed for a library that is not found in the environment, the instrument command raises the following exception:
  
  
  ```
  ❯ opentelemetry-instrument python main.py
  Instrumenting of flask failed
  Traceback (most recent call last):
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 71, in _load_instrumentors
      conflict = get_dist_dependency_conflicts(entry_point.dist)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py", line 33, in get_dist_dependency_conflicts
      return get_dependency_conflicts(deps)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py", line 41, in get_dependency_conflicts
      get_distribution(str(dep))
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 482, in get_distribution
      dist = get_provider(dist)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 358, in get_provider
      return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  IndexError: list index out of range
  Failed to auto initialize opentelemetry
  Traceback (most recent call last):
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 111, in initialize
      _load_instrumentors(distro)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 85, in _load_instrumentors
      raise exc
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 71, in _load_instrumentors
      conflict = get_dist_dependency_conflicts(entry_point.dist)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py", line 33, in get_dist_dependency_conflicts
      return get_dependency_conflicts(deps)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py", line 41, in get_dependency_conflicts
      get_distribution(str(dep))
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 482, in get_distribution
      dist = get_provider(dist)
    File "/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 358, in get_provider
      return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  IndexError: list index out of range
  ```
  
  bootstrap command does not install any instrumentations for libraries that are not present in the environment so this would only happen if someone manually installed an instrumentation package for a library they're not using. So this is not a deal breaker and doesn't require an immediate hotfix. That said, this IS a bug as the intended behavior of instrument command is to silently ignore such instrumentations.
  
  </issue>
  <code>
  [start of opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py]
  1 from typing import Collection, Optional
  2 
  3 from pkg_resources import (
  4     Distribution,
  5     DistributionNotFound,
  6     VersionConflict,
  7     get_distribution,
  8 )
  9 
  10 
  11 class DependencyConflict:
  12     required: str = None
  13     found: Optional[str] = None
  14 
  15     def __init__(self, required, found=None):
  16         self.required = required
  17         self.found = found
  18 
  19     def __str__(self):
  20         return 'DependencyConflict: requested: "{0}" but found: "{1}"'.format(
  21             self.required, self.found
  22         )
  23 
  24 
  25 def get_dist_dependency_conflicts(
  26     dist: Distribution,
  27 ) -> Optional[DependencyConflict]:
  28     deps = [
  29         dep
  30         for dep in dist.requires(("instruments",))
  31         if dep not in dist.requires()
  32     ]
  33     return get_dependency_conflicts(deps)
  34 
  35 
  36 def get_dependency_conflicts(
  37     deps: Collection[str],
  38 ) -> Optional[DependencyConflict]:
  39     for dep in deps:
  40         try:
  41             get_distribution(str(dep))
  42         except VersionConflict as exc:
  43             return DependencyConflict(dep, exc.dist)
  44         except DistributionNotFound:
  45             return DependencyConflict(dep)
  46     return None
  47
  [end of opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.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/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py
  --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py
  +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py
  @@ -1,12 +1,16 @@
  +from logging import getLogger
   from typing import Collection, Optional
   
   from pkg_resources import (
       Distribution,
       DistributionNotFound,
  +    RequirementParseError,
       VersionConflict,
       get_distribution,
   )
   
  +logger = getLogger(__file__)
  +
   
   class DependencyConflict:
       required: str = None
  @@ -25,12 +29,19 @@
   def get_dist_dependency_conflicts(
       dist: Distribution,
   ) -> Optional[DependencyConflict]:
  -    deps = [
  -        dep
  -        for dep in dist.requires(("instruments",))
  -        if dep not in dist.requires()
  -    ]
  -    return get_dependency_conflicts(deps)
  +    main_deps = dist.requires()
  +    instrumentation_deps = []
  +    for dep in dist.requires(("instruments",)):
  +        if dep not in main_deps:
  +            # we set marker to none so string representation of the dependency looks like
  +            #    requests ~= 1.0
  +            # instead of
  +            #    requests ~= 1.0; extra = "instruments"
  +            # which does not work with `get_distribution()`
  +            dep.marker = None
  +            instrumentation_deps.append(str(dep))
  +
  +    return get_dependency_conflicts(instrumentation_deps)
   
   
   def get_dependency_conflicts(
  @@ -38,9 +49,16 @@
   ) -> Optional[DependencyConflict]:
       for dep in deps:
           try:
  -            get_distribution(str(dep))
  +            get_distribution(dep)
           except VersionConflict as exc:
               return DependencyConflict(dep, exc.dist)
           except DistributionNotFound:
               return DependencyConflict(dep)
  +        except RequirementParseError as exc:
  +            logger.warning(
  +                'error parsing dependency, reporting as a conflict: "%s" - %s',
  +                dep,
  +                exc,
  +            )
  +            return DependencyConflict(dep)
       return None
  
verification_info: {"golden_diff": "diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py\n--- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py\n+++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py\n@@ -1,12 +1,16 @@\n+from logging import getLogger\n from typing import Collection, Optional\n \n from pkg_resources import (\n     Distribution,\n     DistributionNotFound,\n+    RequirementParseError,\n     VersionConflict,\n     get_distribution,\n )\n \n+logger = getLogger(__file__)\n+\n \n class DependencyConflict:\n     required: str = None\n@@ -25,12 +29,19 @@\n def get_dist_dependency_conflicts(\n     dist: Distribution,\n ) -> Optional[DependencyConflict]:\n-    deps = [\n-        dep\n-        for dep in dist.requires((\"instruments\",))\n-        if dep not in dist.requires()\n-    ]\n-    return get_dependency_conflicts(deps)\n+    main_deps = dist.requires()\n+    instrumentation_deps = []\n+    for dep in dist.requires((\"instruments\",)):\n+        if dep not in main_deps:\n+            # we set marker to none so string representation of the dependency looks like\n+            #    requests ~= 1.0\n+            # instead of\n+            #    requests ~= 1.0; extra = \"instruments\"\n+            # which does not work with `get_distribution()`\n+            dep.marker = None\n+            instrumentation_deps.append(str(dep))\n+\n+    return get_dependency_conflicts(instrumentation_deps)\n \n \n def get_dependency_conflicts(\n@@ -38,9 +49,16 @@\n ) -> Optional[DependencyConflict]:\n     for dep in deps:\n         try:\n-            get_distribution(str(dep))\n+            get_distribution(dep)\n         except VersionConflict as exc:\n             return DependencyConflict(dep, exc.dist)\n         except DistributionNotFound:\n             return DependencyConflict(dep)\n+        except RequirementParseError as exc:\n+            logger.warning(\n+                'error parsing dependency, reporting as a conflict: \"%s\" - %s',\n+                dep,\n+                exc,\n+            )\n+            return DependencyConflict(dep)\n     return None\n", "issue": "opentelemetry-instrument command fails if incompatible instrumentation is found\nIf an instrumentation is installed for a library that is not found in the environment, the instrument command raises the following exception:\r\n\r\n\r\n```\r\n\u276f opentelemetry-instrument python main.py\r\nInstrumenting of flask failed\r\nTraceback (most recent call last):\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py\", line 71, in _load_instrumentors\r\n    conflict = get_dist_dependency_conflicts(entry_point.dist)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py\", line 33, in get_dist_dependency_conflicts\r\n    return get_dependency_conflicts(deps)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py\", line 41, in get_dependency_conflicts\r\n    get_distribution(str(dep))\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py\", line 482, in get_distribution\r\n    dist = get_provider(dist)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py\", line 358, in get_provider\r\n    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]\r\nIndexError: list index out of range\r\nFailed to auto initialize opentelemetry\r\nTraceback (most recent call last):\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py\", line 111, in initialize\r\n    _load_instrumentors(distro)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py\", line 85, in _load_instrumentors\r\n    raise exc\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py\", line 71, in _load_instrumentors\r\n    conflict = get_dist_dependency_conflicts(entry_point.dist)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py\", line 33, in get_dist_dependency_conflicts\r\n    return get_dependency_conflicts(deps)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/opentelemetry/instrumentation/dependencies.py\", line 41, in get_dependency_conflicts\r\n    get_distribution(str(dep))\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py\", line 482, in get_distribution\r\n    dist = get_provider(dist)\r\n  File \"/Users/olone/playground/splunk-otel-py/venv/lib/python3.8/site-packages/pkg_resources/__init__.py\", line 358, in get_provider\r\n    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]\r\nIndexError: list index out of range\r\n```\r\n\r\nbootstrap command does not install any instrumentations for libraries that are not present in the environment so this would only happen if someone manually installed an instrumentation package for a library they're not using. So this is not a deal breaker and doesn't require an immediate hotfix. That said, this IS a bug as the intended behavior of instrument command is to silently ignore such instrumentations.\n", "before_files": [{"content": "from typing import Collection, Optional\n\nfrom pkg_resources import (\n    Distribution,\n    DistributionNotFound,\n    VersionConflict,\n    get_distribution,\n)\n\n\nclass DependencyConflict:\n    required: str = None\n    found: Optional[str] = None\n\n    def __init__(self, required, found=None):\n        self.required = required\n        self.found = found\n\n    def __str__(self):\n        return 'DependencyConflict: requested: \"{0}\" but found: \"{1}\"'.format(\n            self.required, self.found\n        )\n\n\ndef get_dist_dependency_conflicts(\n    dist: Distribution,\n) -> Optional[DependencyConflict]:\n    deps = [\n        dep\n        for dep in dist.requires((\"instruments\",))\n        if dep not in dist.requires()\n    ]\n    return get_dependency_conflicts(deps)\n\n\ndef get_dependency_conflicts(\n    deps: Collection[str],\n) -> Optional[DependencyConflict]:\n    for dep in deps:\n        try:\n            get_distribution(str(dep))\n        except VersionConflict as exc:\n            return DependencyConflict(dep, exc.dist)\n        except DistributionNotFound:\n            return DependencyConflict(dep)\n    return None\n", "path": "opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py"}]}