Conda の問題
問題
このリンクをご覧ください: https://www.reddit.com/r/MachineLearning/comments/myl8yn/d_is_anaconda_worth_the_trouble/.
私はcondaで問題を経験し、他の人も同様の問題について議論していました。
時間が経つと、異なる環境設定に気づかなくなります。そのため、他を削除する必要がありました。今では主に Python 3.10.9
を使用し、時々 Python 3.11.11
を使用します。しかし、ほとんど Python 3.11.11
すら使いません。私には多くの環境は必要ありません。現在研究や学習中のものを実行するために一つまたは二つの環境があれば十分です。
シンプルな解決策を好みます。もし二つのプロジェクトが相互に干渉する場合、私は一つを使用して他の実行を諦めます。
例えば、次のような問題に直面するのは本当に面倒です。1
conda config --set proxy_servers.http $HTTP_PROXY
conda config --set proxy_servers.https $HTTP_PROXY
最初、condaにプロキシを設定することで速度が上がるように思えたが、最終的には削除しました。
削除
rm -rf ~/anaconda3
rm -rf ~/.condarc
rm -rf ~/Library/Caches/pip
# ~/.zprofileを更新
# ~/.bash_profileを更新
~/.bash_profile
:
# >>> conda initialize >>>
# !! このブロック内の内容は 'conda init' によって管理されます !!
__conda_setup="$('/Users/lzwjava/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/lzwjava/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/lzwjava/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/lzwjava/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
それでも表示されました。
% which conda
conda () {
local cmd="${1-__missing__}"
case "$cmd" in
(activate | deactivate) __conda_activate "$@" ;;
(install | update | upgrade | remove | uninstall) __conda_exe "$@" || return
__conda_reactivate ;;
(*) __conda_exe "$@" ;;
esac
}
iTerm2を再起動した後、HomebrewのPythonインストールに切り替えることにしました。複数のPythonインストールがコンピュータにあるようでした。以下のように既に6つありました。
- ~/Library/Python/3.9
- ~/Library/Python/3.11
- /opt/homebrew/lib/python3.11
- /opt/homebrew/lib/python3.12
- /opt/homebrew/lib/python3.13
- /opt/homebrew/lib/python3.9
コマンドで削除します、brew uninstall python@3.11
。
重要なログ。
% brew uninstall python@3.13
Error: /opt/homebrew/Cellar/python@3.13/3.13.1 のアンインストールを拒否しました
because it is required by cairo, docutils, ffmpeg, ghostscript, glib, gradle, harfbuzz, imagemagick, libass, libheif, liblqr, maven, openjdk, openjdk@17, pango, poppler, tesseract, wireshark and yt-dlp, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies python@3.13
Pipのログ:
pip3 install -r requirements.txt --break-system-packages
pip3 install --upgrade pip --break-system-packages
参照
```bash
- defaults/osx-arm64::markdown==3.4.1=py310hca03da5_0
- defaults/osx-arm64::numpydoc==1.5.0=py310hca03da5_0
-
defaults/noarch::tldextract==3.2.0=pyhd3eb1b0_0 failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): / WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.8.0., but conda is ignoring the . and treating it as 1.8.0 WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.9.0., but conda is ignoring the . and treating it as 1.9.0 done Solving environment: / The environment is inconsistent, please check the package plan carefully The following packages are causing the inconsistency:
- defaults/osx-arm64::tabulate==0.8.10=py310hca03da5_0
- defaults/osx-arm64::cymem==2.0.6=py310hc377ac9_0
- defaults/noarch::conda-pack==0.6.0=pyhd3eb1b0_0 # …
- defaults/noarch::pandocfilters==1.5.0=pyhd3eb1b0_0
- defaults/osx-arm64::markdown==3.4.1=py310hca03da5_0
- defaults/osx-arm64::numpydoc==1.5.0=py310hca03da5_0
- defaults/noarch::tldextract==3.2.0=pyhd3eb1b0_0
-/ ^R
/ - / -
done
==> WARNING: A newer version of conda exists. <== current version: 23.3.1 latest version: 25.1.1
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=25.1.1
パッケージ計画
environment location: /Users/lzwjava/anaconda3
added / updated specs: - ipykernel
以下のパッケージがダウンロードされます:
package | build
---------------------------|-----------------
attrs-25.1.0 | pyh71513ae_0 55 KB conda-forge
bcrypt-3.2.0 | py310h80987f9_2 37 KB
ca-certificates-2025.1.31 | hf0a4a13_0 155 KB conda-forge
certifi-2024.12.14 | pyhd8ed1ab_0 158 KB conda-forge
charset-normalizer-2.1.1 | pyhd8ed1ab_0 36 KB conda-forge
click-8.1.8 | pyh707e725_0 83 KB conda-forge
fsspec-2024.12.0 | pyhd8ed1ab_0 135 KB conda-forge
huggingface_hub-0.27.1 | pyhd8ed1ab_0 272 KB conda-forge
jinja2-3.1.5 | pyhd8ed1ab_0 110 KB conda-forge
jsonpatch-1.33 | pyhd8ed1ab_1 17 KB conda-forge
pandas-2.1.4 | py310h46d7db6_0 11.8 MB
pyjwt-2.10.1 | pyhd8ed1ab_0 25 KB conda-forge
pyrsistent-0.20.0 | py310h80987f9_1 100 KB
python-tzdata-2025.1 | pyhd8ed1ab_0 140 KB conda-forge
pytz-2025.1 | pyhd8ed1ab_0 182 KB conda-forge
pyyaml-6.0.2 | py310h80987f9_0 176 KB
sniffio-1.3.1 | pyhd8ed1ab_1 15 KB conda-forge
tenacity-9.0.0 | pyhd8ed1ab_1 24 KB conda-forge
tokenizers-0.13.2 | py310h3dd52b7_1 2.9 MB
tqdm-4.67.1 | pyhd8ed1ab_1 87 KB conda-forge
websocket-client-1.8.0 | pyhd8ed1ab_1 46 KB conda-forge
------------------------------------------------------------
Total: 16.6 MB
以下の新しいパッケージがインストールされます:
attrs conda-forge/noarch::attrs-25.1.0-pyh71513ae_0 bcrypt pkgs/main/osx-arm64::bcrypt-3.2.0-py310h80987f9_2 certifi conda-forge/noarch::certifi-2024.12.14-pyhd8ed1ab_0 charset-normalizer conda-forge/noarch::charset-normalizer-2.1.1-pyhd8ed1ab_0 click conda-forge/noarch::click-8.1.8-pyh707e725_0 fsspec conda-forge/noarch::fsspec-2024.12.0-pyhd8ed1ab_0 huggingface_hub conda-forge/noarch::huggingface_hub-0.27.1-pyhd8ed1ab_0 importlib-metadata pkgs/main/osx-arm64::importlib-metadata-4.11.3-py310hca03da5_0 jinja2 conda-forge/noarch::jinja2-3.1.5-pyhd8ed1ab_0 jsonpatch conda-forge/noarch::jsonpatch-1.33-pyhd8ed1ab_1 pandas pkgs/main/osx-arm64::pandas-2.1.4-py310h46d7db6_0 pyjwt conda-forge/noarch::pyjwt-2.10.1-pyhd8ed1ab_0 pyrsistent pkgs/main/osx-arm64::pyrsistent-0.20.0-py310h80987f9_1 python-tzdata conda-forge/noarch::python-tzdata-2025.1-pyhd8ed1ab_0 pytz conda-forge/noarch::pytz-2025.1-pyhd8ed1ab_0 pyyaml pkgs/main/osx-arm64::pyyaml-6.0.2-py310h80987f9_0 sniffio conda-forge/noarch::sniffio-1.3.1-pyhd8ed1ab_1 tenacity conda-forge/noarch::tenacity-9.0.0-pyhd8ed1ab_1 tokenizers pkgs/main/osx-arm64::tokenizers-0.13.2-py310h3dd52b7_1 tqdm conda-forge/noarch::tqdm-4.67.1-pyhd8ed1ab_1 typer conda-forge/noarch::typer-0.7.0-pyhd8ed1ab_0 typing_extensions conda-forge/noarch::typing_extensions-4.7.1-pyha770c72_0 urllib3 conda-forge/noarch::urllib3-1.26.15-pyhd8ed1ab_0 websocket-client conda-forge/noarch::websocket-client-1.8.0-pyhd8ed1ab_1
以下のパッケージが更新されます:
ca-certificates 2023.7.22-hf0a4a13_0 –> 2025.1.31-hf0a4a13_0 openssl 1.1.1u-h53f4e23_0 –> 1.1.1w-h53f4e23_0
Proceed ([y]/n)?
パッケージのダウンロードと展開
トランザクションの準備: 完了 トランザクションの検証: 失敗
RemoveError: ‘jsonpatch’ is a dependency of conda and cannot be removed from conda’s operating environment. RemoveError: ‘tqdm’ is a dependency of conda and cannot be removed from conda’s operating environment.
-
ログは以下に示します。 ↩