yanx27 / PointASNL

PointASNL: Robust Point Clouds Processing using Nonlocal Neural Networks with Adaptive Sampling (CVPR 2020)
MIT License
260 stars 34 forks source link

ImportError: No module named 'nearest_neighbors.lib' #33

Open Timaces opened 4 years ago

Timaces commented 4 years ago

I meeting the follow error,can you help me ?

omnisky@omnisky:~/Documents/PointASNL-master/tf_ops$ sh compile_ops.sh omnisky@omnisky:~/Documents/PointASNL-master/tf_ops$ cd ../ omnisky@omnisky:~/Documents/PointASNL-master$ python train.py --data /home/omnisky/Documents/PointASNL-master/data/modelnet40_ply_hdf5_2048 --exp_dir PointASNL_without_noise Traceback (most recent call last): File "train.py", line 57, in MODEL = importlib.import_module(FLAGS.model) # import network module File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 673, in _load_unlocked File "", line 665, in exec_module File "", line 222, in _call_with_frames_removed File "/home/omnisky/Documents/PointASNL-master/models/pointasnl_cls.py", line 9, in from pointasnl_util import PointASNLSetAbstraction, get_repulsion_loss File "/home/omnisky/Documents/PointASNL-master/utils/pointasnl_util.py", line 19, in import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors ImportError: No module named 'nearest_neighbors.lib'

kingsj0405 commented 4 years ago

I have a same issue

yanx27 commented 4 years ago

Hi @Timaces , this problem may caused by different cython library, please try import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors here.

ZhichaoWang970201 commented 3 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error.

UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last):

File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args)

File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True)

AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]
January-cv commented 3 years ago

@ZhichaoWang970201 I have a same issue. Have you solve it?

ChanWunsam commented 3 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error.

UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last):

File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args)

File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True)

AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]

I have the same issue, may be import utils.nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors works fine

ch19971118 commented 3 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error. UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last): File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args) File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True) AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]

I have the same issue, may be import utils.nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors works fine

I have tried what you said,but it doesn't work.Hava you solved this problem?

ch19971118 commented 3 years ago

@ZhichaoWang970201 I have a same issue. Have you solve it?

hello ,have you solved this problem?

UnderTheMangoTree commented 3 years ago

@ZhichaoWang970201 I have a same issue. Have you solve it?

hello ,have you solved this problem? I have solved this problem, and I thinks this problem dues to the error of "sh compile.sh". so you can try to run this statement and see whether exists error. if it has error, please solve them and "import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors" will be ok. if it doesn't has error, then I don't know how to solve them. good luck~

ch19971118 commented 3 years ago

problem, and I thinks this problem dues to the error of "sh compile.sh". so you can try to run this statement and see whether exists error. if it has error, please solve them and "import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors" will be ok. if it doesn't has error, then I don't know how to solve them. goo

Thank you for your reply:)

Mike-6 commented 2 years ago

problem, and I thinks this problem dues to the error of "sh compile.sh". so you can try to run this statement and see whether exists error. if it has error, please solve them and "import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors" will be ok. if it doesn't has error, then I don't know how to solve them. goo

I have a familiar problem. Did you solve this problem?

Mike-6 commented 2 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error.

UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last):

File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args)

File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True)

AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]

I have a familiar problem. Did you solve this problem?

qiqi27 commented 2 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error. UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last): File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args) File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True) AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]

I have a familiar problem. Did you solve this problem?

I also ran into this problem, and I ended up finding out that it was caused by the unsuccessful compilation of the sh compile_op.sh. Before compiling the compile_op.sh, go to utils/cpp_wrappers/compile_wrappers.sh and change !/bin/bash to #! /bin/bash Then compile compile_op.sh, and upon success, import nearest_neighbors.lib.python. nearest_neighbors as nearest_neighbors no errors are reported

Mike-6 commented 2 years ago

When I change "import nearest_neighbors rather than import nearest_neighbors.lib.python.nearest_neighbors as nearest_neighbors". I meet this error. UnknownError (see above for traceback): AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch' Traceback (most recent call last): File "/storage/home/hcoda1/5/zwang945/p-ywang93-0/tensorflow-1.13.1-env/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 207, in call ret = func(*args) File "/storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py", line 31, in knn_query neighbor_idx = nearest_neighbors.knn_batch(support_pts, query_pts, k, omp=True) AttributeError: module 'nearest_neighbors' has no attribute 'knn_batch'

     [[node layer1/PyFunc (defined at /storage/scratch1/5/zwang945/PointASNL-master/utils/pointasnl_util.py:64) ]]

I have a familiar problem. Did you solve this problem?

I also ran into this problem, and I ended up finding out that it was caused by the unsuccessful compilation of the sh compile_op.sh. Before compiling the compile_op.sh, go to utils/cpp_wrappers/compile_wrappers.sh and change !/bin/bash to #! /bin/bash Then compile compile_op.sh, and upon success, import nearest_neighbors.lib.python. nearest_neighbors as nearest_neighbors no errors are reported

thank you

1806610292 commented 1 year ago

I has sloved this problem!when i run bash compile_op.sh,it still occur error,you should to check if It generate file that neareast_neighbors.cpython-37m-x86_64-linux-gnu.so in utils/nearest_neighbors/lib/python .The file is the same as your python version

liuyuansheng624 commented 1 year ago

我已经解决了这个问题!当我运行 bash compile_op.sh 时,它仍然出现错误,你应该检查它是否在 utils/nearest_neighbors/lib/python 中生成 neareast_neighbors.cpython-37m-x86_64-linux-gnu.so 文件。该文件与您的python版本相同

这个文件我也生成了,但是仍然不行