PyWavelets / pywt

PyWavelets - Wavelet Transforms in Python
http://pywavelets.readthedocs.org
MIT License
1.97k stars 460 forks source link

import pywt error when pip-installed with -e flag #733

Closed igtrnt closed 2 months ago

igtrnt commented 2 months ago

If I install PyWavelets with:

git clone https://github.com/PyWavelets/pywt.git
cd  pywt/
pip install -e .

I am getting the error below when I import pywt in my code:

Exception has occurred: FileNotFoundError
[Errno 2] No such file or directory: '/tmp/pip-build-env-yhtdk1_2/normal/bin/ninja'
  File "/home/user1/test.py", line 3, in <module>
    import pywt
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-env-yhtdk1_2/normal/bin/ninja'

If I do not use -e option in pip install, the error goes away.

agriyakhetarpal commented 2 months ago

Hi, @igtrnt – PyWavelets uses Meson as its build system when building from sources, which recommends the use of the --no-build-isolation flag when performing an editable installation with -e.

With this flag, you will have to pre-install ninja, Cython, and other build-time dependencies before the invocation of the editable installation command. You may obtain a distribution of ninja with your system-level package manager on Linux or through popular tools like Homebrew on macOS. Though it is not preferred as much as a system-level installation, you may also get a ninja distribution from PyPI/pip.

rgommers commented 2 months ago

Thanks for explaining @agriyakhetarpal. Indeed, --no-build-isolation will fix the problem here. See https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html for more details on why.