Hi Chris, all,

I have just come across the same problem, and I could work around it by 
increasing the the recursion limit.
However, I think this problem warrants a closer look (and certainly some 
thought into how to debug it) because
in my particular case, it is *really* weird. Let me explain:

Say I have a script myscript.py which I want to turn into a standalone. The 
latter script imports a module, yt (see yt-project.org)
as usual:

import yt.

I run PyInstaller on myscript.py and everything is fine. Now, I have 
another custom module, mymodule.py, which imports
yt as above. Now myscript.py *only* imports mymodule.py as usual:

import mymodule

I emphasise that the line above is the sole content of myscript.py, and the 
content of mymodule.py is just 'import yt'!

When I run PyInstaller on my myscript.py, I get the recursion error; more 
specifically [abridged]:

...
9872 INFO: Processing pre-safe import module hook six.moves from 
'/Users/tepper/Library/Python/3.7/lib/python/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.

=============================================================
A RecursionError (maximum recursion depth exceeded) occurred.
For working around please follow these instructions
=============================================================

How can that be??? Why importing the module yt directly works and doing it 
through an intermediary script fails?
It is worth stressing that so far, I have had this issue ONLY with yt, no 
other module, so it must be particular to the
yt library. However, I'd expect that a simple import like in the first case 
I described should fail as well.

Anyone has an idea why this happens and how to solve it?

Thor.

PS: My system's info:

39 INFO: PyInstaller: 4.2

39 INFO: Python: 3.7.9

45 INFO: Platform: Darwin-19.6.0-x86_64-i386-64bit
(macOS Catalina)


On Sunday, February 2, 2020 at 3:49:59 AM UTC+11 Chris Barker wrote:

> To pick up on my own note:
>
> Turns out I had an unneeded dependency on numpy and scipy. I wanted to 
> remove that anyway, 'cause those are huge, and when I did, this 
> recursion issue went away.
>
> But I do sometimes need scipy -- so it would good it could work.
>
> I suspect that PyInstaller could be a little smarter about not getting 
> caught in deep recursions ...
>
> -CHB
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Jan 28, 2020 at 9:05 AM Chris Barker <[email protected]> wrote:
>
>> When running pyinstaller, it churns away for a long time, and results in 
>> an recursion limit exceeded error.
>>
>> I even cranked up the recursion limit in the spec file (as suggested 
>> elsewhere in this list) and it took longer, but same error.
>>
>> I am highly suspicious that this is an infinite recursion.
>>
>> I've boiled it down to one module -- if I don't import that, it all works 
>> fine (except for not getting that critical functionality :-( ).
>>
>> But I can't see anything wrong with that module -- no circular imports, 
>> for instance.
>>
>> How can I debug this? I'd like to see where it's getting caught in that 
>> deep if not infinite recursion. 
>>
>> Alternatively, can I tell pyinstaller to include a module but not scan it 
>> for imports?
>>
>> Thanks,
>>
>> -CHB
>>
>>
>> -- 
>>
>> Christopher Barker, Ph.D.
>> Oceanographer
>>
>> Emergency Response Division
>> NOAA/NOS/OR&R            (206) 526-6959   voice
>> 7600 Sand Point Way NE   (206) 526-6329   fax
>> Seattle, WA  98115       (206) 526-6317   main reception
>>
>> [email protected]
>>
>
>
> -- 
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> [email protected]
>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/e494b19b-94fe-4ce0-83f2-55e3c9a34536n%40googlegroups.com.

Reply via email to