# Buggy code
def run(self):
    working_directory = os.path.abspath(os.getcwd() + "/../")
    virtualenv_bin = os.path.dirname(sys.executable)
    pip = "%s/pip" % virtualenv_bin

    # Install the GRR server component to satisfy the dependency below.
    subprocess.check_call(
        [sys.executable, pip, "install", ".[Server]"], cwd=working_directory
    )

    # Install the grr-response-server metapackage to get all the entry points.
    subprocess.check_call(
        [sys.executable, pip, "install", "."],
        cwd=working_directory + "/grr/config/grr-response-server/",
    )

    major_minor_version = ".".join(
        pkg_resources.get_distribution("grr-response-core").version.split(".")[0:2]
    )
    subprocess.check_call(
        [
            sys.executable,
            pip,
            "install",
            "-f",
            "https://storage.googleapis.com/releases.grr-response.com/index.html",
            "grr-response-templates==%s.*" % major_minor_version,
        ],
        cwd=working_directory,
    )


# Traceback (IOError)
Traceback (most recent call last):
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/gui/http_api.py", line 415, in HandleRequest
rendered_data = self.CallApiHandler(handler, args, token=token)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/gui/http_api.py", line 225, in CallApiHandler
return handler.Render(args, token=token)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/gui/api_plugins/config.py", line 80, in Render
parameter_data = RenderConfigOption(parameter)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/gui/api_plugins/config.py", line 25, in RenderConfigOption
option_value = config_lib.CONFIG.Get(name)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 1162, in Get
type_info_obj=type_info_obj, context=calc_context)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 1291, in InterpolateValue
parameter=type_info_obj.name, context=context).Parse()
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 671, in Parse
self.Close()
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/lexer.py", line 187, in Close
while self.NextToken():
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/lexer.py", line 127, in NextToken
possible_next_state = cb(string=m.group(0), match=m)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 657, in ExpandArg
final_value = self.config.Get(parameter_name, context=self.context)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 1162, in Get
type_info_obj=type_info_obj, context=calc_context)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 1291, in InterpolateValue
parameter=type_info_obj.name, context=context).Parse()
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 671, in Parse
self.Close()
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/lexer.py", line 187, in Close
while self.NextToken():
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/lexer.py", line 127, in NextToken
possible_next_state = cb(string=m.group(0), match=m)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 640, in Filter
arg = filter_object().Filter(arg)
File "/home/dev/GRR_ENV/local/lib/python2.7/site-packages/grr/lib/config_lib.py", line 220, in Filter
raise IOError("Unable to find resource %s" % filename)
IOError: Unable to find resource test_data

# Fixed code
def run(self):
    working_directory = os.path.abspath(os.getcwd() + "/../")
    virtualenv_bin = os.path.dirname(sys.executable)
    pip = "%s/pip" % virtualenv_bin

    # Install the GRR server component to satisfy the dependency below.
    subprocess.check_call([sys.executable, pip, "install", "."], cwd=working_directory)

    # Install the grr-response-server metapackage to get the remaining
    # dependencies and the entry points.
    subprocess.check_call(
        [sys.executable, pip, "install", "."],
        cwd=working_directory + "/grr/config/grr-response-server/",
    )

    major_minor_version = ".".join(
        pkg_resources.get_distribution("grr-response-core").version.split(".")[0:2]
    )
    subprocess.check_call(
        [
            sys.executable,
            pip,
            "install",
            "-f",
            "https://storage.googleapis.com/releases.grr-response.com/index.html",
            "grr-response-templates==%s.*" % major_minor_version,
        ],
        cwd=working_directory,
    )