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

[BUG] Pagerank requires NetworkX #1851

Closed
rlratzel opened this issue Sep 27, 2021 · 0 comments · Fixed by #1853
Closed

[BUG] Pagerank requires NetworkX #1851

rlratzel opened this issue Sep 27, 2021 · 0 comments · Fixed by #1853
Assignees
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Milestone

Comments

@rlratzel
Copy link
Contributor

rlratzel commented Sep 27, 2021

Calling Pagerank results in an input type check that requires NetworkX. This should be an optional check performed only if NetworkX is already installed.

# pagerank_demo.py

import cudf,cugraph
df=cudf.read_csv("/Projects/cugraph/datasets/dolphins.csv", delimiter=" ",
                 dtype=["int32", "int32", "float64"],header=None)
G = cugraph.DiGraph()
G.from_cudf_edgelist(df, source="0", destination="1", edge_attr="2")
ranks = cugraph.pagerank(G)
(rapids) [root@923fab474292 cugraph]# python pagerank_demo.py
Traceback (most recent call last):
  File "pagerank_demo.py", line 5, in <module>
    ranks = cugraph.pagerank(G)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cugraph-0+untagged.1.gc41ffd4-py3.8-linux-x86_64.egg/cugraph/link_analysis/pagerank.py", line 98, in pagerank
    G, isNx = cugraph.utilities.check_nx_graph(G, weight)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cugraph-0+untagged.1.gc41ffd4-py3.8-linux-x86_64.egg/cugraph/utilities/nx_factory.py", line 99, in check_nx_graph
    raise RuntimeError("NetworkX could not be imported, cannot check G")
RuntimeError: NetworkX could not be imported, cannot check G

cc @ChuckHastings

@rlratzel rlratzel added bug Something isn't working ? - Needs Triage Need team to review and classify labels Sep 27, 2021
@rlratzel rlratzel self-assigned this Sep 27, 2021
@BradReesWork BradReesWork added this to the 21.10 milestone Sep 27, 2021
rapids-bot bot pushed a commit that referenced this issue Sep 28, 2021
…new docstrings, import cleanups (#1853)

* Changed type check code to no longer require NetworkX and instead only check Nx types if installed. #1851
* Cleaned up imports, removed unused imports.
* Changed `import_optional` to use `importlib` instead, and return `MissingModule` instances for easier error reporting.
* Fixed format of example in `rmat` docstring #1807
* Added docstrings for `pylibcugraph` `*_connected_components` APIs. #1782 

Tested changes to optional import and type checking code by uninstalling `NetworkX`, observing the failure shown in #1851, applying change, then testing to observe the same script runs to completion without Nx installed.

closes #1851 
closes #1807 
closes #1782

Authors:
  - Rick Ratzel (https://github.com/rlratzel)

Approvers:
  - Brad Rees (https://github.com/BradReesWork)
  - Joseph Nke (https://github.com/jnke2016)

URL: #1853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
2 participants