scipy: Developer installation fails with poetry
I followed the instructions from this guide Building from source for SciPy development and everything worked well including the actual build via:
python dev.py build
Note that I did NOT install the doc and typing/linting dependencies, as I only need the latest main
branch to work inside a python environment for some testing regarding #14740 .
This is the terminal output directly after the build, which for me looks good:
[1606/1606] Linking target scipy/optimize/_highs/_highs_wrapper.cpython-310-x86_64-linux-gnu.so
Build OK
đź’» meson install -C build --only-changed
Installing, see meson-install.log...
Installation OK
To get an interpreter with the latest SciPy source, I tried
python dev.py ipython
and also
python dev.py python
but both fail with
...
File "/home/xxx/scipy/dev.py", line 536, in install_project
raise RuntimeError("Can't install in non-empty directory: "
RuntimeError: Can't install in non-empty directory: '/home/xxx/scipy/build-install'
I was so bold and deleted the build-install
directory, repeating python dev.py ipython
then gives:
...
File "/home/xxx/scipy/dev.py", line 1161, in run
import IPython
ModuleNotFoundError: No module named 'IPython'
however python dev.py python
then actually spawns an interpreter, but then I get
>>> import scipy
Traceback (most recent call last):
File "/home/xxx/scipy/__init__.py", line 51, in <module>
from scipy.__config__ import show as show_config
ModuleNotFoundError: No module named 'scipy.__config__'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/xxx/scipy/__init__.py", line 56, in <module>
raise ImportError(msg) from e
ImportError: Error importing SciPy: you cannot import SciPy while
being in scipy source directory; please exit the SciPy source
tree first and relaunch your Python interpreter.
So here I am stuck, as executing
python -c "import scipy; print(scipy.__version__)"
outside the source directory gives me the correct (this was due to an pre-installed binary of the latest scipy release)1.11.4
, but
python -c "import scipy.signal; scipy.signal.ShortTimeFFT"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'scipy.signal' has no attribute 'ShortTimeFFT'
which should be there as it was merged with PR #17408 and I can also see it here
EDIT: So the problem is: build works, but installing ipython and getting an import scipy
to work fails
@lucascolley advised to fire up a git clean -xdf
, then repeating python dev.py ipython
lead to the exact same error as above (ModuleNotFoundError: No module named 'IPython'
).
My system:
- OS: Ubuntu 22.04
- virtual env.: poetry
About this issue
- Original URL
- State: open
- Created 7 months ago
- Comments: 15 (8 by maintainers)
The build actually works, but getting the latest scipy imported (either in an interpreter or via scripting) fails with poetry.
@tensionhead would you mind editing the title to something like “Build fails in poetry env” so that people can see what the issue is about from a glance?
So there’s something about everything works with
poetry
that’s the issue.Thanks for giving the steps. I can’t immediately see where the problem is, hopefully someone else can chime in.
looks like we should add this