Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not know how to install louvain #46

Closed
hengshiyu opened this issue Nov 15, 2018 · 13 comments
Closed

Do not know how to install louvain #46

hengshiyu opened this issue Nov 15, 2018 · 13 comments

Comments

@hengshiyu
Copy link

Hi,

I am using scanpy which also requires louvain to be installed (https://github.com/theislab/scanpy/blob/master/docs/installation.rst). On my own laptop, I would install through anaconda and have louvain.

However, I could not install or use it on my server.

First, I previously used python 3.5.2 and installed louvain (0.6.1) through "pip install louvain --user" as well as python-igraph (0.7.1.post6). When I run the code, I got:

"../site-packages/matplotlib/path.py", line 17, in
from . import _path, rcParams
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by
../lib/python3.6/site-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)

Second, I changed to anaconda virtual environment of python version 3.6 and installed louvain 0.6.1 and python-igraph (0.7.1.post6) and (python-louvain 0.11) . I got:
"
../lib/python3.6/site-packages/matplotlib/path.py", line 17, in
from . import _path, rcParams
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ../.conda/envs/virtual_env/lib/python3.6/site-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)"

Third, I changed to venv virtual environment built from python 3.6 from anaconda 3. I could not install louvain. When I did "pip install louvain", I got:

../compiler_compat/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

Although I could install python-louvain, I got when I run my code:

../lib/python3.6/site-packages/scanpy/tools/louvain.py", line 109, in louvain
import louvain
ModuleNotFoundError: No module named 'louvain'

Do you know what might cause this and how to solve the problem that louvain could not be installed on server?

@vtraag
Copy link
Owner

vtraag commented Nov 15, 2018

Perhaps confusingly, the python-louvain package does not have much to do with this louvain-igraph package. You should be able to install louvain-igraph in a conda environment simply using

conda install -c vtraag louvain 

I'm not sure if that is the path you followed to install the package? The error you get using Anaconda is actually an error from matplotlib, not from louvain-igraph.

On another note, the louvain-igraph package has become deprecated, in favour of the new leidenalg package. From scverse/scanpy#350, it seems that the new leidenalg package will be supported in scanpy shortly.

@hengshiyu
Copy link
Author

I found in the third one I still could not install louvain in my ordinary venv virtual environment through "conda install -c vtraag louvain" and it says Solving environment: failed
Traceback (most recent call last):
..
File "../python-anaconda3/created-20170712/lib/python3.6/site-packages/conda/history.py", line 158, in _parse_old_format_specs_string
specs[-1] = ','.join([specs[-1], spec])
IndexError: list index out of range

I am guessing this is because I am using a read-only conda environment. I will try the other two methods which I could install louvain but got some error about matplotlib.
Thanks

@vtraag
Copy link
Owner

vtraag commented Nov 15, 2018

OK, let me know if you resolved the issue, then I will close the issue.

@hengshiyu
Copy link
Author

