vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
606 stars 78 forks source link

python-igraph requirements not resolved #93

Closed dawe closed 2 years ago

dawe commented 2 years ago

Hello, I have leidenalg among the dependencies of a package I am packaging through conda-forge (see here). The automated build process runs, at the end, pip check and that raises an error for leidenalg:

leidenalg 0.8.8 requires python-igraph, which is not installed.

but python-igraph is currently installed:

conda list | grep igraph
igraph                    0.9.5                ha5be149_0    conda-forge
python-igraph             0.9.8            py39h8c2f370_2    conda-forge

I don't know if this is the right place to ask, but in case do you have any hint on how to solve this?

dawe commented 2 years ago

Apparently leidenalg 0.8.7 does not suffer the same issue

vtraag commented 2 years ago

Sorry, I don't immediately have an idea, it's indeed a bit strange. The leidenalg dependency is pulled in via scanpy, I guess?

What happens if you try to build your package locally? Does it also throw this error, or not? If it does, can you install correctly leidenalg using conda or does that also throw this error?

dawe commented 2 years ago

Hello, I'm having difficulties in building it from source. Anyhow, a simple conda environment such as

conda create -c conda-forge -n leidentest
conda activate leidentest
conda install -c conda-forge leidenalg
pip check

raises the same error, so it has nothing to do with scanpy dependencies

vtraag commented 2 years ago

Thanks for the reproducible example! I didn't quite understand where the problem came from initially, but it's now clear. python-igraph switched to use PyPI igraph instead of python-igraph (see https://github.com/igraph/python-igraph/issues/412), but setup.py of leidenalg still uses python-igraph, while conda provides igraph. I'll update setup.py to depend on igraph instead of python-igraph, which should then start working from the next release onwards.

JoyOtten commented 2 years ago

Is there a way that we can circumvent this for now?

stela2502 commented 2 years ago

I tried the github version of today with commit "Updated vendored igraph to 0.9.5" in the vain hope this problem would be resolved.

I got the error message:

/usr/local/lib/python3.8/dist-packages/leidenalg/__init__.py in <module>
     33 not immediately available in :func:`leidenalg.find_partition`.
     34 """
---> 35 from .functions import ALL_COMMS
     36 from .functions import ALL_NEIGH_COMMS
     37 from .functions import RAND_COMM

/usr/local/lib/python3.8/dist-packages/leidenalg/functions.py in <module>
      1 import sys
----> 2 import igraph as _ig
      3 from . import _c_leiden
      4 from ._c_leiden import ALL_COMMS
      5 from ._c_leiden import ALL_NEIGH_COMMS

~/.local/lib/python3.8/site-packages/igraph/__init__.py in <module>
      6 __license__ = "MIT"
      7 
----> 8 warn_deprecation()
      9 

~/.local/lib/python3.8/site-packages/igraph/_utils.py in warn_deprecation()
     34     """
     35     print(MESSAGE)
---> 36     raise RuntimeError("This package is deprecated. See the deprecation notice above.")
     37 

RuntimeError: This package is deprecated. See the deprecation notice above.

I'll check the source of where the problem resides now. Hope you get that fixed asap...

stela2502 commented 2 years ago

Yes I got the correct script onto my system and it contains the named error. I hope you know what to do with this part of the error message:

Deprecation notice
==================

To avoid name collision with the igraph project, the original igraph visualization
library has been renamed to `jgraph` in December 2015. The `igraph` package on
PyPI will soon be used by the igraph project.

The authors of `jgraph` (ex-igraph) and `python-igraph` (soon-to-be igraph)
project have agreed on a transition period during which old projects still
using `igraph` as a PyPI dependency will receive an error while trying to
import igraph in their own projects. The transition period ends on Sep 1 2021.

Things to do now
----------------

If you wanted to install the graph visualization library by Patrick Fuller,
please install `jgraph` instead. You have time until Sep 1 2021 to do this.

If you wanted to install the Python interface of the igraph network analysis
library, please install `python-igraph` instead. After Sep 1 2021, you can
start installing `igraph` instead. `python-igraph` will keep on working at
least until Sep 1 2022.
stela2502 commented 2 years ago

Hi gain, I am not experienced enough with lleidenalg to know whether this would be correct:

pip install --force-reinstall git+https://github.com/vtraag/leidenalg.git
.
.
.
Installing collected packages: texttable, igraph, python-igraph, leidenalg
  Attempting uninstall: texttable
    Found existing installation: texttable 1.6.4
    Uninstalling texttable-1.6.4:
      Successfully uninstalled texttable-1.6.4
  Attempting uninstall: igraph
    Found existing installation: igraph 0.9.9
    Uninstalling igraph-0.9.9:
      Successfully uninstalled igraph-0.9.9
  Attempting uninstall: python-igraph
    Found existing installation: python-igraph 0.9.9
    Uninstalling python-igraph-0.9.9:
      Successfully uninstalled python-igraph-0.9.9
  Attempting uninstall: leidenalg
    Found existing installation: leidenalg 0.8.9.dev1+gb533668
    Uninstalling leidenalg-0.8.9.dev1+gb533668:
      Successfully uninstalled leidenalg-0.8.9.dev1+gb533668
Successfully installed igraph-0.9.9 leidenalg-0.8.9.dev1+gb533668 python-igraph-0.9.9 texttable-1.6.4
jamestwebber commented 2 years ago

I believe that is fine, igraph is the correct package and python-igraph is a redundant pointer to the same package.

There hasn't been a release of this package since the changeover, but maybe it's time if only for this reason? The requirements in setup.py could be updated to just be igraph instead of the previous name.

vtraag commented 2 years ago

I've corrected this now, I plan to make a new release shortly so that this problem no longer appears when installing from conda-forge.

vtraag commented 2 years ago

The new release 0.8.9 is now available from PyPI and conda-forge, and this issue no longer shows up. Doing

conda create -c conda-forge -n leidentest leidenalg
conda activate leidentest
pip check

now correctly yields No broken requirements found.

JoyOtten commented 2 years ago

Thank you very much for your work!