Skip to content

_pyrepl/pydoc import error in build #236

Description

@Alex25820

When creating a Windows build using Flet 0.86.1 (Python 3.14) I get the following error:

ModuleNotFoundError: No module named '_pyrepl'

This seems to be caused by importing pydoc. My hypothesis is that serious python doesn't include the private Python module _pyrepl in its Python 3.14 version.


I discovered this bug when updating from Flet 0.84.0 to 0.86.1. It was triggered by importing NLTK which is a dependency of my Flet app.

Initial log
Traceback (most recent call last):
  File "<sp_script>", line 242, in <module>
  File "<sp_script>", line 208, in _sp_run_module_as_main
  File "C:\Users\alex\AppData\Local\Temp\serious_python_temp563367bc\main.py", line 5, in <module>
  File "C:\Users\alex\AppData\Local\Temp\serious_python_temp563367bc\gui\gui.py", line 11, in <module>
  File "C:\Users\alex\AppData\Local\Temp\serious_python_temp563367bc\gui\views\gui_view_startup.py", line 17, in <module>
  File "C:\Users\alex\AppData\Local\Temp\serious_python_temp563367bc\textProcessor.py", line 3, in <module>
  File "C:\Users\alex\PythonProjects\Project\build\site-packages\nltk\__init__.py", line 133, in <module>
  File "C:\Users\alex\PythonProjects\Project\build\site-packages\nltk\collocations.py", line 36, in <module>
  File "C:\Users\alex\PythonProjects\Project\build\site-packages\nltk\metrics\__init__.py", line 38, in <module>
  File "C:\Users\alex\PythonProjects\Project\build\site-packages\nltk\metrics\scores.py", line 19, in <module>
  File "C:\Users\alex\PythonProjects\Project\build\site-packages\nltk\util.py", line 11, in <module>
  File "D:\a\python-build\python-build\windows\python-windows-for-dart-3.14.6\Lib\pydoc.py", line 81, in <module>
ModuleNotFoundError: No module named '_pyrepl'

Minimal steps to reproduce the error:

  1. Create a new Flet project with Flet version 0.86.1 using flet create.
  2. Paste the following in to main.py:
import pydoc
import flet as ft

def main(page: ft.Page):
    print(pydoc.describe(page))

if __name__ == "__main__":
    ft.run(main)
  1. Run flet build windows.
  2. Run the build exe, the following error will be displayed when the app starts:
Traceback (most recent call last):
  File "<sp_script>", line 242, in <module>
  File "<sp_script>", line 208, in _sp_run_module_as_main
  File "C:\Users\alex\AppData\Local\Temp\serious_python_tempe6014a50\main.py", line 1, in <module>
  File "D:\a\python-build\python-build\windows\python-windows-for-dart-3.14.6\Lib\pydoc.py", line 81, in <module>
ModuleNotFoundError: No module named '_pyrepl'

I have only tested this on Windows.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions