-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importing tifffile causes RecursionError #2911
Comments
Same problem here. Gets stuck in an infinite recursive loop involving is_swig_candidate() and _safe_import_hook() being called over and over again on _tifffile in my case, this is using scikit-image which includes tifffile. This only occurs on scikit-image 0.13. Downgrading to 0.12.3 solves the problem Linking to what @radjkarl mentioned as workaround, the import at 0.12.3 is:
while in 0.13 is:
|
I believe the pain point is here: pyinstaller/PyInstaller/lib/modulegraph/modulegraph.py Lines 2277 to 2288 in 133d181
when tries to import _tifffile as a SWIG module and fails, ceates a MissingModule. then at pyinstaller/PyInstaller/lib/modulegraph/modulegraph.py Lines 2298 to 2315 in 133d181
It checks if it is a potential SWIG module and if it is a MissingModule and calls _safe_hook_import again, going through the same process over and over again |
Thanks for you analysis. To verify this, please revert commit 711e9e7 (which is the one introducing this behaviour). |
I have the following problems.
Is there a solution? The development environment is as follows. |
See #2911 (comment). I still did not get an answer. |
@radjkarl @dlejarazu I'm still waiting for an answer. Please revert commit 711e9e7 and report back whether this solves the issue. Otherwise I'm going to close the issue. |
@htgoebel sorry . dont have time for checking our the code reverting etc. |
@radjkarl :-(( This is a workaround and not a solution. Reverting the commit and testing is a matter of a few minutes and wold help narrowing the issue and fixing the bug. Anyway I need more information:
@dlejarazu @yspark61 This question also go to you. If you want this bug fixed, I need the questions answered. |
@htgoebel FYI I was able to reproduce this on OSX 10.12 with Anaconda Python 3.6 environment with pyinstaller installed from an older github commit. The .so does exist Also if I had to guess the issue with my PR (referenced above) is due to a change in SWIG and the import |
@htgoebel I see two problems here that I'd like your opinion on:
I have to look at it further, but it seems like when
Then run:
Running |
Actually, nevermind. This would work with |
sorry for the delay. The latest develop doesn't show this problem. I guess that is @davidh-ssec fix. Thanks |
@dlejarazu Really? My PR hasn't been merged yet so this should still be a problem. Make sure you delete your build and dist directories before trying it. |
@dlejarazu Thanks. A solution is in the works. |
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
This should be solved now. Please try the current development version. If the problem still persists, please drop a note and reopen the ticket. Thanks. |
Fixes pyinstaller#2911, fixes pyinstaller#3040. Co-Authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
minimalTest.py
from tifffile import TiffFile
Make exe:
pyinstaller minimalTest.py
Workaround
In tifffile.py:
Replace
with
from . import _tifffile
Error message:
231 INFO: PyInstaller: 3.4.dev0+133d18156
231 INFO: Python: 3.6.1
232 INFO: Platform: Windows-10-10.0.10240-SP0
237 INFO: wrote D:\Programming\eclipse_workspace\scripts\AAA\test.spec
10504 INFO: UPX is not available.
10508 INFO: Extending PYTHONPATH with paths
['D:\Programming\eclipse_workspace\scripts',
'D:\Programming\eclipse_workspace\scripts\AAA']
10508 INFO: checking Analysis
10508 INFO: Building Analysis because out00-Analysis.toc is non existent
10508 INFO: Initializing module dependency graph...
10514 INFO: Initializing module graph hooks...
10521 INFO: Analyzing base_library.zip ...
21421 INFO: running Analysis out00-Analysis.toc
21426 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\ProgramData\Anaconda3\python.exe
22475 INFO: Caching module hooks...
22482 INFO: Analyzing D:\Programming\eclipse_workspace\scripts\AAA\test.py
27173 INFO: Processing pre-find module path hook distutils
33490 INFO: Processing pre-find module path hook site
33493 INFO: site: retargeting to fake-dir 'C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\fake-modules'
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\pyinstaller-script.py", line 11, in
load_entry_point('PyInstaller==3.4.dev0+133d18156', 'console_scripts', 'pyinstaller')()
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller_main_.py", line 92, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller_main_.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
File "", line 16, in
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 213, in init
self.postinit()
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in postinit
self.assemble()
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 415, in assemble
priority_scripts.append(self.graph.run_script(script))
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 201, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1343, in run_script
self._scan_code(m, co, co_ast)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2528, in _scan_code
self._process_imports(module)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2727, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2202, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1416, in import_hook
source_package, target_module_partname, level)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1568, in _find_head_package
target_module_headname, target_package_name, source_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1985, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2023, in _load_module
m = self._load_package(fqname, pathname, packagepath)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2797, in _load_package
self._load_module(fqname, fp, buf, stuff)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2077, in _load_module
self._scan_code(m, co, co_ast)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2528, in _scan_code
self._process_imports(module)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2727, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2202, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1416, in import_hook
source_package, target_module_partname, level)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1568, in _find_head_package
target_module_headname, target_package_name, source_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1985, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2077, in _load_module
self._scan_code(m, co, co_ast)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2528, in _scan_code
self._process_imports(module)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2727, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2312, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2312, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2312, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
[Previous line repeated 943 more times]
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2202, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1416, in import_hook
source_package, target_module_partname, level)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1568, in _find_head_package
target_module_headname, target_package_name, source_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1979, in _safe_import_module
module_partname, search_dirs, parent_module)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2853, in _find_module
return self._find_module_path(fullname, name, path)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 315, in _find_module_path
fullname, module_name, search_dirs)
File "C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2934, in _find_module_path
module_name)
File "", line 1223, in find_loader
File "", line 1268, in find_spec
File "", line 60, in _path_join
RecursionError: maximum recursion depth exceeded
The text was updated successfully, but these errors were encountered: