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

Compilation Failure under JupyterLab #8

Closed
Novak3 opened this issue Jun 30, 2019 · 1 comment
Closed

Compilation Failure under JupyterLab #8

Novak3 opened this issue Jun 30, 2019 · 1 comment

Comments

@Novak3
Copy link

Novak3 commented Jun 30, 2019

System:

  • Ubuntu 16.04 docker
  • Python 3.6.7
  • PyTorch 1.1
  • NVCC 10.0
  • g++ 5.4.0-6
  • cmake 3.14.4
  • GNU make 4.1
  • JupyterLab 0.35.4

When running one of the example scripts from the command line (either line by line in a python3 shell, or as 'python3 test.py') everything works fine. When running from what I believe to be a properly configured JupyterLab, I get cmake and make errors.

The chosen test script:

import torch
import pykeops.torch as pktorch

x = torch.arange(1, 10, dtype=torch.float32).view(-1, 3)
y = torch.arange(3, 9, dtype=torch.float32).view(-1, 3)

my_conv = pktorch.Genred('SqNorm2(x-y)', ['x = Vi(3)', 'y = Vj(3)'])
print(my_conv(x, y))

The first part of the errors, showing make and cmake errors while python is still running:

Compiling libKeOpstorch91c92bd508 in /root/.cache/pykeops-1.0.2/:
       formula: Sum_Reduction(SqNorm2(x-y),1)
       aliases: x = Vi(0,3); y = Vj(1,3); 
       dtype  : float32
... 
--------------------- CMAKE DEBUG -----------------
Command '['cmake', '/opt/conda/lib/python3.6/site-packages/pykeops', '-DCMAKE_BUILD_TYPE=Release', '-DFORMULA_OBJ=Sum_Reduction(SqNorm2(x-y),1)', '-DVAR_ALIASES=auto x = Vi(0,3); auto y = Vj(1,3); ', '-Dshared_obj_name=libKeOpstorch91c92bd508', '-D__TYPE__=float', '-DPYTHON_LANG=torch', '-DPYTORCH_INCLUDE_DIR=/opt/conda/lib/python3.6/site-packages/torch/include;/opt/conda/lib/python3.6/site-packages/torch/include/torch/csrc/api/include']' returned non-zero exit status 1.
-- Configuring incomplete, errors occurred!

--------------------- ----------- -----------------

--------------------- MAKE DEBUG -----------------
Command '['cmake', '--build', '.', '--target', 'libKeOpstorch91c92bd508']' returned non-zero exit status 1.

--------------------- ----------- -----------------
Done. 

Followed immediately by the python errors themselves:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/pykeops/common/keops_io.py in load_keops(formula, aliases, dtype, lang, optional_flags)
     44         # high frequency path
---> 45         return importlib.import_module(dll_name)
     46     except ImportError:

/opt/conda/lib/python3.6/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'libKeOpstorch91c92bd508'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/pykeops/common/keops_io.py in _safe_compile_and_load(formula, aliases, dll_name, dtype, lang, optional_flags)
     28             # already compiled, just load
---> 29             return importlib.import_module(dll_name)
     30         except ImportError:

/opt/conda/lib/python3.6/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'libKeOpstorch91c92bd508'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-387377d109a7> in <module>
      7 
      8 my_conv = pktorch.Genred('SqNorm2(x-y)', ['x = Vi(3)', 'y = Vj(3)'])
----> 9 print(my_conv(x, y))

/opt/conda/lib/python3.6/site-packages/pykeops/torch/generic/generic_red.py in __call__(self, backend, device_id, ranges, *args)
    311 
    312         """
--> 313         out = GenredAutograd.apply(self.formula, self.aliases, backend, self.dtype, device_id, ranges, *args)
    314         nx, ny = get_sizes(self.aliases, *args)
    315         nout = nx if self.axis==1 else ny

/opt/conda/lib/python3.6/site-packages/pykeops/torch/generic/generic_red.py in forward(ctx, formula, aliases, backend, dtype, device_id, ranges, *args)
     17     def forward(ctx, formula, aliases, backend, dtype, device_id, ranges, *args):
     18 
---> 19         myconv = load_keops(formula, aliases, dtype, 'torch', ['-DPYTORCH_INCLUDE_DIR=' + ';'.join(include_dirs)])
     20 
     21         # Context variables: save everything to compute the gradient:

/opt/conda/lib/python3.6/site-packages/pykeops/common/keops_io.py in load_keops(formula, aliases, dtype, lang, optional_flags)
     46     except ImportError:
     47         # could not import (ie not compiled), safely compile/import
---> 48         return _safe_compile_and_load(formula, aliases, dll_name, dtype, lang, optional_flags)

/opt/conda/lib/python3.6/site-packages/pykeops/common/utils.py in wrapper_filelock(*args, **kwargs)
     68             with open(build_folder + '/' + lock_file_name, 'w') as f:
     69                 with FileLock(f):
---> 70                     return func(*args, **kwargs)
     71 
     72         return wrapper_filelock

/opt/conda/lib/python3.6/site-packages/pykeops/common/keops_io.py in _safe_compile_and_load(formula, aliases, dll_name, dtype, lang, optional_flags)
     32             # print(dll_name + " not found")
     33             compile_generic_routine(formula, aliases, dll_name, dtype, lang, optional_flags)
---> 34             return importlib.import_module(dll_name)
     35 
     36     # create the name from formula, aliases and dtype.

/opt/conda/lib/python3.6/importlib/__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/conda/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'libKeOpstorch91c92bd508'

I will note that after running various test scripts successfully from the command line, the following contents are in /root/.cache/pykeops-1.0.2, which is in the sys.path as printed from the jupyter script.

14 Jun 30 00:32 .
5 Jun 29 20:15 ..
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
detect_cuda_compute_capabilities.cu
detect_cuda_props.cu
libKeOpstorch91c92bd508.cpython-36m-x86_64-linux-gnu.so
libKeOpstorch91c92bd508.h
libKeOpstorch91c92bd508.so
pybind11
pykeops_build.lock
torch_headers.h
@bcharlier
Copy link
Member

Hi @Novak3 ,

it has been a looong time, but I hope the issue is now fix. Reopen it if you experience a similar problem.

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