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

ImportError: dynamic module does not define module export function (PyInit_libKeOpsnumpy5ac3d464a2) #23

Closed
heslowen opened this issue Sep 24, 2019 · 5 comments

Comments

@heslowen
Copy link

Hello!
There's something wrong when I run the example code as follow.
Actually I see this bug in #17, but I think they are not the same because it's ok for the first time in #17 but failed in my machine.

code

import numpy as np
import pykeops.numpy as pknp

x = np.arange(1, 10).reshape(-1, 3).astype('float32')
y = np.arange(3, 9).reshape(-1, 3).astype('float32')
my_conv = pknp.Genred('SqNorm2(x - y)', ['x = Vi(3)', 'y = Vj(3)'])
res = my_conv(x, y, backend='CPU')
assert res.shape == (2, 1)
print("okay")

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

cmake --version

cmake version 3.15.3

which python

/home/lowen/anaconda3/envs/lowenEnv/bin/python

python --version

Python 3.6.8 :: Anaconda, Inc.

gcc --version

gcc (GCC) 7.4.0
Copyright © 2017 Free Software Foundation, Inc.


output

Compiling libKeOpsnumpy5ac3d464a2 in /home/lowen/.cache/pykeops-1.1.2-cpython-36//build-libKeOpsnumpy5ac3d464a2:
       formula: Sum_Reduction(SqNorm2(x - y),1)
       aliases: x = Vi(0,3); y = Vj(1,3); 
       dtype  : float64
... Done.
Traceback (most recent call last):
  File "xjbx.py", line 972, in <module>
    test_geomloss()
  File "xjbx.py", line 936, in test_geomloss
    my_conv = pknp.Genred('SqNorm2(x - y)', ['x = Vi(3)', 'y = Vj(3)'])
  File "/home/lowen/anaconda3/envs/lowenEnv/lib/python3.6/site-packages/pykeops/numpy/generic/generic_red.py", line 114, in __init__
    self.myconv = LoadKEops(self.formula, self.aliases, self.dtype, 'numpy').import_module()
  File "/home/lowen/anaconda3/envs/lowenEnv/lib/python3.6/site-packages/pykeops/common/keops_io.py", line 52, in import_module
    return importlib.import_module(self.dll_name)
  File "/home/lowen/anaconda3/envs/lowenEnv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: dynamic module does not define module export function (PyInit_libKeOpsnumpy5ac3d464a2)
@heslowen
Copy link
Author

I create a new conda virtual environment and install all the demand packages(python,numpy,cmake,pytorch,gcc,cuda), but it failed again...I got the same output as mentioned above.
Someone pleases help me! T_T

@joanglaunes
Copy link
Contributor

I think the problem is that your gcc and nvcc versions are not compatible. You need to upgrade cuda toolkit or downgrade gcc. To check, you can try this : download GetGpuProps.cu which is in keops/keops/examples and try to compile via
nvcc GetGpuProps.cu
My guess is that it will output "gcc >6 is not supported".

@heslowen
Copy link
Author

Yes, you are right. When i compile GetGpuProps.cu, it output:

error -- unsupported GNU version! gcc versions later than 6 are not supported!
 error -- unsupported GNU version! gcc versions later than 6 are not supported!

but, when I compile it in a new conda virtual environment(gcc7.3,cudatoolkit10.0.130), it output

nvcc GetGpuProps.cu 
nvcc fatal   : Path to libdevice library not specified

@joanglaunes
Copy link
Contributor

Ok, but it is still a problem with your installation of cuda ; it is not a KeOps issue. The only solution I can give is to upgrade Cuda to version 10 as root, not via the anaconda package.

@heslowen
Copy link
Author

Yes, thanks for your help! Hope that after I upgrade Cuda everything is ok~

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