You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problems described in the following only occur when using Python 3.8.5 in conjunction with the markdown module. I can package the software with Python 3.7 so this issue is no direct problem for me, I just wanted to report it.
My new release makes use of the markdown module. When run directly, it works without problem. When bundled, the application terminates immediately when it tries to import the markdown module for the first time with the message
File "markdown\htmlparser.py", line 30, in <module>
File "<frozen importlib._bootstrap>", line 553, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Full stack trace see below,
The markdown hook 'hook-markdown.py' is loaded automatically, the only warning that is directly related to the markdown module is
missing module named htmlentitydefs - imported by markdown.inlinepatterns (optional)
I get the same warning when running Python 3.7.4 (where the bundled executable works), in addition, here I get
missing module named importlib.metadata - imported by importlib (conditional), pluggy.manager (conditional), _pytest.compat (conditional), markdown.util (optional)
When I remove the markdown import (and all instantiations), the bundled application runs without problems under Python 3.8.5 as well. I use pyinstaller with pyinstaller pyfdax.spec, the spec-file can be seen at https://github.com/chipmuenk/pyfda/blob/develop/pyfdax.spec
Run your frozen program from a command window (shell) — instead of double-clicking on it
Package your program in --onedir mode
Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.
A minimal example program which shows the error
(paste text here)
“Minimal“ means: remove everything from your code which is not relevant for this bug,
esp. don't use external programs, remote requests, etc.
A very good example is https://gist.github.com/ronen/024cdae9ff2d50488438. This one helped
us reproducing and fixing a quite complex problem within approx 1 hour.
Stacktrace / full error message
The actual error occurs in line 22 in "pyfda\libs\pyfda_lib.py" which just contains import markdown
Traceback (most recent call last):
File "pyfda\pyfdax.py", line 32, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\chris\anaconda3\envs\mpl_33_fresh\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pyfda\libs\pyfda_lib.py", line 22, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\chris\anaconda3\envs\mpl_33_fresh\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "markdown\__init__.py", line 29, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\chris\anaconda3\envs\mpl_33_fresh\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "markdown\core.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\chris\anaconda3\envs\mpl_33_fresh\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "markdown\preprocessors.py", line 29, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\chris\anaconda3\envs\mpl_33_fresh\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "markdown\htmlparser.py", line 30, in <module>
File "<frozen importlib._bootstrap>", line 553, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
[9316] Failed to execute script pyfdax
This looks like the issue that should be fixed by pyinstaller/pyinstaller-hooks-contrib#56. Until new version of pyinstaller-hooks-contrib is tagged, you will need to update pyinstaller-hooks-contrib manually: pip install https://github.com/pyinstaller/pyinstaller-hooks-contrib/archive/master.zip
(Or, you can try adding html.parser to hidden imports).
You're right, this has nothing to do with the python version, I have markdown 3.2 installed on the environments where the bundle runs correctly. Adding
hiddenimports += ['html.parser'] # needed for markdown 3.3 compatibility
Description of the issue
I've used pyInstaller successfully to package my software https://github.com/chipmuenk/pyfda in the past (thanx!)
The problems described in the following only occur when using Python 3.8.5 in conjunction with the markdown module. I can package the software with Python 3.7 so this issue is no direct problem for me, I just wanted to report it.
My new release makes use of the markdown module. When run directly, it works without problem. When bundled, the application terminates immediately when it tries to import the markdown module for the first time with the message
Full stack trace see below,
The markdown hook 'hook-markdown.py' is loaded automatically, the only warning that is directly related to the markdown module is
I get the same warning when running Python 3.7.4 (where the bundled executable works), in addition, here I get
missing module named importlib.metadata - imported by importlib (conditional), pluggy.manager (conditional), _pytest.compat (conditional), markdown.util (optional)
When I remove the markdown import (and all instantiations), the bundled application runs without problems under Python 3.8.5 as well. I use pyinstaller with
pyinstaller pyfdax.spec
, the spec-file can be seen at https://github.com/chipmuenk/pyfda/blob/develop/pyfdax.specThe versions of some other packages modules are:
numpy 1.19.1
scipy 1.5.2
numexpr 2.7.1
matplotlib 3.2.2
Qt5 5.9.7
PyQt 5.9.2
Markdown 3.3.1
docutils 0.16
migen
mplcursors 0.3
Context information (for bug reports)
pyinstaller --version
:4.0
or4.1dev0
Yes, running the same script with Python 3.7.4 under Windows 10 or Ubuntu 20.04 works flawlessly.
yes, made no difference
(https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
Make sure everything is packaged correctly
--noupx
or setupx=False
in your .spec-file--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.A minimal example program which shows the error
Stacktrace / full error message
The actual error occurs in line 22 in "pyfda\libs\pyfda_lib.py" which just contains
import markdown
Please also see https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs
for more about what would use to solve the issue.
The text was updated successfully, but these errors were encountered: