From c32219b7bf7051a40dd0dd1380f40f0535747d97 Mon Sep 17 00:00:00 2001 From: John Agapiou Date: Wed, 11 Dec 2024 17:43:29 -0800 Subject: [PATCH] Update colab-specific install - only pip install if kernel is colab kernel - pip install in one command - rename examples/requirements.txt to requirements.in PiperOrigin-RevId: 705300112 Change-Id: I965c6386100e88c93d070a8956014c210c635a14 --- examples/brainstorm/brainstorm.ipynb | 22 +++++----- examples/cyberball/cyberball.ipynb | 22 +++++----- examples/example_with_scenes.ipynb | 22 +++++----- examples/magic_beans_for_sale.ipynb | 22 +++++----- examples/modular/notebook.ipynb | 41 ++++-------------- examples/phone/calendar.ipynb | 27 ++++-------- examples/pytorch_gemma_local.ipynb | 22 +++++----- .../{requirements.txt => requirements.in} | 1 + ...ing_cessation_in_an_alchemical_world.ipynb | 22 +++++----- examples/three_key_questions.ipynb | 25 +++++------ examples/tutorials/agent_basic_tutorial.ipynb | 42 ++++--------------- .../tutorials/agent_components_tutorial.ipynb | 42 ++++--------------- examples/tutorials/agent_development.ipynb | 42 ++++--------------- .../agent_development_GCP_Gemma2.ipynb | 42 ++++--------------- .../tutorials/deprecated_agent_tutorial.ipynb | 22 +++++----- examples/village/day_in_riverbend.ipynb | 22 +++++----- examples/village/riverbend_elections.ipynb | 22 +++++----- examples/whodunnit.ipynb | 22 +++++----- 18 files changed, 166 insertions(+), 316 deletions(-) rename examples/{requirements.txt => requirements.in} (74%) diff --git a/examples/brainstorm/brainstorm.ipynb b/examples/brainstorm/brainstorm.ipynb index 534f86ca..3812a28f 100644 --- a/examples/brainstorm/brainstorm.ipynb +++ b/examples/brainstorm/brainstorm.ipynb @@ -37,18 +37,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "-fmBHd6Wdc6H" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/cyberball/cyberball.ipynb b/examples/cyberball/cyberball.ipynb index 143ece81..b99d331a 100644 --- a/examples/cyberball/cyberball.ipynb +++ b/examples/cyberball/cyberball.ipynb @@ -39,18 +39,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "reWNIvR24HT6" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/example_with_scenes.ipynb b/examples/example_with_scenes.ipynb index a7d30b6c..25d62f0a 100644 --- a/examples/example_with_scenes.ipynb +++ b/examples/example_with_scenes.ipynb @@ -43,18 +43,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "B_JQ_dJDpBVC" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/magic_beans_for_sale.ipynb b/examples/magic_beans_for_sale.ipynb index 3c157c6b..d55ac49d 100644 --- a/examples/magic_beans_for_sale.ipynb +++ b/examples/magic_beans_for_sale.ipynb @@ -36,18 +36,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "8wj9r4GR0RF5" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/modular/notebook.ipynb b/examples/modular/notebook.ipynb index b0aa66f2..fd4a81ee 100644 --- a/examples/modular/notebook.ipynb +++ b/examples/modular/notebook.ipynb @@ -40,40 +40,17 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, - { - "metadata": { - "id": "HRk1RJZJHkJH" - }, - "cell_type": "code", - "source": [ - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" - ], - "outputs": [], - "execution_count": null - }, { "cell_type": "code", "execution_count": null, diff --git a/examples/phone/calendar.ipynb b/examples/phone/calendar.ipynb index fdb8c60b..89e3414c 100644 --- a/examples/phone/calendar.ipynb +++ b/examples/phone/calendar.ipynb @@ -39,24 +39,15 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/pytorch_gemma_local.ipynb b/examples/pytorch_gemma_local.ipynb index 7b9a2b35..6c713e18 100644 --- a/examples/pytorch_gemma_local.ipynb +++ b/examples/pytorch_gemma_local.ipynb @@ -19,18 +19,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "WvRB61fWVRpW" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/requirements.txt b/examples/requirements.in similarity index 74% rename from examples/requirements.txt rename to examples/requirements.in index 7fdc3cad..4f6a7099 100644 --- a/examples/requirements.txt +++ b/examples/requirements.in @@ -1,3 +1,4 @@ +# Requirements for the Concordia examples. absl-py docstring-parser gdm-concordia diff --git a/examples/smoking_cessation_in_an_alchemical_world.ipynb b/examples/smoking_cessation_in_an_alchemical_world.ipynb index 4c5c61bd..2c4e0740 100644 --- a/examples/smoking_cessation_in_an_alchemical_world.ipynb +++ b/examples/smoking_cessation_in_an_alchemical_world.ipynb @@ -35,18 +35,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "B_JQ_dJDpBVC" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/three_key_questions.ipynb b/examples/three_key_questions.ipynb index 5033fb38..5509e5d1 100644 --- a/examples/three_key_questions.ipynb +++ b/examples/three_key_questions.ipynb @@ -43,18 +43,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "reWNIvR24HT6" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { @@ -452,8 +450,7 @@ " # All players get the same `measurements` object.\n", " [measurements] * NUM_PLAYERS):\n", " players.append(agent)\n", - " memories[agent.name] = mem\n", - "\n" + " memories[agent.name] = mem\n" ] }, { diff --git a/examples/tutorials/agent_basic_tutorial.ipynb b/examples/tutorials/agent_basic_tutorial.ipynb index 1b7cb772..6f92dc81 100644 --- a/examples/tutorials/agent_basic_tutorial.ipynb +++ b/examples/tutorials/agent_basic_tutorial.ipynb @@ -31,41 +31,17 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, - { - "metadata": { - "id": "kKdI8JqvJgPN" - }, - "cell_type": "code", - "source": [ - "import sys\n", - "import os\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" - ], - "outputs": [], - "execution_count": null - }, { "cell_type": "code", "execution_count": null, diff --git a/examples/tutorials/agent_components_tutorial.ipynb b/examples/tutorials/agent_components_tutorial.ipynb index 2c97084a..22c3ea41 100644 --- a/examples/tutorials/agent_components_tutorial.ipynb +++ b/examples/tutorials/agent_components_tutorial.ipynb @@ -31,41 +31,17 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, - { - "metadata": { - "id": "zJ7rNKHHJame" - }, - "cell_type": "code", - "source": [ - "import sys\n", - "import os\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" - ], - "outputs": [], - "execution_count": null - }, { "cell_type": "code", "execution_count": null, diff --git a/examples/tutorials/agent_development.ipynb b/examples/tutorials/agent_development.ipynb index ba1210f2..b734ad9b 100644 --- a/examples/tutorials/agent_development.ipynb +++ b/examples/tutorials/agent_development.ipynb @@ -48,41 +48,17 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, - { - "metadata": { - "id": "TNRcsA1HHYwB" - }, - "cell_type": "code", - "source": [ - "import sys\n", - "import os\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" - ], - "outputs": [], - "execution_count": null - }, { "cell_type": "code", "execution_count": null, diff --git a/examples/tutorials/agent_development_GCP_Gemma2.ipynb b/examples/tutorials/agent_development_GCP_Gemma2.ipynb index fd2fe233..8393f5e2 100644 --- a/examples/tutorials/agent_development_GCP_Gemma2.ipynb +++ b/examples/tutorials/agent_development_GCP_Gemma2.ipynb @@ -52,41 +52,17 @@ "outputs": [], "source": [ "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", - "\n", - "import os\n", - "import sys\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Download the source code.\n", - " if not os.path.exists(project_root):\n", - " !git clone https://github.com/google-deepmind/concordia.git\n", - "\n", - " # Install concordia and dependencies.\n", - " %pip install --ignore-requires-python -e /content/concordia\n", - " %pip install -r /content/concordia/examples/requirements.txt\n" + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, - { - "metadata": { - "id": "TNRcsA1HHYwB" - }, - "cell_type": "code", - "source": [ - "import sys\n", - "import os\n", - "\n", - "if os.getenv(\"COLAB_RELEASE_TAG\"):\n", - " project_root = '/content/concordia'\n", - "\n", - " # Add root to python path.\n", - " if project_root not in sys.path:\n", - " sys.path.append(project_root)" - ], - "outputs": [], - "execution_count": null - }, { "cell_type": "code", "execution_count": null, diff --git a/examples/tutorials/deprecated_agent_tutorial.ipynb b/examples/tutorials/deprecated_agent_tutorial.ipynb index fa06dd3f..322012bb 100644 --- a/examples/tutorials/deprecated_agent_tutorial.ipynb +++ b/examples/tutorials/deprecated_agent_tutorial.ipynb @@ -45,18 +45,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "bMcepBU-15WP" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/village/day_in_riverbend.ipynb b/examples/village/day_in_riverbend.ipynb index 0127b44c..a8023d12 100644 --- a/examples/village/day_in_riverbend.ipynb +++ b/examples/village/day_in_riverbend.ipynb @@ -39,18 +39,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "reWNIvR24HT6" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/village/riverbend_elections.ipynb b/examples/village/riverbend_elections.ipynb index 136e007d..a759beff 100644 --- a/examples/village/riverbend_elections.ipynb +++ b/examples/village/riverbend_elections.ipynb @@ -37,18 +37,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "reWNIvR24HT6" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, { diff --git a/examples/whodunnit.ipynb b/examples/whodunnit.ipynb index 8c8ce100..68e4a1e9 100644 --- a/examples/whodunnit.ipynb +++ b/examples/whodunnit.ipynb @@ -37,18 +37,16 @@ }, "outputs": [], "source": [ - "%pip install --ignore-requires-python git+https://github.com/google-deepmind/concordia.git" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "B_JQ_dJDpBVC" - }, - "outputs": [], - "source": [ - "%pip install -r https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.txt" + "# @title Colab-specific setup (use a CodeSpace to avoid the need for this).\n", + "try:\n", + " %env COLAB_RELEASE_TAG\n", + "except:\n", + " pass # Not running in colab.\n", + "else:\n", + " %pip install --ignore-requires-python \\\n", + " --requirement 'https://raw.githubusercontent.com/google-deepmind/concordia/main/examples/requirements.in' \\\n", + " 'git+https://github.com/google-deepmind/concordia.git#egg=gdm-concordia'\n", + " %pip list" ] }, {