conda-incubator / conda-tree

conda dependency tree helper
MIT License
152 stars 12 forks source link

Example doesn't work #11

Closed xapple closed 2 years ago

xapple commented 3 years ago

Hi,

I just followed the README and typed (on latest Ubuntu):

$ conda install -c conda-forge conda-tree

Followed by:

$ conda-tree leaves

This is the result:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/bin/conda-tree", line 6, in <module>
    from conda_tree import main
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/conda_tree.py", line 10, in <module>
    import networkx
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/networkx/__init__.py", line 114, in <module>
    import networkx.generators
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/networkx/generators/__init__.py", line 14, in <module>
    from networkx.generators.intersection import *
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/networkx/generators/intersection.py", line 13, in <module>
    from networkx.algorithms import bipartite
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/networkx/algorithms/__init__.py", line 16, in <module>
    from networkx.algorithms.dag import *
  File "/home/ubuntu/miniconda3/lib/python3.9/site-packages/networkx/algorithms/dag.py", line 23, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/home/ubuntu/miniconda3/lib/python3.9/fractions.py)

Seems like you need to upgrade to networkx-2.5 instead of networkx-2.3

rvalieris commented 3 years ago

hello, conda-tree does not have a restriction on the networkx version, so you should be able to update networkx, try this: conda update networkx

but if you have other packages on your env that also depends on networkx they could be holding it back.

xapple commented 3 years ago

I didn't have networkx installed at all. Here is what happens in an empty environment. The 2.3 version is chosen by default.

Collecting package metadata (current_repodata.json): done
Solving environment: |
Warning: 2 possible package resolutions (only showing differing packages):
  - conda-forge/noarch::decorator-5.0.9-pyhd8ed1ab_0, conda-forge/noarch::networkx-2.3-py_0
  - conda-forge/noarch::decorator-4.4.2-py_0, conda-forge/noarch::networkx-2.5.1-pyhd8ed1abdone