I found actually in my first use of louvain with python 3.5.2, I actually also encountered the same issue with louvain as the second one with matplotlib:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File ".../3.5.2/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "../preprocessing/write_tfrecords.py", line 141, in read_and_serialize
sc_data.apply_preprocessing()
File "../preprocessing/process_raw.py", line 362, in apply_preprocessing
self.clustering()
File "../process_raw.py", line 147, in clustering
sc.tl.louvain(clustered, resolution=self.cluster_res)
File "../.local/lib/python3.5/site-packages/scanpy/tools/louvain.py", line 109, in louvain
import louvain
File "../.local/lib/python3.5/site-packages/louvain/init.py", line 35, in
from .functions import ALL_COMMS
File "../.local/lib/python3.5/site-packages/louvain/functions.py", line 3, in
from . import _c_louvain
ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ../.local/lib/python3.5/site-packages/louvain/_c_louvain.cpython-35m-x86_64-linux-gnu.so)
"""

I this this libstdc++ issue is also with louvain. Do you have any idea about this?

@vtraag
Copy link
Owner

vtraag commented Nov 15, 2018

See this issue for a potential solution: vtraag/leidenalg#2. Does this solve your problem?

@hengshiyu
Copy link
Author

I still got the error messages for my anaconda virtual environment if I degrade my libgcc to 5.2.0 from 7.2.0. This error is with matplotlib:

 File "../.conda/envs/wgan_env/lib/python3.6/site-packages/matplotlib/path.py", line 17, in <module>
    from . import _path, rcParams
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ../.conda/envs/wgan_env/lib/python3.6/site-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)

Previously I used normal environment, the similar error is with louvain:

  File "../.local/lib/python3.5/site-packages/louvain/functions.py", line 3, in <module>
    from . import _c_louvain
ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/hengshi/.local/lib/python3.5/site-packages/louvain/_c_louvain.cpython-35m-x8$

I feel this is complicated and do not know how to solve it

@vtraag
Copy link
Owner

vtraag commented Nov 15, 2018

It is a bit difficult to see what the problem is.

Could you perhaps do the following?

Create a new clean conda environment (named "test", assuming you don't already have such an environment)

conda create --name test

and then after activating the new environment using

conda activate test

could you install the packages as follows

conda install -c conda-forge igraph python-igraph
conda install -c vtraag louvain-igraph

Does the louvain-igraph package work correctly after this? In other words, if you run python and do import louvain, what error (if any) do you get?

@hengshiyu
Copy link
Author

I could run those lines and install louvain seeming. But I could not import louvain and could not find louvain in my conda list.

(test) [XX]$ conda install -c conda-forge igraph python-igraph
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.5
  latest version: 4.5.11

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: ../.conda/envs/test

  added / updated specs: 
    - igraph
    - python-igraph


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pcre-8.41                  |       hfc679d8_3         243 KB  conda-forge
    xorg-xproto-7.0.31         |       h470a237_7          72 KB  conda-forge
    gettext-0.19.8.1           |       h5e8e0c9_1         3.5 MB  conda-forge
    xorg-libxext-1.3.3         |       h470a237_4          45 KB  conda-forge
    xorg-libsm-1.2.3           |       h8c8a85c_0          24 KB  conda-forge
    freetype-2.9.1             |       h6debe1e_4         800 KB  conda-forge
    libstdcxx-ng-7.2.0         |       hdf63c60_3         2.5 MB  conda-forge
    libgcc-ng-7.2.0            |       hdf63c60_3         6.1 MB  conda-forge
    pip-18.1                   |        py36_1000         1.8 MB  conda-forge
    xorg-libice-1.0.9          |       h470a237_4          55 KB  conda-forge
    libgfortran-ng-7.2.0       |       hdf63c60_3         1.2 MB  conda-forge
    xorg-xextproto-7.3.0       |       h470a237_2          26 KB  conda-forge
    setuptools-40.6.2          |           py36_0         632 KB  conda-forge
    readline-7.0               |       haf1bffa_1         381 KB  conda-forge
    xorg-renderproto-0.11.1    |       h470a237_2           8 KB  conda-forge
    libpng-1.6.35              |       ha92aebf_2         305 KB  conda-forge
    libuuid-2.32.1             |       h470a237_2          24 KB  conda-forge
    xorg-libxrender-0.9.10     |       h470a237_2          28 KB  conda-forge
    zlib-1.2.11                |       h470a237_3          93 KB  conda-forge
    python-3.6.6               |       h5001a0f_3        20.5 MB  conda-forge
    libxcb-1.13                |       h470a237_2         393 KB  conda-forge
    libffi-3.2.1               |       hfc679d8_5          51 KB  conda-forge
    icu-58.2                   |       hfc679d8_0        22.8 MB  conda-forge
    wheel-0.32.2               |           py36_0          34 KB  conda-forge
    xz-5.2.4                   |       h470a237_1         328 KB  conda-forge
    pthread-stubs-0.4          |       h470a237_1           5 KB  conda-forge
    xorg-libxdmcp-1.1.2        |       h470a237_7          17 KB  conda-forge
    xorg-libx11-1.6.6          |       h470a237_0         890 KB  conda-forge
    cairo-1.14.12              |       h276e583_5         1.3 MB  conda-forge
    glib-2.56.2                |       h464dc38_1         4.6 MB  conda-forge
    xorg-kbproto-1.0.7         |       h470a237_2          25 KB  conda-forge
    sqlite-3.25.3              |       hb1c47c0_0         1.6 MB  conda-forge
    ncurses-6.1                |       hfc679d8_1         1.2 MB  conda-forge
    fontconfig-2.13.1          |       h65d0f4c_0         320 KB  conda-forge
    xorg-libxau-1.0.8          |       h470a237_6          12 KB  conda-forge
    tk-8.6.8                   |       ha92aebf_0         3.1 MB  conda-forge
    libxml2-2.9.8              |       h422b904_5         1.8 MB  conda-forge
    ------------------------------------------------------------
                                           Total:        76.9 MB

The following NEW packages will be INSTALLED:

    ca-certificates:  2018.10.15-ha4d7672_0      conda-forge
    cairo:            1.14.12-h276e583_5         conda-forge
    certifi:          2018.10.15-py36_1000       conda-forge
    fontconfig:       2.13.1-h65d0f4c_0          conda-forge
    freetype:         2.9.1-h6debe1e_4           conda-forge
    gettext:          0.19.8.1-h5e8e0c9_1        conda-forge
    glib:             2.56.2-h464dc38_1          conda-forge
    gmp:              6.1.2-hfc679d8_0           conda-forge
    icu:              58.2-hfc679d8_0            conda-forge
    igraph:           0.7.1-hcc8e21d_5           conda-forge
    libffi:           3.2.1-hfc679d8_5           conda-forge
    libgcc-ng:        7.2.0-hdf63c60_3           conda-forge
    libgfortran-ng:   7.2.0-hdf63c60_3           conda-forge
    libiconv:         1.15-h470a237_3            conda-forge
    libpng:           1.6.35-ha92aebf_2          conda-forge
    libstdcxx-ng:     7.2.0-hdf63c60_3           conda-forge
    libuuid:          2.32.1-h470a237_2          conda-forge
    libxcb:           1.13-h470a237_2            conda-forge
    libxml2:          2.9.8-h422b904_5           conda-forge
    ncurses:          6.1-hfc679d8_1             conda-forge
    openssl:          1.0.2p-h470a237_1          conda-forge
    pcre:             8.41-hfc679d8_3            conda-forge
    pip:              18.1-py36_1000             conda-forge
    pixman:           0.34.0-h470a237_3          conda-forge
    pthread-stubs:    0.4-h470a237_1             conda-forge
    pycairo:          1.18.0-py36h4d1f301_0      conda-forge
    python:           3.6.6-h5001a0f_3           conda-forge
    python-igraph:    0.7.1.post6-py36h470a237_5 conda-forge
    readline:         7.0-haf1bffa_1             conda-forge
    setuptools:       40.6.2-py36_0              conda-forge
    sqlite:           3.25.3-hb1c47c0_0          conda-forge
    tk:               8.6.8-ha92aebf_0           conda-forge
    wheel:            0.32.2-py36_0              conda-forge
    xorg-kbproto:     1.0.7-h470a237_2           conda-forge
    xorg-libice:      1.0.9-h470a237_4           conda-forge
    xorg-libsm:       1.2.3-h8c8a85c_0           conda-forge
    xorg-libx11:      1.6.6-h470a237_0           conda-forge
    xorg-libxau:      1.0.8-h470a237_6           conda-forge
    xorg-libxdmcp:    1.1.2-h470a237_7           conda-forge
    xorg-libxext:     1.3.3-h470a237_4           conda-forge
    xorg-libxrender:  0.9.10-h470a237_2          conda-forge
    xorg-renderproto: 0.11.1-h470a237_2          conda-forge
    xorg-xextproto:   7.3.0-h470a237_2           conda-forge
    xorg-xproto:      7.0.31-h470a237_7          conda-forge
    xz:               5.2.4-h470a237_1           conda-forge
    zlib:             1.2.11-h470a237_3          conda-forge

Proceed ([y]/n)? y
Invalid choice: conda install -c vtraag louvain-igraphy
Proceed ([y]/n)? y


Downloading and Extracting Packages
pcre-8.41            |  243 KB | ########################################################################################################################################## | 100% 
xorg-xproto-7.0.31   |   72 KB | ########################################################################################################################################## | 100% 
gettext-0.19.8.1     |  3.5 MB | ########################################################################################################################################## | 100% 
xorg-libxext-1.3.3   |   45 KB | ########################################################################################################################################## | 100% 
xorg-libsm-1.2.3     |   24 KB | ########################################################################################################################################## | 100% 
freetype-2.9.1       |  800 KB | ########################################################################################################################################## | 100% 
libstdcxx-ng-7.2.0   |  2.5 MB | ########################################################################################################################################## | 100% 
libgcc-ng-7.2.0      |  6.1 MB | ########################################################################################################################################## | 100% 
pip-18.1             |  1.8 MB | ########################################################################################################################################## | 100% 
xorg-libice-1.0.9    |   55 KB | ########################################################################################################################################## | 100% 
libgfortran-ng-7.2.0 |  1.2 MB | ########################################################################################################################################## | 100% 
xorg-xextproto-7.3.0 |   26 KB | ########################################################################################################################################## | 100% 
setuptools-40.6.2    |  632 KB | ########################################################################################################################################## | 100% 
readline-7.0         |  381 KB | ########################################################################################################################################## | 100% 
xorg-renderproto-0.1 |    8 KB | ########################################################################################################################################## | 100% 
libpng-1.6.35        |  305 KB | ########################################################################################################################################## | 100% 
libuuid-2.32.1       |   24 KB | ########################################################################################################################################## | 100% 
xorg-libxrender-0.9. |   28 KB | ########################################################################################################################################## | 100% 
zlib-1.2.11          |   93 KB | ########################################################################################################################################## | 100% 
python-3.6.6         | 20.5 MB | ########################################################################################################################################## | 100% 
libxcb-1.13          |  393 KB | ########################################################################################################################################## | 100% 
libffi-3.2.1         |   51 KB | ########################################################################################################################################## | 100% 
icu-58.2             | 22.8 MB | ########################################################################################################################################## | 100% 
wheel-0.32.2         |   34 KB | ########################################################################################################################################## | 100% 
xz-5.2.4             |  328 KB | ########################################################################################################################################## | 100% 
pthread-stubs-0.4    |    5 KB | ########################################################################################################################################## | 100% 
xorg-libxdmcp-1.1.2  |   17 KB | ########################################################################################################################################## | 100% 
xorg-libx11-1.6.6    |  890 KB | ########################################################################################################################################## | 100% 
cairo-1.14.12        |  1.3 MB | ########################################################################################################################################## | 100% 
glib-2.56.2          |  4.6 MB | ########################################################################################################################################## | 100% 
xorg-kbproto-1.0.7   |   25 KB | ########################################################################################################################################## | 100% 
sqlite-3.25.3        |  1.6 MB | ########################################################################################################################################## | 100% 
ncurses-6.1          |  1.2 MB | ########################################################################################################################################## | 100% 
fontconfig-2.13.1    |  320 KB | ########################################################################################################################################## | 100% 
xorg-libxau-1.0.8    |   12 KB | ########################################################################################################################################## | 100% 
tk-8.6.8             |  3.1 MB | ########################################################################################################################################## | 100% 
libxml2-2.9.8        |  1.8 MB | ########################################################################################################################################## | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(test) [hengshi@flux-login2 scGAN_master]$ ls
dockerfile  heart_2nd_prep.o32163446  heart_2nd_prep.o32163474  __init__.py  main.py  parameters.json  README.md  WGAN.pbs
estimators  heart_2nd_prep.o32163473  heart_2nd_prep.o32165265  LICENSE      Misc     preprocessing    vwgan_env
(test) [hengshi@flux-login2 scGAN_master]$ python 
Python 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:08:43) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import louvain
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'louvain'

@hengshiyu
Copy link
Author

Hi, I installed louvain and solved the issue. I found that it should be:

conda install -c vtraag louvain

rather than installing louvain-igraph

@vtraag
Copy link
Owner

vtraag commented Nov 18, 2018

Yes, quite right, sorry about that 👍

@hengshiyu
Copy link
Author

Thanks!

@MohammadHeydari
Copy link

What are the differences between python-louvain and louvain-igraph?
I already made a community detection with louvain on networkX, but now I must implement it in python-igraph

@vtraag
Copy link
Owner

vtraag commented May 17, 2019

python-louvain works with networkx, while louvain-igraph works with python-igraph. This package also implements a variety of other methods, such as CPM, Surprise and Significance. It can also work with multiplex networks. However, note that this package has been superseded by the leidenalg package. You are strongly recommended to use that package instead of louvain-igraph package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants