prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  fiftyone fails to import if not installed in a virtual environment
  Due to at least https://github.com/voxel51/fiftyone/blob/v0.1.3/fiftyone/constants.py#L32
  
  </issue>
  <code>
  [start of fiftyone/constants.py]
  1 """
  2 Package-wide constants.
  3 
  4 | Copyright 2017-2020, Voxel51, Inc.
  5 | `voxel51.com <https://voxel51.com/>`_
  6 |
  7 """
  8 # pragma pylint: disable=redefined-builtin
  9 # pragma pylint: disable=unused-wildcard-import
  10 # pragma pylint: disable=wildcard-import
  11 from __future__ import absolute_import
  12 from __future__ import division
  13 from __future__ import print_function
  14 from __future__ import unicode_literals
  15 from builtins import *
  16 
  17 # pragma pylint: enable=redefined-builtin
  18 # pragma pylint: enable=unused-wildcard-import
  19 # pragma pylint: enable=wildcard-import
  20 
  21 import os
  22 import sys
  23 
  24 try:
  25     from importlib.metadata import metadata  # Python 3.8
  26 except ImportError:
  27     from importlib_metadata import metadata  # Python < 3.8
  28 
  29 
  30 # Directories
  31 FIFTYONE_DIR = os.path.abspath(os.path.dirname(__file__))
  32 FIFTYONE_ENV = os.environ["VIRTUAL_ENV"]
  33 FIFTYONE_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".fiftyone")
  34 FIFTYONE_CONFIG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, "config.json")
  35 BASE_DIR = os.path.dirname(FIFTYONE_DIR)
  36 EXAMPLES_DIR = os.path.join(FIFTYONE_DIR, "examples")
  37 if not os.path.isdir(EXAMPLES_DIR):
  38     EXAMPLES_DIR = os.path.join(BASE_DIR, "examples")
  39 
  40 # Package metadata
  41 _META = metadata("fiftyone")
  42 NAME = _META["name"]
  43 VERSION = _META["version"]
  44 DESCRIPTION = _META["summary"]
  45 AUTHOR = _META["author"]
  46 AUTHOR_EMAIL = _META["author-email"]
  47 URL = _META["home-page"]
  48 LICENSE = _META["license"]
  49 VERSION_LONG = "%s v%s, %s" % (NAME, VERSION, AUTHOR)
  50 
  51 # MongoDB setup
  52 try:
  53     from fiftyone.db import FIFTYONE_DB_BIN_DIR
  54 except ImportError:
  55     # development installation
  56     FIFTYONE_DB_BIN_DIR = os.path.join(FIFTYONE_CONFIG_DIR, "bin")
  57 DB_PATH = os.path.join(FIFTYONE_CONFIG_DIR, "var/lib/mongo")
  58 DB_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, "mongod")
  59 DB_CLIENT_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, "mongo")
  60 DB_LOG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, "var/log/mongodb/mongo.log")
  61 os.environ["PATH"] = os.pathsep.join([FIFTYONE_CONFIG_DIR, os.environ["PATH"]])
  62 START_DB = [
  63     DB_BIN_PATH,
  64     "--dbpath",
  65     DB_PATH,
  66     "--logpath",
  67     DB_LOG_PATH,
  68     "--fork",
  69 ]
  70 STOP_DB = " ".join(
  71     [
  72         DB_CLIENT_BIN_PATH,
  73         "--eval",
  74         '''"db.getSiblingDB('admin').shutdownServer()"''',
  75         ">/dev/null 2>&1",
  76     ]
  77 )
  78 
  79 if sys.platform.startswith("linux"):
  80     _STOP_SERVICE = "fuser -k %d/tcp >/dev/null 2>&1"
  81 
  82 elif sys.platform == "darwin":
  83     _STOP_SERVICE = (
  84         "lsof -i tcp:%d | grep -v PID | awk '{print $2}' | xargs kill"
  85     )
  86 
  87 else:
  88     raise OSError("Unsupported OS: %s" % sys.platform)
  89 
  90 # Server setup
  91 SERVER_DIR = os.path.join(FIFTYONE_DIR, "server")
  92 SERVER_ADDR = "http://127.0.0.1:%d"
  93 START_SERVER = [
  94     "gunicorn",
  95     "-w",
  96     "1",
  97     "--worker-class",
  98     "eventlet",
  99     "-b",
  100     "127.0.0.1:%d",
  101     "main:app",
  102     "--daemon",
  103     "--reload",
  104 ]
  105 
  106 STOP_SERVER = _STOP_SERVICE
  107 
  108 # App setup
  109 try:
  110     from fiftyone.gui import FIFTYONE_APP_DIR
  111 except ImportError:
  112     FIFTYONE_APP_DIR = os.path.join(FIFTYONE_DIR, "../electron")
  113
  [end of fiftyone/constants.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/fiftyone/constants.py b/fiftyone/constants.py
  --- a/fiftyone/constants.py
  +++ b/fiftyone/constants.py
  @@ -29,7 +29,6 @@
   
   # Directories
   FIFTYONE_DIR = os.path.abspath(os.path.dirname(__file__))
  -FIFTYONE_ENV = os.environ["VIRTUAL_ENV"]
   FIFTYONE_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".fiftyone")
   FIFTYONE_CONFIG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, "config.json")
   BASE_DIR = os.path.dirname(FIFTYONE_DIR)
  @@ -58,7 +57,6 @@
   DB_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, "mongod")
   DB_CLIENT_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, "mongo")
   DB_LOG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, "var/log/mongodb/mongo.log")
  -os.environ["PATH"] = os.pathsep.join([FIFTYONE_CONFIG_DIR, os.environ["PATH"]])
   START_DB = [
       DB_BIN_PATH,
       "--dbpath",
  
verification_info: {"golden_diff": "diff --git a/fiftyone/constants.py b/fiftyone/constants.py\n--- a/fiftyone/constants.py\n+++ b/fiftyone/constants.py\n@@ -29,7 +29,6 @@\n \n # Directories\n FIFTYONE_DIR = os.path.abspath(os.path.dirname(__file__))\n-FIFTYONE_ENV = os.environ[\"VIRTUAL_ENV\"]\n FIFTYONE_CONFIG_DIR = os.path.join(os.path.expanduser(\"~\"), \".fiftyone\")\n FIFTYONE_CONFIG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, \"config.json\")\n BASE_DIR = os.path.dirname(FIFTYONE_DIR)\n@@ -58,7 +57,6 @@\n DB_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, \"mongod\")\n DB_CLIENT_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, \"mongo\")\n DB_LOG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, \"var/log/mongodb/mongo.log\")\n-os.environ[\"PATH\"] = os.pathsep.join([FIFTYONE_CONFIG_DIR, os.environ[\"PATH\"]])\n START_DB = [\n     DB_BIN_PATH,\n     \"--dbpath\",\n", "issue": "fiftyone fails to import if not installed in a virtual environment\nDue to at least https://github.com/voxel51/fiftyone/blob/v0.1.3/fiftyone/constants.py#L32\n", "before_files": [{"content": "\"\"\"\nPackage-wide constants.\n\n| Copyright 2017-2020, Voxel51, Inc.\n| `voxel51.com <https://voxel51.com/>`_\n|\n\"\"\"\n# pragma pylint: disable=redefined-builtin\n# pragma pylint: disable=unused-wildcard-import\n# pragma pylint: disable=wildcard-import\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom builtins import *\n\n# pragma pylint: enable=redefined-builtin\n# pragma pylint: enable=unused-wildcard-import\n# pragma pylint: enable=wildcard-import\n\nimport os\nimport sys\n\ntry:\n    from importlib.metadata import metadata  # Python 3.8\nexcept ImportError:\n    from importlib_metadata import metadata  # Python < 3.8\n\n\n# Directories\nFIFTYONE_DIR = os.path.abspath(os.path.dirname(__file__))\nFIFTYONE_ENV = os.environ[\"VIRTUAL_ENV\"]\nFIFTYONE_CONFIG_DIR = os.path.join(os.path.expanduser(\"~\"), \".fiftyone\")\nFIFTYONE_CONFIG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, \"config.json\")\nBASE_DIR = os.path.dirname(FIFTYONE_DIR)\nEXAMPLES_DIR = os.path.join(FIFTYONE_DIR, \"examples\")\nif not os.path.isdir(EXAMPLES_DIR):\n    EXAMPLES_DIR = os.path.join(BASE_DIR, \"examples\")\n\n# Package metadata\n_META = metadata(\"fiftyone\")\nNAME = _META[\"name\"]\nVERSION = _META[\"version\"]\nDESCRIPTION = _META[\"summary\"]\nAUTHOR = _META[\"author\"]\nAUTHOR_EMAIL = _META[\"author-email\"]\nURL = _META[\"home-page\"]\nLICENSE = _META[\"license\"]\nVERSION_LONG = \"%s v%s, %s\" % (NAME, VERSION, AUTHOR)\n\n# MongoDB setup\ntry:\n    from fiftyone.db import FIFTYONE_DB_BIN_DIR\nexcept ImportError:\n    # development installation\n    FIFTYONE_DB_BIN_DIR = os.path.join(FIFTYONE_CONFIG_DIR, \"bin\")\nDB_PATH = os.path.join(FIFTYONE_CONFIG_DIR, \"var/lib/mongo\")\nDB_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, \"mongod\")\nDB_CLIENT_BIN_PATH = os.path.join(FIFTYONE_DB_BIN_DIR, \"mongo\")\nDB_LOG_PATH = os.path.join(FIFTYONE_CONFIG_DIR, \"var/log/mongodb/mongo.log\")\nos.environ[\"PATH\"] = os.pathsep.join([FIFTYONE_CONFIG_DIR, os.environ[\"PATH\"]])\nSTART_DB = [\n    DB_BIN_PATH,\n    \"--dbpath\",\n    DB_PATH,\n    \"--logpath\",\n    DB_LOG_PATH,\n    \"--fork\",\n]\nSTOP_DB = \" \".join(\n    [\n        DB_CLIENT_BIN_PATH,\n        \"--eval\",\n        '''\"db.getSiblingDB('admin').shutdownServer()\"''',\n        \">/dev/null 2>&1\",\n    ]\n)\n\nif sys.platform.startswith(\"linux\"):\n    _STOP_SERVICE = \"fuser -k %d/tcp >/dev/null 2>&1\"\n\nelif sys.platform == \"darwin\":\n    _STOP_SERVICE = (\n        \"lsof -i tcp:%d | grep -v PID | awk '{print $2}' | xargs kill\"\n    )\n\nelse:\n    raise OSError(\"Unsupported OS: %s\" % sys.platform)\n\n# Server setup\nSERVER_DIR = os.path.join(FIFTYONE_DIR, \"server\")\nSERVER_ADDR = \"http://127.0.0.1:%d\"\nSTART_SERVER = [\n    \"gunicorn\",\n    \"-w\",\n    \"1\",\n    \"--worker-class\",\n    \"eventlet\",\n    \"-b\",\n    \"127.0.0.1:%d\",\n    \"main:app\",\n    \"--daemon\",\n    \"--reload\",\n]\n\nSTOP_SERVER = _STOP_SERVICE\n\n# App setup\ntry:\n    from fiftyone.gui import FIFTYONE_APP_DIR\nexcept ImportError:\n    FIFTYONE_APP_DIR = os.path.join(FIFTYONE_DIR, \"../electron\")\n", "path": "fiftyone/constants.py"}]}