I need to be able to run the command latexindent but I get this error every time:
Unknown PerlIO layer 'encoding' at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 21.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 126.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 134.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 135.
Attempt to reload PerlIO/encoding.pm aborted.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
Compilation failed in require at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.
I installed MacTeX with Homebrew through this command brew install --cask mactex. When I type the command which latexindent it gives this /usr/local/texlive/2021/bin/universal-darwin/latexindent. I have Perl v5.34.0 and it is here /opt/homebrew/bin/perl.
How do I set the encoding for PerlIO?
I solved by installing latexindent via homebrew.
The command is brew install latexindent.
I'm on MacOS Monterey 12.4
Based on this question, I found a solution to my problem like this :
I deleted : ~/perl5, ~/.cpan, ~/.cpanm;
I restarted my computer;
Then I installed Log::Log4perl with the command cpan install Log::Log4perl. There it asked me if I wanted to choose automatic or
manual configuration mode. I chose the automatic mode;
Then I installed other modules based on this
post:
SQL::Statement, Text::CSV_XS,DBD::CSV, Log::Dispatch::File, cpan install YAML::Tiny, File::HomeDir, Unicode::GCString, Mac::SystemDirectory;
And finally the command latexindent --version gives me the version 3.9.1, 2021-03-21 and it works.
I am unable to build Net::MAC::Vendor on a Mac w/ High Sierra. I am relatively new to Perl but have built modules in the past. The error appears to be:
Failed fetching [https://services13.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MA-L&format=html&text=14-10-9F] HTTP status []
message [IO::Socket::SSL 2.009+ required for TLS support] at t/fetch_oui_from_custom.t line 21.
Could not fetch data from the IEEE! at t/fetch_oui_from_custom.t line 21.
# Failed test ''Got back array reference' isa 'ARRAY''
# at t/fetch_oui_from_custom.t line 23.
# 'Got back array reference' isn't defined
# Failed test 'Fetched Apple's OUI entry'
# at t/fetch_oui_from_custom.t line 25.
# ''
# doesn't match '(?^:Apple, Inc\.)'
# Looks like you failed 2 tests of 2.
t/fetch_oui_from_custom.t .. 2/?
# Failed test 'fetch'
# at t/fetch_oui_from_custom.t line 27.
Use of uninitialized value in concatenation (.) or string at /Users/johnprokopek/.cpan/build/Net-MAC-Vendor-1.265-13/blib/lib/Net/MAC/Vendor.pm line 320.
Failed fetching [http://standards.ieee.org/cgi-bin/ouisearch?14-10-9F] HTTP status []
Can someone help, thanks
I'm also still on High Sierra (10.13.6), on an ancient-but-still-running Mac Mini mid-2010. Using the built-in /usr/bin/perl (v5.18.2), running install Net::MAC::Vendor inside the CPAN shell gave me the same error. Running force install Net::MAC::Vendor worked, in that the module was installed.
A simple perl -MNet::MAC::Vendor -e "print 'hi'" works, so it looks like Perl can at least load that library, not really sure how to test that it works for real. But, at least this will let you install it and try it.
I am having some issues installing Bio-DB-HTS (https://github.com/Ensembl/Bio-DB-HTS) requried to run a perl script from a cloned git repository.
System & Perl information
I am on Mac OSx High Sierra v.10.13.6 and using perl 5, version 18, subversion 2 (v5.18.2). I have added this information in my original question now.
Background information
When trying to perform a local installation, according to README instructions, i receive the error...
git clone https://github.com/Ensembl/Bio-DB-HTS.git
cd Bio-DB-HTS-2.10
perl INSTALL.pl
lzma.h library header not found in /usr/include
I tried to install the LZMA library but found that it actually was installed and that the lzma.h header file was simply missing from the path /usr/include. As LZMA is deprecated and replaced with XZ I installed the XZ library
brew install xz
After a quick search i found the lzma.h header in...
/usr/local/Cellar/xz/5.2.4/include/lzma.h
Main Issue
Now this is where I am not sure of how to proceed and if I have messed up something while trying to get around this. Since /usr/include has a directory with restricted access I added a line in the INSTALL.pl script to check existence for the file in both locations (which could probably disrupt something downstream in the analysis as I didn't change anything else except the if condition. However, when running the install this time i ran into a new problem.
perl INSTALL.pl
BioPerl does not seem to be installed. Please install it and try again.
On Debian/Ubuntu systems you can do this with the command:
apt-get install bioperl
On other systems use the CPAN shell:
perl -MCPAN -e 'install Bio::Perl'
And this is where my main issues reside. When trying to install Bio:Perl using cpan tests fail at various stage and I'm not sure which ones are the essential ones. The last lines from the output are
Result: FAIL
Failed 3/325 test programs. 16/19945 subtests failed.
CJFIELDS/BioPerl-1.007002.tar.gz
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module,
try:
reports CJFIELDS/BioPerl-1.007002.tar.gz
Running Build install
make test had returned bad status, won't install without force
I reconfigured cpan to install dependancies automatically as mentioned here How do I tell CPAN to install all dependencies?.
perl -MCPAN -Mlocal::lib=~/perl5 -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'
And tried installing again forcing installation...
perl -f -MCPAN -e 'install Bio::Perl'
But I just get the same error
Result: FAIL
Failed 3/325 test programs. 16/19945 subtests failed.
CJFIELDS/BioPerl-1.007002.tar.gz
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module,
try:
reports CJFIELDS/BioPerl-1.007002.tar.gz
Running Build install
make test had returned bad status, won't install without force
When I look at what modules have been installed using...
cpan -l
Bio::DB::HTS 2.11
Bio::DB::HTS::ReadIterator 2.11
Bio::DB::HTS::VCF 2.11
Bio::DB::HTS::Faidx 2.11
Bio::DB::HTS::PileupWrapper 2.11
Bio::DB::HTS::Alignment 2.11
Bio::DB::HTS::ConfigData undef
.
.
.
Bio::DB::HTS::VCF::Iterator 2.11
Bio::DB::HTS::VCF::Row 2.11
I can see that many of the ones I need from the Bio-DB-HTS package are there (assuming that they were one of the succesful installations when isntalling Bio::Perl) but now it prompts the error
Can't locate Bio/SeqFeature/Lite.pm in #INC
However, I never manage to actually get Bio:Seq nor Bio::Perl installed. I do have some perl knowledge but mostly work on python so I am feeling a bit lost of how to proceed.
Extra information
My cpan installs modules to
/usr/local/perl
And I have added the path to my environment variable
export PERL5LIB=/usr/local/perl
Edited information (failed tests & errors) as response to Shawn
#Shawn, Its a long list of errors, test failures and recommended installations. I I can post some examples of the first couple of errors. I am not really sure what to look neither.
Recommended installations
Checking prerequisites...
recommends:
* Algorithm::Munkres is not installed
* Array::Compare is not installed
* Bio::Phylo is not installed
* Convert::Binary::C is not installed
* GD is not installed
* Graph is not installed
* GraphViz is not installed
* HTML::TableExtract is not installed
* Inline::C (0.53) is installed, but we prefer to have 0.67
* PostScript::TextBlock is not installed
* SVG is not installed
* SVG::Graph is not installed
* Set::Scalar is not installed
* Sort::Naturally is not installed
* Spreadsheet::ParseExcel is not installed
* XML::DOM is not installed
* XML::DOM::XPath is not installed
* XML::Parser::PerlSAX is not installed
* XML::SAX::Writer is not installed
* XML::Twig is not installed
* YAML is not installed
Checking optional features...
EntrezGene............disabled
requires:
! Bio::ASN1::EntrezGene is not installed
MySQL Tests...........disabled
requires:
! DBD::mysql is not installed
Pg Tests..............disabled
requires:
! DBD::Pg is not installed
Here is the test summary report. I did not print the entire list of failed tests as it is extremely long. But What I cans see is that /LocalDB/SeqFeature_BDB.t is a part of the majority of the failed tests when looking at the verbose output.
Test Summary Report
-------------------
t/LocalDB/Fasta.t (Wstat: 1024 Tests: 109 Failed: 4)
Failed tests: 73, 91, 95, 101
Non-zero exit status: 4
t/LocalDB/Index/Index.t (Wstat: 20224 Tests: 36 Failed: 6)
Failed tests: 12-17
Non-zero exit status: 79
Parse errors: Bad plan. You planned 73 tests but ran 36.
t/LocalDB/Qual.t (Wstat: 1536 Tests: 56 Failed: 6)
Failed tests: 7-9, 49-50, 52
Non-zero exit status: 6
t/LocalDB/SeqFeature_BDB.t (Wstat: 0 Tests: 38 Failed: 4)
Failed tests: 17-19, 24
Parse errors: Bad plan. You planned 116 tests but ran 38.
t/Perl.t (Wstat: 512 Tests: 47 Failed: 16)
Failed tests: 28, 28, 28, 28-29, 29, 29, 29-30, 30, 30
30-31, 31, 31, 31
Non-zero exit status: 2
Parse errors: Tests out of sequence. Found (24) but expected (26)
Tests out of sequence. Found (25) but expected (27)
Tests out of sequence. Found (26) but expected (28)
Tests out of sequence. Found (26) but expected (29)
Tests out of sequence. Found (27) but expected (30)
Displayed the first 5 of 23 TAP syntax errors.
Re-run prove with the -p option to see them all.
t/RemoteDB/BioFetch.t (Wstat: 0 Tests: 83 Failed: 47)
Failed tests: 20-21, 21-22, 22-23, 23-24, 24-25, 25-26
26-27, 27-28, 28-29, 29-30, 30, 30, 30-31
31, 31, 31-32, 32, 32, 32-33, 33, 33, 33-34
34, 34, 34-35, 35, 35, 35-36, 36, 36, 36
Parse errors: Tests out of sequence. Found (4) but expected (6)
Tests out of sequence. Found (6) but expected (7)
Tests out of sequence. Found (7) but expected (8)
Tests out of sequence. Found (5) but expected (9)
Tests out of sequence. Found (6) but expected (10)
Displayed the first 5 of 79 TAP syntax errors.
Re-run prove with the -p option to see them all.
t/RemoteDB/GenBank.t (Wstat: 0 Tests: 658 Failed: 614)
Failed tests: 10-11, 11, 11-12, 12, 12-13, 13, 13-14
14, 14-15, 15, 15-16, 16, 16-17, 17, 17-18
18, 18-19, 19, 19, 19, 19, 19, 19-20, 20
20, 20, 20, 20, 20-21, 21, 21, 21, 21, 21
21-22, 22, 22, 22, 22, 22, 22-23, 23, 23
Thanks to everyone that helped out, I managed to figure it out in the end. I will explain the process here from beginning to end incase anyone else has the same issue.
The question I posted was to solve how to install Bio::Perl using CPAN as I was having issues with tests failing. Although I had some issues installing Bio-DB-HTS (which I solved before posting) and I will explain how I managed to install that as well in case anyone comes across the same issue.
It seems that Mac users tend to have an issue with the lzma.h header missing. In the case of installing Bio-DB-HTS. I had to modify a line in the Bio-DB-HTS/INSTALL.pl file that checked for the existence of the lzma.h file. See "Installing Bio-DB-HTS on Mac OSx" below for instructions.
Solving installation of Bio::Perl
Essentially I solved it by reinstalling/reconfiguring my CPAN installation. Although I believe the issue in the end was due to some environment variables that I had not set as I chose to manual sort out my CPAN directory structure, I recommend letting CPAN do this for you using the local:lib option as it will set or tell you how to set the environment variables at the end of the installation.
I had only set one of the environment variables below (PERL5LIB) which was probably the reason for my error. NOTE! that the paths you see below are specific for my system.
PATH="/Users/sjamal/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/Users/sjamal/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/Users/sjamal/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/Users/sjamal/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/Users/sjamal/perl5"; export PERL_MM_OPT;
If you have already it configured like me but what to start from a clean slate you will need to remove the CPAN folder created on the user that you installed cpan on.
/Users/<USERNAME>/.cpan
rm -rf /Users/<USERNAME>/.cpan
Now you should be able to run the cpan command as done at the first instance and get prompted with lots of questions of how you want to set up the installation and this is where you will be able to chose 'local:lib' (if you are able to access sudo you can choose the 'sudo' option as well). I installed cpanm based on multiple recommendations and also since it prompts less question apparently and then installed Bio::Perl. Although I should mention that the installation did failed a test and refused to install so I had to run the force command for it to build Bio::Perl.
cpan -i App:cpanminus
cpanm --force Bio::Perl
You should now have Bio::Perl installed.
Installing Bio-DB-HTS on Mac OSx
The lzma library is deprecated on Mac OSx but has been replaced with the XZ library so if you are missing the file as well you can install XZ using brew. If you don't have brew installed you can find how to install it here https://brew.sh/
brew install xz
You will now have a lzma.h header file in the location where XZ was installed using brew, in my case /usr/local/Cellar/xz/5.2.4/include/lzma.h.
git clone https://github.com/Ensembl/Bio-DB-HTS.git
cd Bio-DB-HTS-2.10
vim Bio-DB-HTS/INSTALL.pl
So, I changed the line using vim...
-e '/usr/include/lzma.h' or die <<END;
to
-e '/usr/include/lzma.h' **|| '/usr/local/Cellar/xz/5.2.4/include/lzma.h'** or die <<END;
NOTE! You have to change '/usr/local/Cellar/xz/5.2.4/include/lzma.h' path to where you have the lzma.h in XZ package just installed using brew. However, I want to clarify that this does not solve anything other than telling the script that the file does exist. The Install script won't be able to make use of the file (if that is what it needs to do) as nothing else has been changed in the installation script.
You should now be able to install Bio-DB-HTS by simply running the perl script as below
cd Bio-DB-HTS-2.10
perl INSTALL.pl
Hope that helps!
Sabri
Having the exact issue as described at: perl module Class::HPLOO v0.23 install issue, I have attempted to correct the defined(#array) problem by editing to just (#array) and trying to rebuild the module. However I continue to get the return of:
$ make clean
$ perl Makefile.PL
$ make
$ make test: *** No rule to
make target `clean:'. Stop. Manifying 2 pod documents
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.26" "-Iblib/lib" "-Iblib/arch"
test.pl
1..42
# Running under perl version 5.026002 for darwin
# Current time local: Sun Aug 26 06:48:26 2018
# Current time GMT: Sat Aug 25 22:48:26 2018
# Using Test.pm version 1.26 not ok 1
# Failed test 1 in test.pl at line 9
# test.pl line 9 is: ok(!$#) ; Can't locate object method "new" via package "Foo" at test.pl line 11. make: *** [test_dynamic] Error 2
There are three issues with Class::HPLOO (which as I noted before, hasn't been updated since 2005) that make it fail with modern perls.
As discovered in the previous post,
the obsolete construct defined (#array) is used once in lib/Class/HPLOO.pm' and three times inlib/Class/HPLOO/Base.pm`. This construction has been prohibited since v5.22
The current directory (.) is no longer in #INC (as of v5.24, I think). So the lines in test.pl like
require "test/classtest.pm"
either all need to be rewritten as
require "./test/classtest.pm"
or an easier fix is to put
use lib '.';
at the top of the script.
There is a regular expression in lib/Class/HPLOO.pm, line 1077, with an "unescaped left brace"
$sub =~ s/(\S)( {) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
{ is a regex metacharacter, and since v5.22 it has been illegal to use it in a context where it is not indicating a quantity. The fix, as the error message suggests, is to escape it.
$sub =~ s/(\S)( \{) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
Make these three changes to the code you download from CPAN and the module should build on modern Perls. If you're feeling helpful, you can submit a bug report (linking to this post, if you want) or even a patch with an email to bug-Class-HPLOO#rt.cpan.org
come across this issue today, so I fixed it following the answer above. if anyone want to save some time.
I create a repo with the changes. https://github.com/swuecho/Class_HPLOO.git
When I run the following to create an executable out of my Perl script:
pp -o process_target_mode_data Process_Target_Mode_Data.pl
I get the following error output:
Perl lib version (5.12.2) doesn't match executable version (v5.12.0) at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
Compilation failed in require at -e line 459.
/home/Neil/ActivePerl-5.12/site/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file 'parleNrP2Xi' at /home/Neil/ActivePerl-5.12/site/lib/PAR/Packer.pm line 1172, <DATA> line 1.
Could someone explain to me what is going on and how I can resolve this problem?
Info brian d foy requested:
[bash-3.2][Neil#willy]$ which pp
/home/Neil/ActivePerl-5.12/site/bin/pp
[bash-3.2][Neil#willy]$ /home/Neil/ActivePerl-5.12/site/bin/pp -o process_target_mode_data Process_Target_Mode_Data.pl
Perl lib version (5.12.2) doesn't match executable version (v5.12.0) at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
Compilation failed in require at -e line 459.
/home/Neil/ActivePerl-5.12/site/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file 'parludZfldz' at /home/Neil/ActivePerl-5.12/site/lib/PAR/Packer.pm line 1172, line 1.
[bash-3.2][Neil#willy]$
[bash-3.2][Neil#willy]$ /home/Neil/ActivePerl-5.12/bin/cpan -l | grep PAR
PAR 1.002
PAR::Dist 0.47
PAR::Heavy 0.12
PAR::Filter 0.03
PAR::SetupTemp 1.002
PAR::SetupProgname 1.002
PAR::Packer 1.006
PAR::StrippedPARL::Dynamic 0.958
PAR::StrippedPARL::Static 0.958
PAR::StrippedPARL::Base 0.975
PAR::Filter::Bytecode undef
PAR::Filter::Bleach undef
PAR::Filter::Obfuscate undef
PAR::Filter::PatchContent undef
PAR::Filter::PodStrip undef
App::Packer::PAR 0.91
Perl lib version (5.12.2) doesn't match executable version (v5.12.0)
Some parts of your Perl installation are at a different version than others. More specifically, if you look at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50, you will see that there is an explicit comparison of the version of Perl being executed (which is 5.12.0) to the version of the Config.pm library being used (5.12.2).
If you perform a new installation of ActivePerl 5.12.2 (to bring all components up to the same version), this error should go away.
I had same issue. I installed PAR::Packer from Activestate Perl Package Manager (PPM). As mentioned above in one of the replies, there is version mismatch between the perl and pp binaries. Here's how I fixed it:
Uninstall PAR-Packer from PPM.
Open DOS command line.
Run cpan install PAR::Packer
This will download, compile, and install the package from CPAN. MinGW compiler toolchain will be downloaded as well, if needed. The whole process may take a while on slower cpus.
Find the location of that pp, then figure out its version. I bet it's left over from an earlier installation. Ensure that you have PAR for your new version of Perl.
You can also try specifying the location of the particular pp you want to use so you know exactly what one you are using:
$ /full/path/to/5.12.2/pp ...
Go to the perl/lib/Config.pm and changed the condition in the lines:
die "$0: Perl lib version (5.32.0) doesn't match executable '$^X' version ($])" unless $^V;
to
die "$1: Perl lib version (5.32.1) doesn't match executable '$^X' version ($])" unless $^V;
and the next line
$^V eq 5.32.0 or die sprintf "%s: Perl lib version (5.32.0) doesn't match executable '$^X' version (%vd)", $0, $^V;
to
$^V eq 5.32.1 or die sprintf "%s: Perl lib version (5.32.1) doesn't match executable '$^X' version (%vd)", $0, $^V;
this worked for me, at least it won't complain... yes, i know, PERL and Python are f***d up.