総数:31 今日:1 昨日:2
Memorandums
on windows

もくじ

参考url
【2022最新版】WIndowsにPythonの環境構築|通常のインストール方法、Dockerを使う方法も解説
https://kino-code.com/docker_python/

installing Python Env on Windows11 by Docker

Dockerfileの準備

C:\Users\ryu\Documents\docker-python に以下の内容のファイルを作成する

FROM ubuntu:22.04

RUN apt-get update && apt-get install -y sudo wget vim curl gawk make gcc
RUN sudo apt-get install bzip2

RUN wget https://repo.continuum.io/archive/Anaconda3-2023.03-1-Linux-x86_64.sh && \
    sh Anaconda3-2023.03-1-Linux-x86_64.sh -b  && \
    rm -f Anaconda3-2023.03-1-Linux-x86_64.sh && \
    sudo curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -  && \
    sudo apt-get install -y nodejs

ENV PATH $PATH:/root/anaconda3/bin

RUN pip install --upgrade pip
RUN pip install pandas_datareader
RUN pip install mplfinance
RUN pip install japanize-matplotlib

RUN wget --quiet https://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -O ta-lib-0.4.0-src.tar.gz && \
    tar xvf ta-lib-0.4.0-src.tar.gz && \
    cd ta-lib/ && \
    ./configure --prefix=/usr && \
    make && \
    sudo make install && \
    cd .. && \
    pip install TA-Lib && \
    rm -R ta-lib ta-lib-0.4.0-src.tar.gz

RUN mkdir /workspace

CMD ["jupyter-lab", "--ip=0.0.0.0","--port=8888" ,"--no-browser", "--allow-root", "--LabApp.token=''"]
version: "3.7"
services:
  jupyterlab:
    build: .
    container_name: docker-python
    volumes:
      - '.:/workspace'
    environment:
      - JUPYTER_ENABLE_LAB=yes
    ports:
      - "8888:8888"
    platform: linux/amd64

Dockerfileからイメージを作成、コンテナの作成、実行

WARN[0000] /mnt/c/Users/ryu/Documents/docker-python/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Building 764.6s (18/18) FINISHED
 => [internal] load local bake definitions                                                                                                                                                               0.0s
 => => reading from stdin 612B                                                                                                                                                                           0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                     0.1s
 => => transferring dockerfile: 1.31kB                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                          2.6s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                          0.0s
 => [ 1/10] FROM docker.io/library/ubuntu:22.04@sha256:962f6cadeae0ea6284001009daa4cc9a8c37e75d1f5191cf0eb83fe565b63dd7                                                                                  4.4s
 => => resolve docker.io/library/ubuntu:22.04@sha256:962f6cadeae0ea6284001009daa4cc9a8c37e75d1f5191cf0eb83fe565b63dd7                                                                                    0.0s
 => => sha256:f63eb04151bcac21ad049f8d781b97b219aba392c5457907f8f3e88e43eb48ec 29.74MB / 29.74MB                                                                                                         4.3s
 => [ 2/10] RUN apt-get update && apt-get install -y sudo wget vim curl gawk make gcc                                                                                                                   26.3s
 => [ 3/10] RUN sudo apt-get install bzip2                                                                                                                                                               2.0s
 => [ 4/10] RUN wget https://repo.continuum.io/archive/Anaconda3-2023.03-1-Linux-x86_64.sh &&     sh Anaconda3-2023.03-1-Linux-x86_64.sh -b  &&     rm -f Anaconda3-2023.03-1-Linux-x86_64.sh &&       275.0s
 => [ 5/10] RUN pip install --upgrade pip                                                                                                                                                                6.4s
 => [ 6/10] RUN pip install pandas_datareader                                                                                                                                                            1.5s
 => [ 7/10] RUN pip install mplfinance                                                                                                                                                                   4.5s
 => [ 8/10] RUN pip install japanize-matplotlib                                                                                                                                                          5.4s
 => [ 9/10] RUN wget --quiet  https://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -O ta-lib-0.4.0-src.tar.gz &&     tar xvf ta-lib-0.4.0-src.tar.gz &&     cd ta-lib/&&     ./configure  72.8s
 => [10/10] RUN mkdir /workspace                                                                                                                                                                         0.3s
 => exporting to image                                                                                                                                                                                 366.3s
 => => exporting layers                                                                                                                                                                                230.1s
 => => exporting manifest sha256:9b49d8b3d268dd829d8f9e71389b105f1621c41cba8c25d440eb0b50fc36e585                                                                                                        0.0s
 => => exporting config sha256:e70cf3891c6158408f83f0a41f359fe15e4f86d29f63ffe4524e88c875e1b8e6                                                                                                          0.0s
 => => exporting attestation manifest sha256:048b6824287a4dcaa285dea5310b3c6a0d539a25f88c097c5111f94a665cc024                                                                                            0.0s
 => => exporting manifest list sha256:9c8b1134625badf95b6fbf67c2e317497c04ab703c02dfbb52b12a59c4305de4                                                                                                   0.0s
 => => naming to docker.io/library/docker-python-jupyterlab:latest                                                                                                                                       0.0s
 => => unpacking to docker.io/library/docker-python-jupyterlab:latest                                                                                                                                  136.0s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                                            0.0s
 => resolving provenance for metadata file                                                                                                                                                               0.0s
[+] up 3/3
 ✔ Image docker-python-jupyterlab Built                                                                                                                                                                 764.8s
 ✔ Network docker-python_default  Created                                                                                                                                                                 0.1s
 ✔ Container docker-python        Started                                                                                                                                                                 5.5s
$

jupiter labの起動

ブラウザで http://localhost:8888/lab に接続する

on windows


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS