question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build issue: No module named _th_fft

See original GitHub issue

I’ve installed pytorch_fft from source using python setup.py install --prefix=/my/prefix. I’m getting an error:

import pytorch_fft
#Traceback (most recent call last):
#  File "<stdin>", line 1, in <module>
#  File "pytorch_fft/__init__.py", line 1, in <module>
#    from . import fft
#  File "pytorch_fft/fft/__init__.py", line 1, in <module>
#    from .fft import *
#  File "pytorch_fft/fft/fft.py", line 3, in <module>
#    from .._ext import th_fft
#  File "pytorch_fft/_ext/th_fft/__init__.py", line 3, in <module>
#    from ._th_fft import lib as _lib, ffi as _ffi
#ImportError: No module named _th_fft

It seems the installer is confused (note the strange /home/... directory structure):

pytorch_fft $ find build/
#build/
#build/lib.linux-x86_64-2.7
#build/lib.linux-x86_64-2.7/_th_fft.so
#build/lib.linux-x86_64-2.7/pytorch_fft
#build/lib.linux-x86_64-2.7/pytorch_fft/fft
#build/lib.linux-x86_64-2.7/pytorch_fft/fft/autograd.py
#build/lib.linux-x86_64-2.7/pytorch_fft/fft/__init__.py
#build/lib.linux-x86_64-2.7/pytorch_fft/fft/fft.py
#build/lib.linux-x86_64-2.7/pytorch_fft/__init__.py
#build/lib.linux-x86_64-2.7/pytorch_fft/_ext
#build/lib.linux-x86_64-2.7/pytorch_fft/_ext/__init__.py
#build/lib.linux-x86_64-2.7/pytorch_fft/_ext/th_fft
#build/lib.linux-x86_64-2.7/pytorch_fft/_ext/th_fft/__init__.py
#build/temp.linux-x86_64-2.7
#build/temp.linux-x86_64-2.7/_th_fft.c
#build/temp.linux-x86_64-2.7/build
#build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
#build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_th_fft.o
#build/temp.linux-x86_64-2.7/home
#build/temp.linux-x86_64-2.7/home/mscho
#build/temp.linux-x86_64-2.7/home/mscho/vadim
#build/temp.linux-x86_64-2.7/home/mscho/vadim/pytorch_fft
#build/temp.linux-x86_64-2.7/home/mscho/vadim/pytorch_fft/pytorch_fft
#build/temp.linux-x86_64-2.7/home/mscho/vadim/pytorch_fft/pytorch_fft/src
#build/temp.linux-x86_64-2.7/home/mscho/vadim/pytorch_fft/pytorch_fft/src/th_fft_cuda.o
#build/bdist.linux-x86_64

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gdlgcommented, Apr 18, 2018

Hi @riceric22 I can reproduce the problem. It seems that the problem was introduced by the last commit 390b2c0a126dc5b942cccca8c8634b6ec213c72c. However to reproduce the problem, you need a clean version of the code with no leftover build files from a previously successful build. If you have successfully built the project with an older version, you won’t notice the problem.

To trigger the problem, either clone the repository fresh from Github or remove the build folders: rm build/ dist/ pytorch_fft.egg-info/ -Rf then run python setup.py install.

I think that 390b2c0a126dc5b942cccca8c8634b6ec213c72c is not the correct fix for #23 however it breaks the install for quite a few persons and it would be better to revert it.

0reactions
gdlgcommented, Apr 21, 2018

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named thrift in Python script - Stack Overflow
I am using Linux, and my Thrift server ran fine in PyCharm, but I was getting the ModuleNotFoundError: No module named 'thrift' error...
Read more >
python-thrift is not installed for python3 · Issue #6077 - GitHub
As I see there are custom rules to build thrift from sources managed by MS I guess, and the update procedure is not...
Read more >
ModuleNotFoundError: No module named 'thrift' - RoseIndia.Net
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'thrift' How to remove the ModuleNotFo.
Read more >
No module named thrift in Python script - iTecNote
I've installed Thrift on my Mac using Homebrew: brew install thrift –with-python. That did some work and finished w/o errors reported. I have...
Read more >
RE: ImportError: No module named thrift.transport
Hello Nobuaki, I have renamed src to thrift, but it is not working when called from the script. Importing from python interpreter works...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found