rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.67k stars 328 forks source link

Error in py_run_file_impl(file, local, convert) : ModuleNotFoundError: No module named 'leidenalg' #1178

Open howtofindme opened 2 years ago

howtofindme commented 2 years ago

1.when i run this code,i get an error: mini_visium <- doLeidenCluster(gobject = mini_visium, resolution = 0.4, n_iterations = 1000) image

2.therefore,i use this code to reinstall "leidenalg",and the packages are all installed:

conda_install(envname = "myr-reticulate" , packages=c(

  • "pandas", "python-igraph", "networkx", "python-louvain", "leidenalg", "scikit-learn"
  • ), forge = TRUE, conda = "auto", python_version = NULL)

Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done

==> WARNING: A newer version of conda exists. <== current version: 4.10.3 latest version: 4.12.0

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: C:\Users\yll\AppData\Local\R-MINI~1\envs\myr-reticulate

added / updated specs:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
brotli-1.0.9               |       h8ffe710_6          18 KB  conda-forge
brotli-bin-1.0.9           |       h8ffe710_6          21 KB  conda-forge
certifi-2021.10.8          |  py310h5588dad_1         145 KB  conda-forge
fonttools-4.30.0           |  py310he2412df_0         1.5 MB  conda-forge
igraph-0.9.7               |       h29cbd77_0         1.3 MB  conda-forge
kiwisolver-1.4.0           |  py310h476a331_0          58 KB  conda-forge
leidenalg-0.8.9            |  py310h494077a_0         117 KB  conda-forge
libbrotlicommon-1.0.9      |       h8ffe710_6          67 KB  conda-forge
libbrotlidec-1.0.9         |       h8ffe710_6          33 KB  conda-forge
libbrotlienc-1.0.9         |       h8ffe710_6         721 KB  conda-forge
libwebp-1.2.2              |       h57928b3_0          11 KB  conda-forge
libwebp-base-1.2.2         |       h8ffe710_1         393 KB  conda-forge
libxcb-1.13                |    hcd874cb_1004         1.3 MB  conda-forge
matplotlib-base-3.5.1      |  py310h79a7439_0         7.4 MB  conda-forge
munkres-1.1.4              |     pyh9f0ad1d_0          12 KB  conda-forge
networkx-2.7.1             |     pyhd8ed1ab_0         1.5 MB  conda-forge
numpy-1.22.3               |  py310hcae7c84_0         6.1 MB  conda-forge
packaging-21.3             |     pyhd8ed1ab_0          36 KB  conda-forge
pandas-1.4.1               |  py310hf5e1058_0        11.0 MB  conda-forge
pillow-9.0.1               |  py310h767b3fd_2        44.5 MB  conda-forge
pthread-stubs-0.4          |    hcd874cb_1001           6 KB  conda-forge
python-igraph-0.9.9        |  py310h43e2149_0         1.4 MB  conda-forge
scikit-learn-1.0.2         |  py310h4dafddf_0         6.9 MB  conda-forge
scipy-1.8.0                |  py310h33db832_1        27.2 MB  conda-forge
unicodedata2-14.0.0        |  py310he2412df_0         497 KB  conda-forge
xorg-libxau-1.0.9          |       hcd874cb_0          57 KB  conda-forge
xorg-libxdmcp-1.1.3        |       hcd874cb_0          66 KB  conda-forge
------------------------------------------------------------
                                       Total:       112.4 MB

The following NEW packages will be INSTALLED:

