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] : No module named 'pygmtools.c_astar' #92

Closed
chowkamlee81 opened this issue Dec 11, 2023 · 3 comments
Closed

[BUG] : No module named 'pygmtools.c_astar' #92

chowkamlee81 opened this issue Dec 11, 2023 · 3 comments

Comments

@chowkamlee81
Copy link

chowkamlee81 commented Dec 11, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Code to reproduce the behavior:

python plot_deep_image_matching_pytorch.ipynb

Expected behavior
Successfully run image matching algorithm

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • OS: Ubuntu 20.04.4 LTS
  • Pygmtools Version 0.4.2
  • Environment report, by running the command python3 -c 'import pygmtools; pygmtools.env_report()'
  • ``
  • NumPy 1.24.4
    SciPy 1.10.1
    pygmtools 0.4.2
    Torch 1.12.1+cu113
    Paddle not installed
    Jittor not installed``

Additional context
Add any other context about the problem here.
image

@rogerwwww kindly help

@heatingma
Copy link
Member

Hello! I'm glad to answer your question.

We ran the file "plot_deep_image_matching_pytorch.py" in the environment you provided and didn't encounter any bug.

The bug you're experiencing is because the dynamic link library for c_astar cannot be found. Could you check if you can find a file similar to c_astar.cpython-38-x86_64-linux-gnu.so in the directory /data/pygm_env/lib/python3.8/site-packages/pygmtools/?

If you cannot find the file, you can try reinstalling pygmtools. Additionally, we provide the source code for astar, which is located in the c_astar subfolder of pygmtools. You can navigate to that subfolder and use the following command to generate the .so file.

python c_astar_setup.py build_ext --inplace

If you're still unable to resolve the issue, please let us know, and we'll be happy to continue assisting you.

@chowkamlee81
Copy link
Author

@heatingma
iam getting now error below
ImportError: cannot import name 'c_astar' from 'pygmtools.c_astar' (unknown location)
image

ImportError Traceback (most recent call last)
Cell In[13], line 3
1 n1 = params[0]
2 n2 = params[1]
----> 3 X = pygm.sm(K, n1, n2)

File /data/pygmtools/pygmtools/classic_solvers.py:370, in sm(K, n1, n2, n1max, n2max, x0, max_iter, backend)
368 if backend is None:
369 backend = pygmtools.BACKEND
--> 370 _check_data_type(K, 'K', backend)
371 if _check_shape(K, 2, backend):
372 K = _unsqueeze(K, 0, backend)

File /data/pygmtools/pygmtools/utils.py:1125, in _check_data_type(input, *args)
1123 args = (input, var_name, raise_err)
1124 try:
-> 1125 mod = importlib.import_module(f'pygmtools.{backend}_backend')
1126 fn = mod._check_data_type
1127 except (ModuleNotFoundError, AttributeError):

File /usr/lib/python3.8/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File :1014, in _gcd_import(name, package, level)

File :991, in find_and_load(name, import)

File :975, in find_and_load_unlocked(name, import)

File :671, in _load_unlocked(spec)

File :848, in exec_module(self, module)

File :219, in _call_with_frames_removed(f, *args, **kwds)

File /data/pygmtools/pygmtools/pytorch_backend.py:23
20 from .pytorch_astar_modules import GCNConv, AttentionModule, TensorNetworkModule, GraphPair,
21 VERY_LARGE_INT, to_dense_adj, to_dense_batch, default_parameter, check_layer_parameter, node_metric
22 from torch import Tensor
---> 23 from pygmtools.c_astar import c_astar
25 #############################################
26 # Linear Assignment Problem Solvers #
27 #############################################
29 from pygmtools.numpy_backend import _hung_kernel

ImportError: cannot import name 'c_astar' from 'pygmtools.c_astar' (unknown location)

@chowkamlee81
Copy link
Author

@heatingma after using your suggested command python c_astar_setup.py build_ext --inplace i reinstalled pygmtools again using python -m pip install -e .. Iam able to solve the issue. Hence closing now

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

2 participants