dfm / python-nufft

Python bindings to a subset of the NUFFT algorithm
Other
61 stars 13 forks source link

Installation Issue: No module named 'nufft._nufft' #8

Closed stevenxcao closed 6 years ago

stevenxcao commented 6 years ago

I have Ubuntu 18.04 with gfortran, and I'm using conda python 3.6.5. I ran the following to install:

git clone https://github.com/dfm/python-nufft.git
cd python-nufft
python setup.py install

However, I got the following error when trying to import:

Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nufft
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python-nufft/nufft/__init__.py", line 21, in <module>
    from .nufft import nufft1d1freqs, nufft1d1, nufft1d2, nufft1d3, nufft2d1, nufft2d2, nufft2d3, nufft3d1, nufft3d2, nufft3d3
  File ".../python-nufft/nufft/nufft.py", line 18, in <module>
    from ._nufft import (
ModuleNotFoundError: No module named 'nufft._nufft'

Solution:
I replaced .../python-nufft/nufft/ with .../python-nufft/build/lib.linux-x86_64-3.6/nufft/ and now everything works.

dfm commented 6 years ago

If you want to run code within the python-nufft directory then you need to run

python setup.py build_ext --inplace

If you're going to use it in other directories, install works. This is true for all Python modules with compiled extensions :-)