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
Related
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 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.)
Attempting to install the Perl module DBD::mysql on Windows 7
From the Windows command line I executed
perl -MCPAN -e 'install DBD::mysql'
Which downloaded and uncompressed the file -- then gave me this ERROR:
CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.018.tar.gz
Set up gcc environment - 3.4.5 (mingw-vista special r3)
C:\PROGRA~1\MySQL\MYSQLS~1.1\bin\MYSQLA~1.EXE: connect to server at 'localhost'
failed
error: 'Access denied for user 'ODBC'#'localhost' (using password: NO)'
Problem running C:\PROGRA~1\MySQL\MYSQLS~1.1\bin\MYSQLA~1.EXE - aborting ...
Warning: No success on command[C:\Perl\bin\perl.exe Makefile.PL INSTALLDIRS=site
]
Guessing the issue is that MySQL's root user has a password, but what's not clear is how I resolve the issue.
Questions, feedback, requests -- just comment, thanks!!
----------
UPDATE (1): RE: force install DBD::mysql
cpan> force install DBD::mysql
Running install for module 'DBD::mysql'
Running make for C/CA/CAPTTOFU/DBD-mysql-4.018.tar.gz
Has already been unwrapped into directory C:\Perl\cpan\build\DBD-mysql-4.018-A
1T8Uh
'C:\Perl\bin\perl.exe Makefile.PL INSTALLDIRS=site' returned status 256, won't
make
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
On other platforms, the build process runs the mysql_config command to get necessary information about the mysql installation without need of a user and password; on win32, if you have a mysql_config command, you have to explicitly tell Makefile.PL about it with a --mysql_config yourpathname parameter. If you don't, it looks for the mysqladmin program and uses its location to determine as much as it can but runs mysqladmin version to get the mysql version. You can provide a user/password for it to be able to do this using --testuser and --testpassword parameters to Makefile.PL.
Following up on "Robert P" comment, I checked the install guide for installing DBD::MySQL in ActivePerl on Win32; on 64, but doesn't appear to have mattered.
Command that did the job was:
ppm install DBD::mysql
The only way I've got round this in the past is a forced install. It always feels like a bodge but I haven't been able to find a better way.
Open up a CPAN shell:
perl -MCPAN -e 'shell'
Then do a force install
force install DBD::mysql
quit gets you back out of the shell.
as ysth said , maybe try this :
cd C:\Perl\cpan\build\DBD-mysql-4.018-A
and run
perl Makefile.PL --testuser validuser --testpassword validpassword
and then try to make - make test - make install,
or its equivalents on windows