У меня проблемы с импортом модуля scipy
, даже если он был установлен в среде r-reticulate
.
Specifi c Сообщение об ошибке:
> scipy <- import("scipy")
Error in py_module_import(module, convert = convert) :
ModuleNotFoundError: No module named 'scipy'
Список Конда envs:
> conda_list()
name python
1 untitled /Users/williamchiu/.conda/envs/untitled/bin/python
2 r-miniconda /Users/williamchiu/Library/r-miniconda/bin/python
3 r-reticulate /Users/williamchiu/Library/r-miniconda/envs/r-reticulate/bin/python
4 anaconda3 /Users/williamchiu/anaconda3/bin/python
5 r-reticulate /Users/williamchiu/anaconda3/envs/r-reticulate/bin/python
Дамп экрана:
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(reticulate)
>
> # create a new environment
> conda_create("r-reticulate")
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: /Users/williamchiu/anaconda3/envs/r-reticulate
added / updated specs:
- python
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.11.28 | py38_0 156 KB
------------------------------------------------------------
Total: 156 KB
The following NEW packages will be INSTALLED:
ca-certificates pkgs/main/osx-64::ca-certificates-2019.11.27-0
certifi pkgs/main/osx-64::certifi-2019.11.28-py38_0
libcxx pkgs/main/osx-64::libcxx-4.0.1-hcfea43d_1
libcxxabi pkgs/main/osx-64::libcxxabi-4.0.1-hcfea43d_1
libedit pkgs/main/osx-64::libedit-3.1.20181209-hb402a30_0
libffi pkgs/main/osx-64::libffi-3.2.1-h475c297_4
ncurses pkgs/main/osx-64::ncurses-6.1-h0a44026_1
openssl pkgs/main/osx-64::openssl-1.1.1d-h1de35cc_3
pip pkgs/main/osx-64::pip-19.3.1-py38_0
python pkgs/main/osx-64::python-3.8.1-h359304d_1
readline pkgs/main/osx-64::readline-7.0-h1de35cc_5
setuptools pkgs/main/osx-64::setuptools-44.0.0-py38_0
sqlite pkgs/main/osx-64::sqlite-3.30.1-ha441bb4_0
tk pkgs/main/osx-64::tk-8.6.8-ha441bb4_0
wheel pkgs/main/osx-64::wheel-0.33.6-py38_0
xz pkgs/main/osx-64::xz-5.2.4-h1de35cc_4
zlib pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3
Downloading and Extracting Packages
certifi-2019.11.28 | 156 KB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
# $ conda activate r-reticulate
#
# To deactivate an active environment, use
#
# $ conda deactivate
[1] "/Users/williamchiu/Library/r-miniconda/envs/r-reticulate/bin/python"
>
> # install SciPy
> conda_install("r-reticulate", "scipy")
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
# All requested packages already installed.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: /Users/williamchiu/anaconda3/envs/r-reticulate
added / updated specs:
- python
- scipy
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2019.11.28 | py38_0 148 KB conda-forge
------------------------------------------------------------
Total: 148 KB
The following NEW packages will be INSTALLED:
libblas conda-forge/osx-64::libblas-3.8.0-14_openblas
libcblas conda-forge/osx-64::libcblas-3.8.0-14_openblas
libgfortran conda-forge/osx-64::libgfortran-4.0.0-2
liblapack conda-forge/osx-64::liblapack-3.8.0-14_openblas
libopenblas conda-forge/osx-64::libopenblas-0.3.7-h3d69b6c_6
llvm-openmp conda-forge/osx-64::llvm-openmp-9.0.1-h28b9765_1
numpy conda-forge/osx-64::numpy-1.17.3-py38hde6bac1_0
scipy conda-forge/osx-64::scipy-1.4.1-py38h82752d6_0
The following packages will be UPDATED:
ca-certificates pkgs/main::ca-certificates-2019.11.27~ --> conda-forge::ca-certificates-2019.11.28-hecc5488_0
libcxx pkgs/main::libcxx-4.0.1-hcfea43d_1 --> conda-forge::libcxx-9.0.1-1
The following packages will be SUPERSEDED by a higher-priority channel:
certifi pkgs/main --> conda-forge
openssl pkgs/main::openssl-1.1.1d-h1de35cc_3 --> conda-forge::openssl-1.1.1d-h0b31af3_0
Downloading and Extracting Packages
certifi-2019.11.28 | 148 KB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
>
> use_condaenv('r-reticulate')
>
> # import SciPy (it will be automatically discovered in "r-reticulate")
> scipy <- import("scipy")
Error in py_module_import(module, convert = convert) :
ModuleNotFoundError: No module named 'scipy'
> Sys.info()
sysname
"Darwin"
release
"19.2.0"
version
"Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64"
nodename
"Williams-MacBook-Pro.local"
machine
"x86_64"
login
"root"
user
"williamchiu"
effective_user
"williamchiu"