通过网状结构在 R 中安装 Python 模块时出错
Error while installing Python module in R via reticulate
我正在使用 R,我想使用我在 Python 中编写的需要导入的函数:
from sklearn.neighbors.kde import KernelDensity
我正在尝试使用以下代码:
library(reticulate)
py_install("scikit-learn.neighbors.kde")
我已经安装了 sklearn:
py_install("scikit-learn")
也在努力
py_install("sklearn.neighbors.kde")
无效。
我得到以下 error/log:
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- scikit-learn.neighbors.kde
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Error: one or more Python packages failed to install [error code 1]
关于如何解决这个问题有什么建议吗?
模块是 KernelDensity
而不是 kde
。如果安装了 sklearn,下面应该可以工作:
library(reticulate)
sklearn = import("sklearn")
kde = sklearn$neighbors$KernelDensity
kde
<class 'sklearn.neighbors._kde.KernelDensity'>
X = matrix(rnorm(20),10,1)
kde = kde(kernel="gaussian")$fit(X)
kde$score_samples(X)
[1] -1.479458 -1.603451 -1.338018 -1.465263 -1.655933 -1.463628 -1.340137
[8] -1.856085 -1.374666 -1.478621
我正在使用 R,我想使用我在 Python 中编写的需要导入的函数:
from sklearn.neighbors.kde import KernelDensity
我正在尝试使用以下代码:
library(reticulate)
py_install("scikit-learn.neighbors.kde")
我已经安装了 sklearn:
py_install("scikit-learn")
也在努力
py_install("sklearn.neighbors.kde")
无效。
我得到以下 error/log:
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- scikit-learn.neighbors.kde
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Error: one or more Python packages failed to install [error code 1]
关于如何解决这个问题有什么建议吗?
模块是 KernelDensity
而不是 kde
。如果安装了 sklearn,下面应该可以工作:
library(reticulate)
sklearn = import("sklearn")
kde = sklearn$neighbors$KernelDensity
kde
<class 'sklearn.neighbors._kde.KernelDensity'>
X = matrix(rnorm(20),10,1)
kde = kde(kernel="gaussian")$fit(X)
kde$score_samples(X)
[1] -1.479458 -1.603451 -1.338018 -1.465263 -1.655933 -1.463628 -1.340137
[8] -1.856085 -1.374666 -1.478621