[GNC] GnuCash 5.5 (macOS) can't get quotes, because it doesn't see JSON::Parse

Jim DeLaHunt list+gnucash at jdlh.com
Sat Dec 23 22:19:08 EST 2023


On 2023-12-23 15:38, John Ralls wrote:
>
>> On Dec 23, 2023, at 12:29 PM, Jim DeLaHunt <list+gnucash at jdlh.com> wrote:
>>
>> Hi, folks:
>>
>> I recently upgraded to GnuCash 5.5-1 on macOS, ...retrieving quotes via AlphaVantage for ... stopped working.
>> ...
>> But the gnucash-fq-update utility thinks everything is fine:
>>
>> % PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' sudo /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
>> Password:
>>
>> Starting with /...[elided].../ this dialog will disappear.
>> Reading '/Users/jdlh/.cpan/Metadata'
>>    Database was generated on Fri, 22 Dec 2023 23:54:07 GMT
>> Test2 is up to date (1.302198).
>> Finance::Quote is up to date (1.58).
>> JSON::Parse is up to date (0.62).
>>
>> And CPAN seems to think that JSON::Parse is present:
>>
>> % PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' sudo cpan
>> Password:
>> Loading internal logger. Log::Log4perl recommended for better logging
>>
>> Starting with /...[elided].../ this dialog will disappear.
>> Terminal does not support /...[elided]...
>> /cpan shell -- CPAN exploration and modules installation (v2.36)
>> Enter 'h' for help.
>>
>> cpan[1]> m JSON::Parse
>> Reading '/Users/jdlh/.cpan/Metadata'
>>    Database was generated on Fri, 22 Dec 2023 23:54:07 GMT
>> Module id = JSON::Parse
>>      CPAN_USERID  BKB (Ben Bullock <bkb at cpan.org>)
>>      CPAN_VERSION 0.62
>>      CPAN_FILE    B/BK/BKB/JSON-Parse-0.62.tar.gz
>>      UPLOAD_DATE  2022-07-15
>>      MANPAGE      JSON::Parse - Parse JSON
>>      INST_FILE /Library/Perl/5.30/darwin-thread-multi-2level/JSON/Parse.pm
>>      INST_VERSION 0.62
>>
>>
>> cpan[2]> install JSON::Parse
>> JSON::Parse is up to date (0.62).
>>
>> ...For what it's worth, MacPorts has perl 5.34.3 installed, and the perl 5.34 edition of JSON::Parse as well. The system has perl 5.30.3 installed. I do not know if this difference is significant.
>>
>> ...Thank you in advance for your help. And many thanks to the GnuCash developers for all the improvements in the 5.x versions!
> Jim,
>
> It matters which perl is invoked, because each "minor" perl version (minor in quotes because just like GnuCash before we truncated the version to two digits, perl's "major" version has been fixed since the turn of the century) gets it's own versioned directories of modules.
>
> It might also matter that one of the Perls is MacPorts because MacPorts might install its perl modules in the MacPorts installation tree.
>
> You can use
>    perl -e 'print join("\n", @INC), "\n"`
> (include the quotes) in each environment to see where that perl is looking for modules.
>
> The value of $PATH is different when running from the command line in Terminal and when launching an app with LaunchServices, either by using the `open` command from a command line prompt or double-clicking the app's icon in Finder. ...

I believe that by specifying the path before each of my invocations, I 
was steering the GnuCash app to the system Perl, 5.30, rather than the 
MacPorts Perl, 5.34.

% PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' /usr/bin/perl -e 
'print join("\n", @INC), "\n"'
/Library/Perl/5.30/darwin-thread-multi-2level
/Library/Perl/5.30
/Network/Library/Perl/5.30/darwin-thread-multi-2level
/Network/Library/Perl/5.30
/Library/Perl/Updates/5.30.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.30.3
/System/Library/Perl/5.30/darwin-thread-multi-2level
/System/Library/Perl/5.30
/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.30
%


> ...You can force using that system perl on the command line by using the path instead of just `perl`, e.g.
>    sudo /usr/bin/perl /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
>
> will force using the system perl and its builtin @INC as long as $PERL5LIB isn't set in the environment.
>
> Note that if your mac is an Apple Silicon one that you need to specify arch x86_64, as in
>    sudo arch -arch x86_64 /usr/bin/perl /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
>
> (all on one line) because otherwise perl will build and install F::Q and friends for Apple Silicon....

My computer does indeed use Apple Silicon. Specifying the path to perl 
had no effect:

% sudo arch -arch x86_64 /usr/bin/perl 
/Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

Starting with /...[elided].../ this dialog will disappear.
Reading '/Users/jdlh/.cpan/Metadata'
   Database was generated on Fri, 22 Dec 2023 23:54:07 GMT
Test2 is up to date (1.302198).
Finance::Quote is up to date (1.58).
JSON::Parse is up to date (0.62).
%

Maybe my installation somehow installed JSON::Parse for Apple Silicon, 
and that is why the GnuCash application cannot find it.

I would try to uninstall JSON::Parse and Finance::Quote, and let cpan or 
gnc-fq-update reinstall them, but a brief web search seems to say that 
CPAN has no command to uninstall modules.

I do think I have found where the actual files might be:

% ls -ld 
/Library/Perl/5.30/{,darwin-thread-multi-2level/auto/}{JSON/Parse,Finance/Quote}
ls: /Library/Perl/5.30/JSON/Parse: No such file or directory
drwxr-xr-x  59 root  wheel  1888 21 Dec 00:32 
/Library/Perl/5.30/Finance/Quote
drwxr-xr-x   3 root  wheel    96 10 May  2022 
/Library/Perl/5.30/darwin-thread-multi-2level/auto/Finance/Quote
drwxr-xr-x   4 root  wheel   128 21 Dec 00:32 
/Library/Perl/5.30/darwin-thread-multi-2level/auto/JSON/Parse

Is it significant that Finance::Quote has an entry in 
/Library/Perl/5.30/, but JSON::Parse does not?

Thank you for your help, John.
      —Jim DeLaHunt




More information about the gnucash-user mailing list