## Package Plan ##

  environment location: /home/ubuntu/miniconda3/envs/new

  added / updated specs:
    - conda-tree

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |      conda_forge           3 KB  conda-forge
    _openmp_mutex-4.5          |            1_gnu          22 KB  conda-forge
    brotlipy-0.7.0             |py39h3811e60_1001         341 KB  conda-forge
    cffi-1.14.5                |   py39he32792d_0         227 KB  conda-forge
    chardet-4.0.0              |   py39hf3d152e_1         205 KB  conda-forge
    conda-package-handling-1.7.3|   py39h3811e60_0         926 KB  conda-forge
    cryptography-3.4.7         |   py39hbca0aa6_0         1.1 MB  conda-forge
    idna-2.10                  |     pyh9f0ad1d_0          52 KB  conda-forge
    ld_impl_linux-64-2.35.1    |       hea4e1c9_2         618 KB  conda-forge
    libffi-3.3                 |       h58526e2_2          51 KB  conda-forge
    libgcc-ng-9.3.0            |      h2828fa1_19         7.8 MB  conda-forge
    libgomp-9.3.0              |      h2828fa1_19         376 KB  conda-forge
    libstdcxx-ng-9.3.0         |      h6de172a_19         4.0 MB  conda-forge
    ncurses-6.2                |       h58526e2_4         985 KB  conda-forge
    openssl-1.1.1k             |       h7f98852_0         2.1 MB  conda-forge
    pip-21.1.2                 |     pyhd8ed1ab_0         1.1 MB  conda-forge
    pycosat-0.6.3              |py39h3811e60_1006         107 KB  conda-forge
    pycparser-2.20             |     pyh9f0ad1d_2          94 KB  conda-forge
    pyopenssl-20.0.1           |     pyhd8ed1ab_0          48 KB  conda-forge
    pysocks-1.7.1              |   py39hf3d152e_3          28 KB  conda-forge
    python-3.9.4               |hffdb5ce_0_cpython        27.4 MB  conda-forge
    readline-8.1               |       h46c0cb4_0         295 KB  conda-forge
    requests-2.25.1            |     pyhd3deb0d_0          51 KB  conda-forge
    ruamel_yaml-0.15.80        |py39h3811e60_1004         268 KB  conda-forge
    setuptools-49.6.0          |   py39hf3d152e_3         943 KB  conda-forge
    six-1.16.0                 |     pyh6c4a22f_0          14 KB  conda-forge
    sqlite-3.35.5              |       h74cdb3f_0         1.4 MB  conda-forge
    tk-8.6.10                  |       h21135ba_1         3.2 MB  conda-forge
    tqdm-4.61.0                |     pyhd8ed1ab_0          80 KB  conda-forge
    tzdata-2021a               |       he74cb21_0         121 KB  conda-forge
    urllib3-1.26.5             |     pyhd8ed1ab_0          99 KB  conda-forge
    wheel-0.36.2               |     pyhd3deb0d_0          31 KB  conda-forge
    xz-5.2.5                   |       h516909a_1         343 KB  conda-forge
    yaml-0.2.5                 |       h516909a_0          82 KB  conda-forge
    zlib-1.2.11                |    h516909a_1010         106 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        54.5 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-1_gnu
  brotlipy           conda-forge/linux-64::brotlipy-0.7.0-py39h3811e60_1001
  ca-certificates    conda-forge/linux-64::ca-certificates-2020.12.5-ha878542_0
  certifi            conda-forge/linux-64::certifi-2020.12.5-py39hf3d152e_1
  cffi               conda-forge/linux-64::cffi-1.14.5-py39he32792d_0
  chardet            conda-forge/linux-64::chardet-4.0.0-py39hf3d152e_1
  conda              conda-forge/linux-64::conda-4.10.1-py39hf3d152e_0
  conda-package-han~ conda-forge/linux-64::conda-package-handling-1.7.3-py39h3811e60_0
  conda-tree         conda-forge/noarch::conda-tree-0.1.1-pyhd8ed1ab_0
  cryptography       conda-forge/linux-64::cryptography-3.4.7-py39hbca0aa6_0
  decorator          conda-forge/noarch::decorator-5.0.9-pyhd8ed1ab_0
  idna               conda-forge/noarch::idna-2.10-pyh9f0ad1d_0
  ld_impl_linux-64   conda-forge/linux-64::ld_impl_linux-64-2.35.1-hea4e1c9_2
  libffi             conda-forge/linux-64::libffi-3.3-h58526e2_2
  libgcc-ng          conda-forge/linux-64::libgcc-ng-9.3.0-h2828fa1_19
  libgomp            conda-forge/linux-64::libgomp-9.3.0-h2828fa1_19
  libstdcxx-ng       conda-forge/linux-64::libstdcxx-ng-9.3.0-h6de172a_19
  ncurses            conda-forge/linux-64::ncurses-6.2-h58526e2_4
  networkx           conda-forge/noarch::networkx-2.3-py_0
  openssl            conda-forge/linux-64::openssl-1.1.1k-h7f98852_0
  pip                conda-forge/noarch::pip-21.1.2-pyhd8ed1ab_0
  pycosat            conda-forge/linux-64::pycosat-0.6.3-py39h3811e60_1006
  pycparser          conda-forge/noarch::pycparser-2.20-pyh9f0ad1d_2
  pyopenssl          conda-forge/noarch::pyopenssl-20.0.1-pyhd8ed1ab_0
  pysocks            conda-forge/linux-64::pysocks-1.7.1-py39hf3d152e_3
  python             conda-forge/linux-64::python-3.9.4-hffdb5ce_0_cpython
  python_abi         conda-forge/linux-64::python_abi-3.9-1_cp39
  readline           conda-forge/linux-64::readline-8.1-h46c0cb4_0
  requests           conda-forge/noarch::requests-2.25.1-pyhd3deb0d_0
  ruamel_yaml        conda-forge/linux-64::ruamel_yaml-0.15.80-py39h3811e60_1004
  setuptools         conda-forge/linux-64::setuptools-49.6.0-py39hf3d152e_3
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  sqlite             conda-forge/linux-64::sqlite-3.35.5-h74cdb3f_0
  tk                 conda-forge/linux-64::tk-8.6.10-h21135ba_1
  tqdm               conda-forge/noarch::tqdm-4.61.0-pyhd8ed1ab_0
  tzdata             conda-forge/noarch::tzdata-2021a-he74cb21_0
  urllib3            conda-forge/noarch::urllib3-1.26.5-pyhd8ed1ab_0
  wheel              conda-forge/noarch::wheel-0.36.2-pyhd3deb0d_0
  xz                 conda-forge/linux-64::xz-5.2.5-h516909a_1
  yaml               conda-forge/linux-64::yaml-0.2.5-h516909a_0
  zlib               conda-forge/linux-64::zlib-1.2.11-h516909a_1010
rvalieris commented 3 years ago

thanks for the details, looks like the problem is here:

Warning: 2 possible package resolutions (only showing differing packages):
  - conda-forge/noarch::decorator-5.0.9-pyhd8ed1ab_0, conda-forge/noarch::networkx-2.3-py_0
  - conda-forge/noarch::decorator-4.4.2-py_0, conda-forge/noarch::networkx-2.5.1-pyhd8ed1abdone

so this looks like its a issue with conda dependency resolution, networkx-2.5.1 wants decorator-4.4.2, but conda is trying to maximize version numbers so it picks decorator-5.0.9 and installs networkx-2.3

rvalieris commented 2 years ago

consider using mamba to install packages, I tested and in my experience it gets these details right.