brotli conda-forge/win-64::brotli-1.0.9-h8ffe710_6 brotli-bin conda-forge/win-64::brotli-bin-1.0.9-h8ffe710_6 certifi conda-forge/win-64::certifi-2021.10.8-py310h5588dad_1 cycler conda-forge/noarch::cycler-0.11.0-pyhd8ed1ab_0 fonttools conda-forge/win-64::fonttools-4.30.0-py310he2412df_0 freetype conda-forge/win-64::freetype-2.10.4-h546665d_1 glpk conda-forge/win-64::glpk-4.65-h8ffe710_1004 igraph conda-forge/win-64::igraph-0.9.7-h29cbd77_0 intel-openmp conda-forge/win-64::intel-openmp-2022.0.0-h57928b3_3663 jbig conda-forge/win-64::jbig-2.1-h8d14728_2003 joblib conda-forge/noarch::joblib-1.1.0-pyhd8ed1ab_0 jpeg conda-forge/win-64::jpeg-9e-h8ffe710_0 kiwisolver conda-forge/win-64::kiwisolver-1.4.0-py310h476a331_0 lcms2 conda-forge/win-64::lcms2-2.12-h2a16943_0 leidenalg conda-forge/win-64::leidenalg-0.8.9-py310h494077a_0 lerc conda-forge/win-64::lerc-3.0-h0e60522_0 libblas conda-forge/win-64::libblas-3.9.0-13_win64_mkl libbrotlicommon conda-forge/win-64::libbrotlicommon-1.0.9-h8ffe710_6 libbrotlidec conda-forge/win-64::libbrotlidec-1.0.9-h8ffe710_6 libbrotlienc conda-forge/win-64::libbrotlienc-1.0.9-h8ffe710_6 libcblas conda-forge/win-64::libcblas-3.9.0-13_win64_mkl libdeflate conda-forge/win-64::libdeflate-1.10-h8ffe710_0 libiconv conda-forge/win-64::libiconv-1.16-he774522_0 liblapack conda-forge/win-64::liblapack-3.9.0-13_win64_mkl liblapacke conda-forge/win-64::liblapacke-3.9.0-13_win64_mkl libpng conda-forge/win-64::libpng-1.6.37-h1d00b33_2 libtiff conda-forge/win-64::libtiff-4.3.0-hc4061b1_3 libwebp conda-forge/win-64::libwebp-1.2.2-h57928b3_0 libwebp-base conda-forge/win-64::libwebp-base-1.2.2-h8ffe710_1 libxcb conda-forge/win-64::libxcb-1.13-hcd874cb_1004 libxml2 conda-forge/win-64::libxml2-2.9.12-hf5bbc77_1 lz4-c conda-forge/win-64::lz4-c-1.9.3-h8ffe710_1 m2w64-gcc-libgfor~ conda-forge/win-64::m2w64-gcc-libgfortran-5.3.0-6 m2w64-gcc-libs conda-forge/win-64::m2w64-gcc-libs-5.3.0-7 m2w64-gcc-libs-co~ conda-forge/win-64::m2w64-gcc-libs-core-5.3.0-7 m2w64-gmp conda-forge/win-64::m2w64-gmp-6.1.0-2 m2w64-libwinpthre~ conda-forge/win-64::m2w64-libwinpthread-git-5.0.0.4634.697f757-2 matplotlib-base conda-forge/win-64::matplotlib-base-3.5.1-py310h79a7439_0 mkl conda-forge/win-64::mkl-2022.0.0-h0e2418a_796 mpir conda-forge/win-64::mpir-3.0.0-he025d50_1002 msys2-conda-epoch conda-forge/win-64::msys2-conda-epoch-20160418-1 munkres conda-forge/noarch::munkres-1.1.4-pyh9f0ad1d_0 networkx conda-forge/noarch::networkx-2.7.1-pyhd8ed1ab_0 numpy conda-forge/win-64::numpy-1.22.3-py310hcae7c84_0 openjpeg conda-forge/win-64::openjpeg-2.4.0-hb211442_1 packaging conda-forge/noarch::packaging-21.3-pyhd8ed1ab_0 pandas conda-forge/win-64::pandas-1.4.1-py310hf5e1058_0 pillow conda-forge/win-64::pillow-9.0.1-py310h767b3fd_2 pthread-stubs conda-forge/win-64::pthread-stubs-0.4-hcd874cb_1001 pyparsing conda-forge/noarch::pyparsing-3.0.7-pyhd8ed1ab_0 python-dateutil conda-forge/noarch::python-dateutil-2.8.2-pyhd8ed1ab_0 python-igraph conda-forge/win-64::python-igraph-0.9.9-py310h43e2149_0 python-louvain conda-forge/noarch::python-louvain-0.15-pyhd8ed1ab_1 pytz conda-forge/noarch::pytz-2021.3-pyhd8ed1ab_0 scikit-learn conda-forge/win-64::scikit-learn-1.0.2-py310h4dafddf_0 scipy conda-forge/win-64::scipy-1.8.0-py310h33db832_1 six conda-forge/noarch::six-1.16.0-pyh6c4a22f_0 suitesparse conda-forge/win-64::suitesparse-5.4.0-h5d0cbe0_1 tbb conda-forge/win-64::tbb-2021.5.0-h2d74725_0 texttable conda-forge/noarch::texttable-1.6.4-pyhd8ed1ab_0 threadpoolctl conda-forge/noarch::threadpoolctl-3.1.0-pyh8a188c0_0 unicodedata2 conda-forge/win-64::unicodedata2-14.0.0-py310he2412df_0 xorg-libxau conda-forge/win-64::xorg-libxau-1.0.9-hcd874cb_0 xorg-libxdmcp conda-forge/win-64::xorg-libxdmcp-1.1.3-hcd874cb_0 zlib conda-forge/win-64::zlib-1.2.11-h8ffe710_1013 zstd conda-forge/win-64::zstd-1.5.2-h6255e5f_0

