0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ADの研究 環境構築編

0
Posted at

環境構築

1. Minicondaインストール

Mac / Linux

Bash.py
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh

※ Apple Silicon(M1/M2)の場合、MacOSX-arm64.sh を選択。

Windows

公式サイトからインストーラを実行(WSLでも可)

私はMacなので上記のコードを実行しました。

2. conda が使えるか確認

confirm.py
conda --version

3. 研究AI用仮想環境の作成

Lab.py
conda create -n ad-ai python=3.10
conda activate ad-ai

4.JupyterLabを入れる

jupyter.py
conda install jupyterlab ipykernel

※JupyterLabを入れるのはad-ai環境で。以下の作業はad-ai環境で行う。

5.環境をJupyterに登録

register.py
python -m ipykernel install --user --name ad-ai --display-name "Python (ad-ai)"

6.起動

launch.py
jupyter lab

⚠️ 絶対にやってはいけないこと
❌ system Python に pip install
❌ conda環境を作らず直接pip
❌ pipとcondaを無秩序に混ぜる

確認のためすること

Notebookのセルで以下を実行

activate.py
import sys
print(sys.executable)

実行後以下が表示されるはず

ideal.py
.../miniconda3/envs/ad-ai/bin/python

環境構築は以上。

condaとpipの違い

conda(基盤・重いもの)
↓
pip(純Python)

① まずcondaで入れられるものはcondaで入れる
② condaに無いものだけpipを使う

理由

conda:
C/C++/Fortran
BLAS/OpenMP
CUDA/RDKit
PyTorch
などのネイティブ依存関係を管理。
pip:
Pythonコード中心
依存関係をOSレベルでは解決できない。
👉 先にpipを使うとcondaが後から整合性を取れなくなる。
ライブラリ 使うもの
numpy / scipy conda
pytorch conda
rdkit conda
neo4j conda
pandas conda
transformers pip
indra pip
pybel pip
biopython pip

今回は環境構築について書いた。以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?