def _get_poetry_virtualenv(self, force: bool = True):
        """
        Ask poetry where it put the virtualenv for this project.
        Invoking poetry is relatively expensive so cache the result
        """

        # TODO: see if there's a more efficient way to do this that doesn't involve
        #       invoking the poetry cli or relying on undocumented APIs

        exec_cache = self.context.exec_cache

        if force and "poetry_virtualenv" not in exec_cache:
            from subprocess import PIPE, Popen

            # Need to make sure poetry isn't influenced by whatever virtualenv is
            # currently active
            clean_env = dict(environ)
            clean_env.pop("VIRTUAL_ENV", None)
            clean_env["PYTHONIOENCODING"] = "utf-8"

            exec_cache["poetry_virtualenv"] = (
                Popen(
                    (self._poetry_cmd(), "--no-plugins", "env", "info", "-p"),
                    stdout=PIPE,
                    cwd=self.context.config.project_dir,
                    env=clean_env,
                )
                .communicate()[0]
                .decode()
                .strip()
            )

        return exec_cache.get("poetry_virtualenv")

        Ask poetry where it put the virtualenv for this project.
        Invoking poetry is relatively expensive so cache the result
        
poethepoet/executor/poetry.py