LoginSignup
0
0

Portry で virtualenv を activate する際に Unable to detect the current shell. エラーが出る場合の walk around

Posted at

docker container の中で Poerty を使用した際に、 Unable to detect the current shell. というエラーが出て virtualenv が起動できなかった。

ソースを読んだところ、 SHELL が足りていないことがわかったので、
SHELL を定義することで virtualenv が起動できた。

poetry/src/poetry/utils/shell.py
@classmethod
    def get(cls) -> Shell:
        """
        Retrieve the current shell.
        """
        if cls._shell is not None:
            return cls._shell

        try:
            name, path = detect_shell(os.getpid())
        except (RuntimeError, ShellDetectionFailure):
            shell = None

            if os.name == "posix":
                shell = os.environ.get("SHELL")
            elif os.name == "nt":
                shell = os.environ.get("COMSPEC")

            if not shell:
                raise RuntimeError("Unable to detect the current shell.")

            name, path = Path(shell).stem, shell

        cls._shell = cls(name, path)

        return cls._shell
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0