Repository navigation
spin test fails after spin install #165
Copy link
Copy link
Closed
Description
I have a meson-python project (https://github.com/akhmerov/python-mumps), and I object the following if I run spin test after spin install:
python-mumps$ spin test
Invoking `build` prior to running tests:
$ meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /home/anton/micromamba/envs/py311/bin/ninja -C /home/anton/Bot/coding/python-mumps/build
ninja: Entering directory `/home/anton/Bot/coding/python-mumps/build'
ninja: no work to do.
$ meson install --only-changed -C build --destdir ../build-install
$ export PYTHONPATH="/home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages"
$ /home/anton/micromamba/envs/py311/bin/python3.12 -P -c 'import mumps'
$ export PYTHONPATH="/home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages"
$ cd /home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages
$ /home/anton/micromamba/envs/py311/bin/python3.12 -m pytest --rootdir=/home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages mumps
================================================================================= test session starts ==================================================================================
platform linux -- Python 3.12.1, pytest-8.0.0, pluggy-1.4.0
Using --randomly-seed=2233073045
rootdir: /home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages
configfile: ../../../../../pytest.ini
plugins: subtests-0.11.0, flake8-1.1.1, datadir-1.5.0, regressions-2.5.0, cov-4.1.0, flakes-4.0.5, anyio-4.2.0, randomly-3.15.0
collected 0 items / 1 error
======================================================================================== ERRORS ========================================================================================
______________________________________________________________________ ERROR collecting mumps/tests/test_mumps.py ______________________________________________________________________
import file mismatch:
imported module 'mumps.tests.test_mumps' has this __file__ attribute:
/home/anton/Bot/coding/python-mumps/mumps/tests/test_mumps.py
which is not the same as the test file we want to collect:
/home/anton/Bot/coding/python-mumps/build-install/usr/lib/python3.12/site-packages/mumps/tests/test_mumps.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
=============================================================================== short test summary info ================================================================================
ERROR mumps/tests/test_mumps.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=================================================================================== 1 error in 0.25s ===================================================================================spin test functions properly if I do pip uninstall python-mumps.
Metadata
Metadata
Assignees
Labels
No labels
Activity
stefanv commentedon Feb 4, 2024
@akhmerov Interesting, I know that editable installs are problematic, but we should be able to get the build install to be preferred over regular pip installs. I'll take a look (are you working on a branch, or is this with
python-mumpsmain?).You may also be interested in #155
akhmerov commentedon Feb 4, 2024
Yes, I see this directly on main.
stefanv commentedon Feb 4, 2024
@akhmerov I am following the
python-mumpsinstallation instructions, but running into:I tried
git submodule update --init, but that did not fetch what was needed. Does it need MUMPS in the parent directory?akhmerov commentedon Feb 4, 2024
You need
mumps-seqin the conda environment, but I also see that the oldmasterstill lingering around and set as default branch in the repo (fixed now). Could it be that you are not on main? The code from your error message is gone on main.stefanv commentedon Feb 5, 2024
Yup, looks like
masterwas pulled down by default.stefanv commentedon Feb 5, 2024
I don't use conda, is there a pip equivalent of
mumps-seq?akhmerov commentedon Feb 5, 2024
If you're on ubuntu/debian, I think everything should work if you apt install
libmumps-seq-dev. Not sure how one gets binary libraries on other OSes.stefanv commentedon Feb 5, 2024
OK, on Fedora I had to install
MUMPS-develand modify the build system to detect the headers:It's unclear why they're missing a
.pcfile.stefanv commentedon Feb 5, 2024
Something's also not quite right with the
pyproject.tomldependencies declaration, sincepip installfails with missing NumPy.Anyway, after all that I cannot reproduce the failure with the latest spin from
mainon Python 3.12 :/stefanv commentedon Feb 5, 2024
In the above error message, pytest suggests:
So, maybe try that.
stefanv commentedon Feb 5, 2024
Here's the problem with the
pyproject.tomlfile:Pretty sure that should have a numpy definition for other version of Python too.
akhmerov commentedon Feb 6, 2024
Thanks for pointing that out, I'll fix that spec in the next versions. That, however, doesn't seem to be the source of the problem and I observed it also on the updated main which just requires numpy. II have now also reproduced the problem in an isolated docker environment:
stefanv commentedon Feb 6, 2024
Can you share the Dockerfile, please?
akhmerov commentedon Feb 6, 2024
It's mambaorg/micromamba like in the snippet above; I didn't prepare a custom dockerfile. Copypasting the second code block into an interactive shell in the container reproduces the issue.
stefanv commentedon Feb 6, 2024
Sorry, commented pre-caffeine.
pytest: use PYTHONPATH, not ., as first entry in sys.path
pytest: use PYTHONPATH, not ., as first entry in sys.path (#166)