2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pyenvのインストール周りの仕様が変わっていたので

Last updated at Posted at 2021-05-11

出会ったエラー

  • いつものDockerfileを新しいサーバーでbuildしていたら、pipがnot foundになってこけた。
  • こんなwarningも出ていた。 WARNING: `pyenv init -` no longer sets PATH.

Dockerfileの仕様

  • ubuntu18.04, cuda10.2, zsh
  • pyenv 1.2.27

fix

  • 旧仕様でのDockerfile(pyenv部分の一部)
RUN curl https://pyenv.run | zsh && \
    echo '' >> /root/.zshrc && \
    echo 'export PATH="/root/.pyenv/bin:$PATH"' >> /root/.zshrc && \
    echo 'eval "$(pyenv init -)"' >> /root/.zshrc && \
    echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.zshrc
  • 新しい仕様
    • 実質 pyenv init -pyenv init --path
    • (.profileをいじれ的なメッセージが出ていたけど従っても動かなかったので、メンテが行き届いてない感がある。)
RUN curl https://pyenv.run | zsh && \
    echo '' >> /root/.zshrc && \
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> /root/.zshrc && \
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.zshrc && \
    echo 'eval "$(pyenv init --path)"' >> /root/.zshrc && \
    echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.zshrc
  • 新しい仕様でのpyenv部分の全体的には
RUN curl https://pyenv.run | zsh && \
    echo '' >> /root/.zshrc && \
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> /root/.zshrc && \
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.zshrc && \
    echo 'eval "$(pyenv init --path)"' >> /root/.zshrc && \
    echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.zshrc
RUN source /root/.zshrc && \
    pyenv install 3.8.0 && \
    pyenv global 3.8.0 && \
    pip install -U pip
  • (ところで毎回 source /root/.zshrc 書かずに済む方法はないのかな…?)

参考

  • (つい2,3日前の記事)

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?