![](/img/trans.png)
[英]How to specify a path for Microsoft Azure Jupyter Notebooks?
[英]How to update sklearn in microsoft azure notebooks?
我是機器學習的新手,我正在查看一些 Scikit-Learn 文檔。 我在 Microsoft Azure https://notebooks.azure.com/ 上使用一個帳戶。
現在我正在嘗試運行此示例的代碼:
https://scikit-learn.org/stable/auto_examples/cluster/plot_agglomerative_dendrogram.html 。
我得到以下錯誤
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-23-fc0d954d99ec> in <module>
44
45 # setting distance_threshold=0 ensures we compute the full tree.
---> 46 model = AgglomerativeClustering(distance_threshold=0, n_clusters=None)
47
48 model = model.fit(X)
TypeError: __init__() got an unexpected keyword argument 'distance_threshold'
我進行了搜索,問題是我有 sklearn '0.20.3' 版本,為了運行該代碼,我需要 0.22 版本。 我一直在嘗試更新 sklearn
!pip install --update sklearn
並得到這個結果:
Usage:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [options] -r <requirements file> [package-index-options] ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
no such option: --update
在網上搜索,在 jupyter notebooks 中嘗試更新 sklearn 時似乎存在一些問題,但通常答案與 Anaconda Jupyter notebooks 相關,而不是與 Azure notebooks 相關。
我將不勝感激任何解決此問題的提示。
要更新 sklearn,請嘗試使用以下命令:
pip install -U scikit-learn
這對我有用。
https://notebooks.azure.com/help/jupyter-notebooks/package-installation
這
!pip !pip install scikit-learn==0.22.1
選項不起作用,即使它顯示
Successfully installed joblib-0.14.1 scikit-learn-0.22.1
反而,
!conda install scikit-learn==0.22.1 -y
成功了,我正確地執行了代碼。 花了幾分鍾。
如上所述,您的軟件包僅在筆記本服務器的生命周期內可用,並且僅在當前項目中可用。
這對我有用:
pip install --upgrade pandas
需要注意的事項:
%autoreload 2
魔法),則需要重新啟動內核。!which pip
)並且您可能安裝在錯誤的內核中。 要在 3.8 中安裝,我必須運行:! /anaconda/envs/azureml_py38/bin/pip install --user -U scikit-learn
/anaconda/envs/azureml_py38/bin/conda install -y scikit-learn==0.24.2
。 我不相信 conda 在這種情況下會有任何優勢,除非作為在爬行依賴解析期間喝咖啡的借口。
在Python 3.8 中從 0.22 升級到 0.24.2 - Azure ML仍然會產生一些錯誤消息,但如果您不使用這些包(甚至可能是),您可以安全地忽略它們
錯誤:raiwidgets 0.4.0 要求 ipython==7.16.1,但您將擁有不兼容的 ipython 7.18.1。
錯誤:raiwidgets 0.4.0 要求 jinja2==2.11.1,但您將擁有不兼容的 jinja2 2.11.2。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.