Downloading and Extracting Packages leidenalg-0.8.9 | 117 KB | ########## | 100% scipy-1.8.0 | 27.2 MB | ########## | 100% python-igraph-0.9.9 | 1.4 MB | ########## | 100% libxcb-1.13 | 1.3 MB | ########## | 100% munkres-1.1.4 | 12 KB | ########## | 100% numpy-1.22.3 | 6.1 MB | ########## | 100% scikit-learn-1.0.2 | 6.9 MB | ########## | 100% matplotlib-base-3.5. | 7.4 MB | ########## | 100% brotli-bin-1.0.9 | 21 KB | ########## | 100% fonttools-4.30.0 | 1.5 MB | ########## | 100% xorg-libxdmcp-1.1.3 | 66 KB | ########## | 100% xorg-libxau-1.0.9 | 57 KB | ########## | 100% pthread-stubs-0.4 | 6 KB | ########## | 100% unicodedata2-14.0.0 | 497 KB | ########## | 100% libbrotlicommon-1.0. | 67 KB | ########## | 100% libbrotlienc-1.0.9 | 721 KB | ########## | 100% brotli-1.0.9 | 18 KB | ########## | 100% igraph-0.9.7 | 1.3 MB | ########## | 100% networkx-2.7.1 | 1.5 MB | ########## | 100% libwebp-1.2.2 | 11 KB | ########## | 100% libbrotlidec-1.0.9 | 33 KB | ########## | 100% pandas-1.4.1 | 11.0 MB | ########## | 100% certifi-2021.10.8 | 145 KB | ########## | 100% pillow-9.0.1 | 44.5 MB | ########## | 100% libwebp-base-1.2.2 | 393 KB | ########## | 100% packaging-21.3 | 36 KB | ########## | 100% kiwisolver-1.4.0 | 58 KB | ########## | 100% Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done

3.but when i used py_available("leidenalg") to check whether the package is installed, it shows:True 20220317144833

4.i am really appreciated that you could help solve this proble

t-kalinowski commented 2 years ago

Some diagnostic questions:

howtofindme commented 2 years ago

THANK YOU ! problem was solved after I re-configured the conda environment! Your suggestion help me a lot!