silx-kit / pyFAI

Fast Azimuthal Integration in Python
Other
104 stars 94 forks source link

[debian 10] ImportError: cannot import name ocl #972

Open picca opened 5 years ago

picca commented 5 years ago

hello, while preparing the package, I get this error

make[1] : on entre dans le répertoire « /home/picca/Debian/pyfai/pyfai »                                                                                                 nd 
mkdir -p /home/picca/Debian/pyfai/pyfai/.cache/ # create POCL cachedir in order to avoid an FTBFS in sbuild
PYBUILD_SYSTEM=custom \
PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} http_proxy='127.0.0.1:9' PYFAI_TESTIMAGES=testimages PYFAI_DATA=/home/picca/Debian/pyfai/pyfai xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} ./run_tests.py --low-mem --no-opencl --installed" dh_auto_test
I: pybuild base:217: PYTHONPATH=/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build http_proxy='127.0.0.1:9' PYFAI_TESTIMAGES=testimages PYFAI_DATA=/home/picca/Debian/pyfai/pyfai xvfb-run -a --server-args="-screen 0 1024x768x24" python2.7 ./run_tests.py --low-mem --no-opencl --installed                                      p.p
INFO:pyFAI.setup:Use setuptools
INFO:pyFAI.setup:Use setuptools.setup
WARNING:pyFAI.directories:testimage directory testimages does not exist
WARNING:run_tests:Test pyFAI 0.16.0 from /home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI
WARNING:py.warnings:/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:96: ImportWarning: Not importing directory '/usr/lib/python2.7/dist-packages/scipy/spatial/qhull': missing __init__.py
  from .qhull import *

WARNING:py.warnings:/usr/lib/python2.7/dist-packages/scipy/optimize/_minimize.py:37: ImportWarning: Not importing directory '/usr/lib/python2.7/dist-packages/scipy/optimize/lbfgsb': missing __init__.py
  from .lbfgsb import _minimize_lbfgsb

Traceback (most recent call last):
  File "./run_tests.py", line 543, in <module>
    unittest.defaultTestLoader.loadTestsFromNames(options.test_name))
  File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames                                                                                          nd 
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 115, in loadTestsFromName
    test = obj()
  File "/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/test/__init__.py", line 50, in suite
    from . import test_all
  File "/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/test/test_all.py", line 48, in <module>
    from . import test_geometry_refinement
  File "/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/test/test_geometry_refinement.py", line 49, in <module>
    from .. import geometryRefinement                                                                                                                                    nd 
  File "/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/geometryRefinement.py", line 48, in <module>
    from . import azimuthalIntegrator
  File "/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/azimuthalIntegrator.py", line 111, in <module>
    from .opencl import ocl
ImportError: cannot import name ocl
E: pybuild pybuild:338: test: plugin custom failed with: exit code=1: PYTHONPATH=/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build http_proxy='127.0.0.1:9' PYFAI_TESTIMAGES=testimages PYFAI_DATA=/home/picca/Debian/pyfai/pyfai xvfb-run -a --server-args="-screen 0 1024x768x24" python2.7 ./run_tests.py --low-mem --no-opencl --installed
dh_auto_test: pybuild --test -i python{version} -p 2.7 returned exit code 13                                                                                             nd 
make[1]: *** [debian/rules:27: override_dh_auto_test] Error 25
picca commented 5 years ago

If I try to execute from pyFAI.opencl import ocl, I get this error message

picca@mordor:~/Debian/pyfai/pyfai$ PYTHONPATH=/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build python2.7
Python 2.7.15+ (default, Aug 31 2018, 11:56:52) 
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyFAI.opencl import ocl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyFAI/__init__.py", line 50, in <module>
    raise RuntimeError("Do NOT use %s from its sources: build it and use the built version" % project)
RuntimeError: Do NOT use pyFAI from its sources: build it and use the built version
picca commented 5 years ago

Here the sys.path

>>> import sys
>>> sys.path
['', '/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/wx-3.0-gtk3']

we can see that '' is the first path

picca commented 5 years ago

If I change the current dir, it works.

picca@mordor:~/Debian/pyfai$ PYTHONPATH=/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build python2.7
Python 2.7.15+ (default, Aug 31 2018, 11:56:52) 
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyFAI.opencl import ocl

and the sys.path is identical to the precedent.

picca commented 5 years ago

I instrumented the code of /home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build/pyFAI/azimuthalIntegrator.py in order to print the sys.path

and I get this

['/home/picca/Debian/pyfai/pyfai/.pybuild/cpython2_2.7_pyfai/build', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/wx-3.0-gtk3']

now we do not have ''

picca commented 5 years ago

Ok, this is a bad interaction with the --no-opencl option. If I remove --no-opencl from the command line it works.