code: def main():
      if not os.environ.get("VIRTUAL_ENV"):
          sys.stderr.write(
              "Not in a virtualenv. You probably don't want to do this.\n"
          )
          sys.exit(1)
      tmpdir = tempfile.TemporaryDirectory()
  
      thisdir = pathlib.Path(os.path.dirname(__file__))
      server_binary = thisdir / ".." / "server"
      build_script = thisdir / "build"
  
      try:
          result = _shell(
              [
                  build_script,
                  "--server-binary=%s" % (server_binary,),
                  "--out-dir=%s" % (tmpdir.name,),
              ],
              capture_output=True,
          )
      except subprocess.CalledProcessError as e:
          sys.stdout.buffer.write(e.stdout)
          sys.stdout.flush()
          sys.stderr.buffer.write(e.stderr)
          sys.stderr.flush()
          raise
  
      lines = result.stdout.decode("utf-8").splitlines()
      if len(lines) != 1:
          raise RuntimeError(
              "Expected one line of stdout; got: %r" % lines
          )
      wheel = lines[0]
  
      _shell(["pip", "uninstall", "-y", "tensorboard_data_server"])
      _shell(["pip", "install", "--", wheel])
  
imports: import os
  import pathlib
  import subprocess
  import sys
  import tempfile
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types