Skip to content

Example cannot be imported in Windows if python >= 3.8 #8

@diegoferigo

Description

@diegoferigo

Some while ago, I marked the test as allowed to fail, but it would be wise to open an issue to track the problem.

The SWIG example compiles fine in all Window versions, generating the following files:

adding 'mymath/_bindings.pyd'
adding 'mymath/bindings.py'
adding 'mymath/libbindings.dll.a'
adding 'mymath/include/mymath.h'
adding 'mymath/lib/libmymath.a'
adding 'mymath-0.0.0.dist-info/METADATA'
adding 'mymath-0.0.0.dist-info/WHEEL'
adding 'mymath-0.0.0.dist-info/top_level.txt'
adding 'mymath-0.0.0.dist-info/RECORD'

However, when it is imported in the tests, it fails with the following error (more details in any CI job):

=================================== ERRORS ====================================
____________________ ERROR collecting tests/test_mymath.py ____________________
ImportError while importing test module 'D:\a\cmake-build-extension\cmake-build-extension\examples\swig\tests\test_mymath.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
c:\hostedtoolcache\windows\python\3.9.5\x64\lib\importlib\__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\test_mymath.py:3: in <module>
    import mymath.bindings
c:\hostedtoolcache\windows\python\3.9.5\x64\lib\site-packages\mymath\bindings.py:18: in <module>
    from . import _bindings
E   ImportError: DLL load failed while importing _bindings: The specified module could not be found.
=========================== short test summary info ===========================
ERROR tests/test_mymath.py
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.37s ===============================

I have no idea what could cause this error. I marked as allowed to fail also the new Python 3.9 job.


I also caught the following in the Python 3.7 job:

C:\Users\RUNNER~1\AppData\Local\Temp\pip-build-env-t1xho44w\overlay\Lib\site-packages\wheel\bdist_wheel.py:82: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
    warn=(impl == 'cp')):
  C:\Users\RUNNER~1\AppData\Local\Temp\pip-build-env-t1xho44w\overlay\Lib\site-packages\wheel\bdist_wheel.py:87: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
    sys.version_info < (3, 8))) \

The second warning disappears if Python >= 3.8.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions