flit: ModuleNotFoundError: No module named 'flit_core.dummy'
I’m building my project with
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
and since earlier today I’m getting the error message
[...]
ModuleNotFoundError: No module named 'flit_core.dummy'
[end of output]
when running pip install . on the repo. Perhaps I messed up something in the package, but the error message points towards flit. Any idea what’s going on?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 18
- Comments: 22 (11 by maintainers)
Commits related to this issue
- Add failing test for issue gh-530 — committed to pypa/flit by takluyver 2 years ago
- dev-python/flit_core: backport relative import fix Fixes emerging e.g. pyparsing. Bug: https://github.com/pypa/flit/pull/530 Bug: https://github.com/pypa/flit/pull/531 Signed-off-by: Sam James <sam@... — committed to gentoo/gentoo by thesamesam 2 years ago
- Work around a Flit bug. (#1626) There was a Flit release yesterday that broke `tox -epackage`. See: https://github.com/pypa/flit/issues/530 — committed to pex-tool/pex by jsirois 2 years ago
OK, it seems like #531 fixes this. I’ll merge that and make a new release (3.7.1).
Again, I know this issue is going to affect a lot of people. There will hopefully be a fix soon. In the meantime, please 👍 the initial comment if you just want to say ‘me too’. Thanks!
Yup, I have the version number in
__about__.py, and it’s imported from there in__init__.pyand other places. That’s how I ran into the issue.This is almost certainly related to #499. Based on the logs here and in #529, I’d guess this occurs when a) it can’t get
__version__by static analysis, so it falls back to running code, and b)__init__.pycontains a relative import.It looks like this is going to hit a load of people - sorry about that. I’ll ask people now: please don’t comment just to say it affects you too (you can click the 👍 under the first comment).
I am pretty busy, so any help working out how to deal with this is welcome. Besides #499, you might want to look at commit 432dc76245d6564a150cb2e485db12f6c2a1836e where the ‘dummy’ module names were introduced, and the backwards-compatibility implementation of
load_modulein importlib which we were using before the changes in #499.