Bug 2278865 - python-dipy fails to build with pytest 8: ModuleNotFoundError: No module named 'dipy.version'
Summary: python-dipy fails to build with pytest 8: ModuleNotFoundError: No module name...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-dipy
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-05-03 12:01 UTC by Tomáš Hrnčiar
Modified: 2024-05-12 18:31 UTC (History)
5 users (show)

Fixed In Version: python-dipy-1.9.0-6.fc41
Clone Of:
Environment:
Last Closed: 2024-05-12 18:31:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-05-03 12:01:04 UTC
python-dipy fails to build with pytest 8.

==================================== ERRORS ====================================
____________________________ ERROR collecting dipy _____________________________
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
dipy/__init__.py:39: in <module>
    from dipy.version import version as __version__
E   ModuleNotFoundError: No module named 'dipy.version'
=========================== short test summary info ============================
ERROR dipy - ModuleNotFoundError: No module named 'dipy.version'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.13s ===============================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07388777-python-dipy/

For all our attempts to build python-dipy with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-dipy/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Sandro 2024-05-03 13:12:41 UTC
It seems the behavior of `--import-mode=importlib` has changed. I haven't had time yet to look around if this is intended.

The version module is present only in the install dir, but not in the source and pytest appears to be importing from the source directory. Moreover, `version.py` is dynamically generated during build.

Here's the meson snippet responsible:

dipy_dir = py3.get_install_dir() / 'dipy'

generate_version = custom_target(
  'generate-version',
  install: true,
  build_always_stale: true,
  build_by_default: true,
  output: 'version.py',
  input: '../tools/version_utils.py',
  command: [py3, '@INPUT@', '--source-root', '@SOURCE_ROOT@'],
  install_dir: dipy_dir
)

I have a workaround following what upstream does, which is basically running tests from an empty directory and using `--pyargs dipy` instead of `--import-mode=importlib`.

I'd still be interested in what changed exactly as this feels like a regression. But maybe my understanding is simply wrong.

Comment 2 Fedora Update System 2024-05-12 18:26:22 UTC
FEDORA-2024-77959444cd (python-dipy-1.9.0-6.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-77959444cd

Comment 3 Fedora Update System 2024-05-12 18:31:06 UTC
FEDORA-2024-77959444cd (python-dipy-1.9.0-6.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.