jonp has asked for the wisdom of the Perl Monks concerning the following question:

Hello
I work with an apple cluster and I am using some bioperl libraries in a perl script that I wrote. My script runs fine when it is run on the "head node" of the cluster. If the script is run on one of the other nodes on the cluster I get this error:

Can't locate Bio/Tools/pICalculator.pm in @INC (@INC contains: ......

My code looks like this:
#!/usr/local/bin/perl use strict; use lib "System/common/Bio/Tools"; use Bio::Tools::pICalculator; use Bio::Seq;
Could someone help me figure out how to get the script to work on the other nodes? Thanks in advance.
jonp

Replies are listed 'Best First'.
Re: accessing perl libraries
by polettix (Vicar) on Jul 14, 2005 at 17:00 UTC
    The line:
    use Bio::Tools::pICalculator;
    asks perl to load Bio/Tools/pICalculator.pm, which is "missing" in your setup. You should probably correct the previous line:
    use lib "System/common"; # wiped "/Bio/Tools" away
    to show perl where the library is (note that the "Bio/Tools" part is handled directly by perl).

    Update: definitively ++Tanktalus for the note about relative paths in use lib.

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
Re: accessing perl libraries
by suaveant (Parson) on Jul 14, 2005 at 16:53 UTC
    1) is the library ON the other nodes.
    2) if it is.. is the directory structure the same... maybe the relative path is screwing you up

    I mean.. the error is pretty self explanatory... perl can't find the library in your @INC...

    Also... you do use lib "System/common/Bio/Tools"; then use Bio::Tools::pICalculator;
    it looks like you might actually want use lib "System/common/"; since Bio::Tools is part of your module path.

                    - Ant
                    - Some of my best work - (1 2 3)

Re: accessing perl libraries
by Tanktalus (Canon) on Jul 14, 2005 at 16:56 UTC

    First, the list of what @INC contains would be useful.

    Second, your use lib line uses a directory that is relative to the current working directory. I highly recommend switching that to something with an absolute path, even if that absolute path is dynamic. For example, if you want relative to the script, you can use:

    use FindBin; use File::Spec; use lib File::Spec->catdir($FindBin::Bin, qw(System common Bio Tools)) +; # or ... use lib File::Spec->catdir($FindBin::Bin, qw(System common));
    or something like that.

    I would look to ensure that Bio::Tools::pICalculator is not only in that directory as perceived by the other nodes in the cluster, but is also readable by that user on all nodes. Note that if you're running as root, and using NFS to mount a common directory, it often gets clobbered to become an unprivileged user for permission purposes - so make sure the files are readable by all.

    Update: added another use lib option based on suaveant's excellent observation.

Re: accessing perl libraries
by anonymized user 468275 (Curate) on Jul 15, 2005 at 11:18 UTC
    I have never worked with apple cluster, but a little googling tells me that cluster-wide devices would have to have been mounted with NFS. Any software you expect to function cluster-wide should be located on such devices.

    Having said that, the path will of course be different on the node where the device is mounted locally than the rest.

    Having modified the path in the program to agree with the NFS path for the device, what you are calling the 'head node' will then become the exception that needs hooking up again. One way to approach that would be to create a symbolic link on the 'head node' to mimic an NFS mount.

    One world, one people