prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Poetry install takes too long and installs the package again unnecessarily
  <!--
    Hi there! Thank you for wanting to make Poetry better.
  
    Before you submit this; let's make sure of a few things.
    Please make sure the following boxes are ticked if they are correct.
    If not, please try and fulfill these first.
  -->
  
  <!-- Checked checkbox should look like this: [x] -->
  - [X] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
  
  ## Issue
  <!-- Now feel free to write your idea for improvement. Thanks again 🙌 ❤️ -->
  
  I'm wondering why it takes 13-30 seconds to install my package (on two different machines). 
  This occurs when the package and it's dependencies are already installed.
  `$ time poetry install -vvv
  Using virtualenv: /Users/apayne/Envs/smithers
  Installing dependencies from lock file
  
  Nothing to install or update
  
    - Skipping markupsafe (1.1.0) Already installed
    - Skipping click (7.0) Already installed
    - Skipping itsdangerous (1.1.0) Already installed
    - Skipping jinja2 (2.10) Already installed
    - Skipping werkzeug (0.14.1) Already installed
    - Skipping aniso8601 (4.0.1) Already installed
    - Skipping flask (1.0.2) Already installed
    - Skipping jsonschema (2.6.0) Already installed
    - Skipping pytz (2018.7) Already installed
    - Skipping six (1.11.0) Already installed
    - Skipping flask-restplus (0.12.1) Already installed
    - Skipping passlib (1.7.1) Already installed
    - Skipping peewee (3.7.1) Already installed
    - Installing smithers (0.1.0)
  
  real	0m29.542s
  user	0m5.344s
  sys 0m2.370s`
  
  Smithers is the name of the package I'm installing with poetry.  The installing smithers step takes the majority of the time.  Is poetry doing anything but creating a symlink?  I don't understand why this should take so long.  If the package is already installed in editable mode, why does poetry try installing it again?
  
  Much thanks!
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `poetry/console/commands/install.py`
  Content:
  ```
  1 import os
  2 
  3 from .env_command import EnvCommand
  4 
  5 
  6 class InstallCommand(EnvCommand):
  7     """
  8     Installs the project dependencies.
  9 
  10     install
  11         { --no-dev : Do not install dev dependencies. }
  12         { --dry-run : Outputs the operations but will not execute anything
  13                       (implicitly enables --verbose). }
  14         { --E|extras=* : Extra sets of dependencies to install. }
  15         { --develop=* : Install given packages in development mode. }
  16     """
  17 
  18     help = """The <info>install</info> command reads the <comment>poetry.lock</> file from
  19 the current directory, processes it, and downloads and installs all the
  20 libraries and dependencies outlined in that file. If the file does not
  21 exist it will look for <comment>pyproject.toml</> and do the same.
  22 
  23 <info>poetry install</info>
  24 """
  25 
  26     _loggers = ["poetry.repositories.pypi_repository"]
  27 
  28     def handle(self):
  29         from clikit.io import NullIO
  30         from poetry.installation import Installer
  31         from poetry.masonry.builders import SdistBuilder
  32         from poetry.masonry.utils.module import ModuleOrPackageNotFound
  33         from poetry.utils._compat import decode
  34         from poetry.utils.env import NullEnv
  35 
  36         installer = Installer(
  37             self.io, self.env, self.poetry.package, self.poetry.locker, self.poetry.pool
  38         )
  39 
  40         extras = []
  41         for extra in self.option("extras"):
  42             if " " in extra:
  43                 extras += [e.strip() for e in extra.split(" ")]
  44             else:
  45                 extras.append(extra)
  46 
  47         installer.extras(extras)
  48         installer.dev_mode(not self.option("no-dev"))
  49         installer.develop(self.option("develop"))
  50         installer.dry_run(self.option("dry-run"))
  51         installer.verbose(self.option("verbose"))
  52 
  53         return_code = installer.run()
  54 
  55         if return_code != 0:
  56             return return_code
  57 
  58         try:
  59             builder = SdistBuilder(self.poetry, NullEnv(), NullIO())
  60         except ModuleOrPackageNotFound:
  61             # This is likely due to the fact that the project is an application
  62             # not following the structure expected by Poetry
  63             # If this is a true error it will be picked up later by build anyway.
  64             return 0
  65 
  66         self.line(
  67             "  - Installing <info>{}</info> (<comment>{}</comment>)".format(
  68                 self.poetry.package.pretty_name, self.poetry.package.pretty_version
  69             )
  70         )
  71 
  72         if self.option("dry-run"):
  73             return 0
  74 
  75         setup = self.poetry.file.parent / "setup.py"
  76         has_setup = setup.exists()
  77 
  78         if has_setup:
  79             self.line("<warning>A setup.py file already exists. Using it.</warning>")
  80         else:
  81             with setup.open("w", encoding="utf-8") as f:
  82                 f.write(decode(builder.build_setup()))
  83 
  84         try:
  85             self.env.run("pip", "install", "-e", str(setup.parent), "--no-deps")
  86         finally:
  87             if not has_setup:
  88                 os.remove(str(setup))
  89
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/poetry/console/commands/install.py b/poetry/console/commands/install.py
  --- a/poetry/console/commands/install.py
  +++ b/poetry/console/commands/install.py
  @@ -9,6 +9,7 @@
   
       install
           { --no-dev : Do not install dev dependencies. }
  +        { --no-root : Do not install the root package (your project). }
           { --dry-run : Outputs the operations but will not execute anything
                         (implicitly enables --verbose). }
           { --E|extras=* : Extra sets of dependencies to install. }
  @@ -55,6 +56,9 @@
           if return_code != 0:
               return return_code
   
  +        if not self.option("no-root"):
  +            return 0
  +
           try:
               builder = SdistBuilder(self.poetry, NullEnv(), NullIO())
           except ModuleOrPackageNotFound:
  
verification_info: {"golden_diff": "diff --git a/poetry/console/commands/install.py b/poetry/console/commands/install.py\n--- a/poetry/console/commands/install.py\n+++ b/poetry/console/commands/install.py\n@@ -9,6 +9,7 @@\n \n     install\n         { --no-dev : Do not install dev dependencies. }\n+        { --no-root : Do not install the root package (your project). }\n         { --dry-run : Outputs the operations but will not execute anything\n                       (implicitly enables --verbose). }\n         { --E|extras=* : Extra sets of dependencies to install. }\n@@ -55,6 +56,9 @@\n         if return_code != 0:\n             return return_code\n \n+        if not self.option(\"no-root\"):\n+            return 0\n+\n         try:\n             builder = SdistBuilder(self.poetry, NullEnv(), NullIO())\n         except ModuleOrPackageNotFound:\n", "issue": "Poetry install takes too long and installs the package again unnecessarily\n<!--\r\n  Hi there! Thank you for wanting to make Poetry better.\r\n\r\n  Before you submit this; let's make sure of a few things.\r\n  Please make sure the following boxes are ticked if they are correct.\r\n  If not, please try and fulfill these first.\r\n-->\r\n\r\n<!-- Checked checkbox should look like this: [x] -->\r\n- [X] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.\r\n\r\n## Issue\r\n<!-- Now feel free to write your idea for improvement. Thanks again \ud83d\ude4c \u2764\ufe0f -->\r\n\r\nI'm wondering why it takes 13-30 seconds to install my package (on two different machines). \r\nThis occurs when the package and it's dependencies are already installed.\r\n`$ time poetry install -vvv\r\nUsing virtualenv: /Users/apayne/Envs/smithers\r\nInstalling dependencies from lock file\r\n\r\nNothing to install or update\r\n\r\n  - Skipping markupsafe (1.1.0) Already installed\r\n  - Skipping click (7.0) Already installed\r\n  - Skipping itsdangerous (1.1.0) Already installed\r\n  - Skipping jinja2 (2.10) Already installed\r\n  - Skipping werkzeug (0.14.1) Already installed\r\n  - Skipping aniso8601 (4.0.1) Already installed\r\n  - Skipping flask (1.0.2) Already installed\r\n  - Skipping jsonschema (2.6.0) Already installed\r\n  - Skipping pytz (2018.7) Already installed\r\n  - Skipping six (1.11.0) Already installed\r\n  - Skipping flask-restplus (0.12.1) Already installed\r\n  - Skipping passlib (1.7.1) Already installed\r\n  - Skipping peewee (3.7.1) Already installed\r\n  - Installing smithers (0.1.0)\r\n\r\nreal\t0m29.542s\r\nuser\t0m5.344s\r\nsys 0m2.370s`\r\n\r\nSmithers is the name of the package I'm installing with poetry.  The installing smithers step takes the majority of the time.  Is poetry doing anything but creating a symlink?  I don't understand why this should take so long.  If the package is already installed in editable mode, why does poetry try installing it again?\r\n\r\nMuch thanks!\n", "before_files": [{"content": "import os\n\nfrom .env_command import EnvCommand\n\n\nclass InstallCommand(EnvCommand):\n    \"\"\"\n    Installs the project dependencies.\n\n    install\n        { --no-dev : Do not install dev dependencies. }\n        { --dry-run : Outputs the operations but will not execute anything\n                      (implicitly enables --verbose). }\n        { --E|extras=* : Extra sets of dependencies to install. }\n        { --develop=* : Install given packages in development mode. }\n    \"\"\"\n\n    help = \"\"\"The <info>install</info> command reads the <comment>poetry.lock</> file from\nthe current directory, processes it, and downloads and installs all the\nlibraries and dependencies outlined in that file. If the file does not\nexist it will look for <comment>pyproject.toml</> and do the same.\n\n<info>poetry install</info>\n\"\"\"\n\n    _loggers = [\"poetry.repositories.pypi_repository\"]\n\n    def handle(self):\n        from clikit.io import NullIO\n        from poetry.installation import Installer\n        from poetry.masonry.builders import SdistBuilder\n        from poetry.masonry.utils.module import ModuleOrPackageNotFound\n        from poetry.utils._compat import decode\n        from poetry.utils.env import NullEnv\n\n        installer = Installer(\n            self.io, self.env, self.poetry.package, self.poetry.locker, self.poetry.pool\n        )\n\n        extras = []\n        for extra in self.option(\"extras\"):\n            if \" \" in extra:\n                extras += [e.strip() for e in extra.split(\" \")]\n            else:\n                extras.append(extra)\n\n        installer.extras(extras)\n        installer.dev_mode(not self.option(\"no-dev\"))\n        installer.develop(self.option(\"develop\"))\n        installer.dry_run(self.option(\"dry-run\"))\n        installer.verbose(self.option(\"verbose\"))\n\n        return_code = installer.run()\n\n        if return_code != 0:\n            return return_code\n\n        try:\n            builder = SdistBuilder(self.poetry, NullEnv(), NullIO())\n        except ModuleOrPackageNotFound:\n            # This is likely due to the fact that the project is an application\n            # not following the structure expected by Poetry\n            # If this is a true error it will be picked up later by build anyway.\n            return 0\n\n        self.line(\n            \"  - Installing <info>{}</info> (<comment>{}</comment>)\".format(\n                self.poetry.package.pretty_name, self.poetry.package.pretty_version\n            )\n        )\n\n        if self.option(\"dry-run\"):\n            return 0\n\n        setup = self.poetry.file.parent / \"setup.py\"\n        has_setup = setup.exists()\n\n        if has_setup:\n            self.line(\"<warning>A setup.py file already exists. Using it.</warning>\")\n        else:\n            with setup.open(\"w\", encoding=\"utf-8\") as f:\n                f.write(decode(builder.build_setup()))\n\n        try:\n            self.env.run(\"pip\", \"install\", \"-e\", str(setup.parent), \"--no-deps\")\n        finally:\n            if not has_setup:\n                os.remove(str(setup))\n", "path": "poetry/console/commands/install.py"}], "after_files": [{"content": "import os\n\nfrom .env_command import EnvCommand\n\n\nclass InstallCommand(EnvCommand):\n    \"\"\"\n    Installs the project dependencies.\n\n    install\n        { --no-dev : Do not install dev dependencies. }\n        { --no-root : Do not install the root package (your project). }\n        { --dry-run : Outputs the operations but will not execute anything\n                      (implicitly enables --verbose). }\n        { --E|extras=* : Extra sets of dependencies to install. }\n        { --develop=* : Install given packages in development mode. }\n    \"\"\"\n\n    help = \"\"\"The <info>install</info> command reads the <comment>poetry.lock</> file from\nthe current directory, processes it, and downloads and installs all the\nlibraries and dependencies outlined in that file. If the file does not\nexist it will look for <comment>pyproject.toml</> and do the same.\n\n<info>poetry install</info>\n\"\"\"\n\n    _loggers = [\"poetry.repositories.pypi_repository\"]\n\n    def handle(self):\n        from clikit.io import NullIO\n        from poetry.installation import Installer\n        from poetry.masonry.builders import SdistBuilder\n        from poetry.masonry.utils.module import ModuleOrPackageNotFound\n        from poetry.utils._compat import decode\n        from poetry.utils.env import NullEnv\n\n        installer = Installer(\n            self.io, self.env, self.poetry.package, self.poetry.locker, self.poetry.pool\n        )\n\n        extras = []\n        for extra in self.option(\"extras\"):\n            if \" \" in extra:\n                extras += [e.strip() for e in extra.split(\" \")]\n            else:\n                extras.append(extra)\n\n        installer.extras(extras)\n        installer.dev_mode(not self.option(\"no-dev\"))\n        installer.develop(self.option(\"develop\"))\n        installer.dry_run(self.option(\"dry-run\"))\n        installer.verbose(self.option(\"verbose\"))\n\n        return_code = installer.run()\n\n        if return_code != 0:\n            return return_code\n\n        if not self.option(\"no-root\"):\n            return 0\n\n        try:\n            builder = SdistBuilder(self.poetry, NullEnv(), NullIO())\n        except ModuleOrPackageNotFound:\n            # This is likely due to the fact that the project is an application\n            # not following the structure expected by Poetry\n            # If this is a true error it will be picked up later by build anyway.\n            return 0\n\n        self.line(\n            \"  - Installing <info>{}</info> (<comment>{}</comment>)\".format(\n                self.poetry.package.pretty_name, self.poetry.package.pretty_version\n            )\n        )\n\n        if self.option(\"dry-run\"):\n            return 0\n\n        setup = self.poetry.file.parent / \"setup.py\"\n        has_setup = setup.exists()\n\n        if has_setup:\n            self.line(\"<warning>A setup.py file already exists. Using it.</warning>\")\n        else:\n            with setup.open(\"w\", encoding=\"utf-8\") as f:\n                f.write(decode(builder.build_setup()))\n\n        try:\n            self.env.run(\"pip\", \"install\", \"-e\", str(setup.parent), \"--no-deps\")\n        finally:\n            if not has_setup:\n                os.remove(str(setup))\n", "path": "poetry/console/commands/install.py"}]}