I am trying to run a script on a cluster using Microsoft HPC. As it stands I have my script (and the other necessary files) in a folder on a network drive (V:). I execute the script using a batch file which connects the computer on the cluster to /foo using the Net Use command (Net Use Z:)
When I try to execute the script I get a bunch of errors like this:
Can't load 'Z:/lib/auto/IO/IO.dll' for module IO: load_file:The specified module could not be found at C:/perl/perl/lib/XSLoader.pm line 71.
at Z:/lib/IO.pm line 11
Compilation failed in require at Z:/lib/IO/Handle.pm line 266.
BEGIN failed--compilation aborted at Z:/lib/IO/Handle.pm line 266.
Compilation failed in require at Z:/lib/IO/Seekable.pm line 101.
BEGIN failed--compilation aborted at Z:/lib/IO/Seekable.pm line 101.
Compilation failed in require at Z:/lib/IO/File.pm line 133.
BEGIN failed--compilation aborted at Z:/lib/IO/File.pm line 133.
Compilation failed in require at Z:/lib/FileHandle.pm line 9.
Compilation failed in require at Z:/lib/Spreadsheet/WriteExcel/OLEwriter.pm line 18.
BEGIN failed--compilation aborted at Z:/lib/Spreadsheet/WriteExcel/OLEwriter.pm line 18.
Compilation failed in require at Z:/lib/Spreadsheet/WriteExcel/Workbook.pm line 18.
BEGIN failed--compilation aborted at Z:/lib/Spreadsheet/WriteExcel/Workbook.pm line 18.
Compilation failed in require at Z:/lib/Spreadsheet/WriteExcel.pm line 17.
BEGIN failed--compilation aborted at Z:/lib/Spreadsheet/WriteExcel.pm line 17.
Compilation failed in require at foo.pl line 9.
BEGIN failed--compilation aborted at foo.pl line 9.
This script runs fine when I run it locally. My objective is to get it running remotely on the HPC cluster.
I have been trying to get my head around adding new and local library locations, but I find a lot of the explanations available around the web to be a little arcane for my abilities. In my head it should be sufficient to copy my existing /lib folder into my remote drive (Z:) and then use the 'use lib 'Z:\lib;' in my code, but that doesn't work. I am assuming there are aspects of how scripts interact with libraries that I don't understand currently.
Any help would be appreciated, thanks.
I'll raise it to an answer! If you're running a perl process on a remote machine then the Z: drive won't necessarily be available. You need to run net use there first, or perhaps try using a full UNC path, like
use lib '\\\\COMPUTER\root\lib';
(Yes you do need four backslashes at the start to make two! But use single-quotes or it will be worse.)
Related
Whenever I try anything I get this message:
Can't locate warnings.pm: /usr/local/lib/x86_64-linux-gnu/perl/5.30.0/warnings.pm: Permission denied at /usr/bin/psql line 19.
BEGIN failed--compilation aborted at /usr/bin/psql line 19.
The usr directory doesn't exist after installation.
I've tried removing Postgresql several times and reinstalling with the same results. I want to learn how to use it but can't get past this installation problem.
I'm running Linux Mint 20.3
I've been running a perl script from python successfully for a while. I've just moved everything to a new computer (both are running Windows 10) and I'm running into issues.
When running the script I get the error:
Can't locate DBI.pm in #INC (you may need to install the DBI module) (#INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl)
On the first line use DBI;.
I moved to using Perl (command line), selected the folder with the script and ran perl <filename> - same error.
DBI seems to be installed correctly in C:\Strawberry\perl\vendor\lib and that directory is in my #INC when I check via perl -V:
#INC:
C:/Strawberry/perl/site/lib
C:/Strawberry/perl/vendor/lib
C:/Strawberry/perl/lib
I've tried installing DBI again using cpan Module::DBI but I get the error:
Could not expand [Module::DBI]. Check the module name.
I've tried installing it with perl -MCPAN -e "install Bundle::DBI" but it fails with:
Test Summary Report
-------------------
t/original.t (Wstat: 0 Tests: 27 Failed: 1)
Failed test: 26
Files=1, Tests=27, 1 wallclock secs ( 0.05 usr + 0.01 sys = 0.06 CPU)
Result: FAIL
Failed 1/1 test programs. 1/27 subtests failed.
gmake: *** [Makefile:863: test_dynamic] Error 255
NEILB/IO-Tee-0.65.tar.gz
C:\STRAWB~1\c\bin\gmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports NEILB/IO-Tee-0.65.tar.gz
Stopping: 'install' failed for 'IO::Tee'.
I didn't have any issues when setting things up on my previous machine (both times it has just been a vanilla install with no importing of additional modules).
I've tried reinstalling Strawberry a couple of times to no avail. I've tried installing perlbrew and ActivePerl but hit issues with both of those. I've also now exhausted Google for potential solutions.
Any ideas?
Edit:
Following the advice here I have run perl -e "use DBI;" and there is no error message which apparently means DBI is installed correctly?
Edit 2
Ok so I've managed to get things working via Perl (command line) and also via Windows cmd - it took a complete reinstall of MySQL which doesn't really make any sense but anyways. However, I still can't execute the script using Git Bash. I get the same error as always...
[ Update: Bug fixed in IO-Tee 0.66. ]
The failing test assumes that sysread obeys the :crlf layer that's added to file handles in Windows. But it doesn't. This is a bad test, not a problem with the module. As such, since that's the only failing test, you can safely force the installation of the module using the following:
cpan -f IO::Tee
Forcing the installation of a module with failing tests is normally a bad idea because it means you're forcing the installation of a module that's likely broken. But it's ok here because it has been established that the problem is with the test, not the module itself.
I have filed a bug report with a more thorough explanation of the problem and a solution.
How to run perl script on Ubuntu?
How to run this script
https://zwitterion.org/software/aggregate-cidr-addresses/
I’ve created the file aggregate-cidr-addresses as shown in the example.
I’ve copied the file from the server in the same directory
then I run as shown in the example
root#Ubuntu:~$ list-iana-reserved-ranges | aggregate-cidr-addresses
list-iana-reserved-ranges: ukaz ni bil najden (translate command not found)
aggregate-cidr-addresses: ukaz ni bil najden (translate command not found)
and also
root#Ubuntu:~$ perl list-iana-reserved-ranges | aggregate-cidr-addresses
Number found where operator expected at list-iana-reserved-ranges line 2, near "192.168.1.0"
(Missing semicolon on previous line?)
syntax error at list-iana-reserved-ranges line 2, near "192.168.1.0"
Execution of list-iana-reserved-ranges aborted due to compilation errors.
aggregate-cidr-addresses: ukaz ni bil najden (translate command not found)
I've got
command not found
How to run this properly?
To run a Perl script,
put the interpreter in the first line of the files with a "shabang" or "hash bang" (#!), which the script you linked to already has:
#!/usr/bin/perl
make the files executable:
chmod +x list-iana-reserved-ranges aggregate-cidr-addresses
add ./ to the beginning of the filenames (this is a Linux security feature to not accidentally run scripts in your current directory):
./list-iana-reserved-ranges | ./aggregate-cidr-addresses
I have an issue with a Perl script and the CPAN Twitter module.
I have a script that runs speedtest, and am trying to post the result to Twitter.
I have managed to get my script running manually by running ./speedtest.pl from my user account, however when I try and run it using crontab I get an error.
I have installed Net::Twitter, File::HomeDir and Config::Tiny using
cpanm Net::Twitter
etc.
(Note: no sudo) I get the following error when I run my script from my local crontab:-
Can't locate Net/Twitter.pm in #INC (you may need to install the
Net::Twitter module) (#INC contains: /etc/perl /usr/local/lib/arm-linux-
gnueabihf/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/arm-linux-
gnueabihf/perl5/5.20 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf
/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /home/pi
/speedtest.pl line 99.
BEGIN failed--compilation aborted at /home/pi/speedtest.pl line 99.
Can someone please point me in the right direction? I suspect it has something to do with where Net::Twitter etc ended up but I've no idea how to fix it so that crontab knows where to find it.
speedtest.pl is here
The Perl installation that you run from the command line is different from the one run by the system when a crontab job executes
Try which perl, and then look at the output of the same command run under cron
There are a few ways to fix this, depending on the configuration of your system. The most obvious is to use the full path to your own copy of perl, but while that will probably get things going it is probably a bad idea
I think you may have installed Net::Twitter using your local account.
Logging into root & installing the module should fix this problem.
I am using Perl in Eclipse.
In the same directory, I have a .pl file and two .pm files (pmFile1.pm, pmFile2.pm).
At the top of the .pl file, I use the command:
use pmFile1;
use pmFile2;
I get an error
Compilation failed in require
I do not believe I had this error earlier. I have researched this error online, and cannot figure out what may have caused it, because I have not found a similar situation to mine that caused the error. I do not know what other information would be pertinent to include, but will add anything if asked...
Thank you.
I suggest you check the module pmFile1.pm for errors in a terminal shell
$ perl -c pmFile1.pm
syntax error at pmFile1.pm line 1, near "."
pmFile1.pm had compilation errors.
When entering a single dot . as a syntax error into pmFile1.pm and running the p.pl file then the errors below are shown in Eclipse, the same as you described. If you run the .pl file in a terminal shell then you get the same compilation failed in require as in eclipse:
$ perl p.pl
syntax error at pmFile1.pm line 1, near "."
Compilation failed in require at p.pl line 1.
BEGIN failed--compilation aborted at p.pl line 1.
This may not be your problem, but I've been "bitten" by something similar before: check the End of Line chars in the file. It may be that your code is seen by the compiler to be all one line, making an error anywhere in the code appear as being on line 1 when visually (in the editor) the offending line would be later in the code. In notepad++ you resolve this sort of issue by using the Edit > EOL Conversion > Windows Format (or whatever format is correct for you) menu option, though other editors will likely have a similar feature for *NIX <-> Windows EOL conversions. This error would make sense if you can successfully use the module files giving you an error without errors in other script files.
I solved this by changing the required package to some dummy name, then retaining it.