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?

Anaconda3インストールメモ

Posted at

windows11のwsl2環境でのubuntuにanaconda3をインストールしたので、その流れをメモしておく。

1.Linux版Anaconda3パッケージのダウンロード

ANACONDA公式ダウンロードページにアクセス(https://www.anaconda.com/download)
右側にEmail Addressを入力する処にメールアドレスを入れてsubmitボタンをクリックするとsuccessと表示される。
スクリーンショット 2025-02-24 155728.png

メールが送られてくるので「Download Now」クリック。

スクリーンショット 2025-02-24 155828.png

すると晴れてダウンロードできるページに案内される。そこでLinux版のインストーラーボタンの上で右クリックしリンクアドレスをコピーする。

スクリーンショット 2025-02-24 155853.png

コピーしたアドレスをコンソールに貼り付けてwgetする。

$ wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh

2.Anaconda3をインストール

$ chmod +x Anaconda3-2024.10-1-Linux-x86_64.sh
$ ./Anaconda3-2024.10-1-Linux-x86_64.sh

ライセンスが表示されたらEnter

Welcome to Anaconda3 2024.10-1

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

(省略... Enterキーを間を空けてチョイ長押し、そのうちインストールパスの確認を求められる。OKならEnter)

Do you accept the license terms? [yes|no]
>>> yes

Anaconda3 will now be installed into this location:
/home/user/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/user/anaconda3] >>>
PREFIX=/home/user/anaconda3
Unpacking payload ...

Installing base environment...
Downloading and Extracting Packages:

(省略)

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
   run the following command when conda is activated:

conda config --set auto_activate_base false

You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes

(何を質問されているのか理解できず[ChatGPTにHelp](#3chatgptにhelp)をお願いした)

no change     /home/user/anaconda3/condabin/conda
no change     /home/user/anaconda3/bin/conda
no change     /home/user/anaconda3/bin/conda-env
no change     /home/user/anaconda3/bin/activate
no change     /home/user/anaconda3/bin/deactivate
no change     /home/user/anaconda3/etc/profile.d/conda.sh
no change     /home/user/anaconda3/etc/fish/conf.d/conda.fish
no change     /home/user/anaconda3/shell/condabin/Conda.psm1
no change     /home/user/anaconda3/shell/condabin/conda-hook.ps1
no change     /home/user/anaconda3/lib/python3.12/site-packages/xontrib/conda.xsh
no change     /home/user/anaconda3/etc/profile.d/conda.csh
modified      /home/user/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

Thank you for installing Anaconda3!
$

ここまででAnaconda3のインストールは完了

3.ChatGPTにhelp

  • 問い合わせ内容:
    anacondaをインストールしていたら下記メッセージが表示された。何をすればいいの?
    ###
    Do you wish to update your shell profile to automatically initialize conda?
    This will activate conda on startup and change the command prompt when activated.
    If you'd prefer that conda's base environment not be activated on startup,
    run the following command when conda is activated:
    conda config --set auto_activate_base false
    You can undo this by running conda init --reverse $SHELL? [yes|no]
    [no] >>>

  • 回答:

このメッセージは、condaをシェル(ターミナル)に自動的に組み込むかどうかを尋ねています。選択肢は以下の通りです。  

 選択肢  
1. 「yes」を選択する場合  
  ・condaがシェルの起動時に自動で有効化され、ベース環境 (base) がアクティブになります。  
  ・ターミナルのプロンプトに(base)という表示がつくようになります。  
  ・毎回conda activateを手動で実行する必要がなくなります。  

2. 「no」を選択する場合(デフォルト)  
  ・condaは自動で起動しません。  
  ・condaを使うには、手動でconda initを実行するか、conda activateを入力する必要があります。  
  • 問い合わせ内容:
    どちらを選べばいい?
  • 回答:
condaを頻繁に使うなら「yes」(自動で環境がセットアップされるので便利)  
手動でconda activateしたいなら「no」(ターミナルの設定を汚したくない場合)  

あとから変更する方法  
  ・自動起動を無効にする場合:  
   conda config --set auto_activate_base false
  ・conda init` をやり直す場合(設定を元に戻す):  
   conda init --reverse $SHELL
  • やったこと:
    多分「no」だと 次回忘れてしまう公算が大なので「yes」に決定。

4.conda の実行ファイルが存在するか確認

$ find $HOME -name "conda" -type f
/home/user/anaconda3/bin/conda
/home/user/anaconda3/condabin/conda
/home/user/anaconda3/pkgs/conda-24.9.2-py312h06a4308_0/bin/conda
/home/user/anaconda3/pkgs/conda-24.9.2-py312h06a4308_0/condabin/conda

バージョンを確認

$ /home/user/anaconda3/bin/conda --version
conda 24.9.2

5.環境変数 PATH を修正する

$ echo 'export PATH="$HOME/anaconda3/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

(base) はcondaのデフォルト環境が有効になっていると表示されるらしい。
再度バージョン確認をしてみる。

(base) $ conda --version
conda 24.9.2

5. conda init を実行する(condaを自動起動しない場合)

自動起動している(プロンプトに(base)表示)ので不要だが起動してみた。

(base) $ conda init
no change     /home/user/anaconda3/condabin/conda
no change     /home/user/anaconda3/bin/conda
no change     /home/user/anaconda3/bin/conda-env
no change     /home/user/anaconda3/bin/activate
no change     /home/user/anaconda3/bin/deactivate
no change     /home/user/anaconda3/etc/profile.d/conda.sh
no change     /home/user/anaconda3/etc/fish/conf.d/conda.fish
no change     /home/user/anaconda3/shell/condabin/Conda.psm1
no change     /home/user/anaconda3/shell/condabin/conda-hook.ps1
no change     /home/user/anaconda3/lib/python3.12/site-packages/xontrib/conda.xsh
no change     /home/user/anaconda3/etc/profile.d/conda.csh
modified      /home/user/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

以上がanaconda3インストールの流れでした。

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?