I want to use the cpan tool get a library from CPAN (HTTP::Tiny::Multipart). (Or should I be using something else??) It is written in pure Perl so I hope I don't need make for this. Can this be done?
At first I couldn't get things to download at all, but eventually I found out the issue was proxies, and now with the right environment variables set I can successfully reach CPAN. But now I get error messages about a missing make.
There are three common installers for Perl module distributions. To use these installers, one follows one of the following two sequences of steps:
perl Makefile.PL # ExtUtils::MakeMaker or compatible
make
make test
make install
or
perl Build.PL # Module::Build or compatible
./Build
./Build test
./Build install
cpan handles downloading the distributions and installing prerequisites, but it doesn't replace the distribution's installer. When it comes time to install a download distribution, it uses one of the above sequence (depending on whether the distribution includes a file named Build.PL or not).
HTTP-Tiny-Multipart (the distribution that provides HTTP::Tiny::Multipart) uses ExtUtils::MakeMaker as its installer, so installing it requires make.
The underlying issue is that you are using a gutted environment. It's not the purpose of git to provide perl to you.
If you want the full unix emulation environment for which git and its perl were built[1], install Cygwin. Alternatively, you could also just as easily install a native Perl such as ActivePerl or Strawberry Perl.
Technically, git and its perl are built for MSYS, which is a subset of Cygwin.
Related
I have strawberry perl installed in my C drive in windows and running
a build from an existing big project. During the build there are some
perl build scripts that needs to be executed and in the it throws the
below error message:
Below are the results of the commands I gave for verifying the existence of XML::Simple
I am wondering about the path /usr/local/lib in windows and perl is
installed in C:\Strawberry\perl\bin and XML::Simple is in
C:\Strawberry\perl\vendor\lib\XML and C:\Strawberry\perl\lib\XML.
EDIT: Output from perl -V. I have kept only for #INC
Built under MSWin32 Compiled at Aug 2 2020 19:51:20 #INC:
C:/Strawberry/perl/site/lib
C:/Strawberry/perl/vendor/lib
C:/Strawberry/perl/lib
It looks like the two situations are using different perl binaries with different library paths. When you run perl or cpan, you are using Strawberry Perl. Whatever you are doing at the top is likely using a different perl, perhaps from cygwin.
You need to install modules with the perl that wants to use them. Find the cpan for that perl (perhaps look in the Makefile to see how its finding perl, and cpan should be in the same directory).
Update your answer with the (text) output of perl -V. At the end of that output it will show the #INC directories. I'm guessing that list doesn't match the top image.
I'm trying to get biotools working on my Mac so that I can run some Perl5 code that uses Bio::DB::Sam, but am stymied.
Mac OS X 10.10.4
perl 5.18.2
upgraded CPAN as per INSTALL instructions
'brew install expat' tells me that expat-2.1.0_1 is already installed
'sudo perl -MCPAN -e shell'
'install CJFIELDS/BioPerl-1.6.924.tar.gz'
'Do you want to run the Bio::DB::GFF or Bio::DB::SeqFeature::Store live database tests?' => 'n'
Install all
'Do you want to run tests that require connection to servers across the internet' => 'n'
Eventually get (with some lines deleted):
Running Build test
t/Align/AlignStats.t ................... ok
t/Align/AlignUtil.t .................... ok
t/Align/Graphics.t ..................... skipped: The optional module GD (or dependencies thereof) was not installed
...
t/AlignIO/msf.t ........................ ok
t/AlignIO/nexml.t ...................... skipped: The optional module Bio::Phylo (or dependencies thereof) was not installed
t/AlignIO/nexus.t ...................... ok
...
t/Assembly/ContigSpectrum.t ............ ok
t/Assembly/IO/bowtie.t ................. skipped: The optional module Bio::DB::Sam (or dependencies thereof) was not installed
t/Assembly/IO/sam.t .................... skipped: The optional module Bio::DB::Sam (or dependencies thereof) was not installed
t/Assembly/core.t ...................... ok
t/Cluster/UniGene.t .................... ok
Afterwards, I test with:
perl -e "use Bio::DB::Sam;"
and get:
Can't locate Bio/DB/Sam.pm in #INC (you may need to install the Bio::DB::Sam module) (#INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
I get the same results when cloning bioperl-live from GitHub (sync'd to revision 73c446c69a77) and trying to install that way.
Note that I have installed samtools 0.1.18 (to match the version on our cluster) by:
downloading the .tar.gz
running 'make'
copying 'samtools', 'bcftools/bcftools', and 'misc/*.pl' to ~/debarcer-packages/bin, which is on my path
Afterward, I get this:
$ which samtools
/Users/gvwilson/debarcer-packages/bin/samtools
This build did not produce a '.so' file, even though there is a rule in the samtools-0.1.18 Makefile that looks like it (maybe?) ought to produce one.
The module Bio::DB::Sam provides bindings to an older version of samtools that did not rely htslib. This is an important point because you may run into issues using SAM/BAM files generated with samtools or other aligners because most tools use htslib these days.
For building the module, you are on the right track with the version you are using but it is difficult to build if you do not know the correct flags. I previously provided a solution to do this and I'll show a better way here (just use a package manager for the Perl module).
wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2
tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18
make CFLAGS=-fPIC
export SAMTOOLS=`pwd`
The last command will allow you to install the Perl module without looking for the PATH to samtools and being prompted for it. Note, the extra CFLAGS argument may not be needed on your Mac, so try without it first. It is required on Linux, and since the module uses so much memory you will likely only be using this on a Linux machine. Now, install the Perl module.
cpanm Bio::DB::Sam
or cpan if you prefer. That should get you a working Bio::DB::Sam. I don't know what you are trying to do but I will mention that the fine folks over at EBI have developed bindings to htslib called Bio::DB::HTS based on Lincoln Stein's XS code in the Bio::DB::Sam module. This is really what you should be using because the version of SAMtools mentioned above is really old and not being developed. That is my opinion and a word of caution though, nothing wrong with Bio::DB::Sam.
edit:
You find it easier to manage Perl without using the "system" Perl, and here is one solution. Other people may have their preferred method, but perlbrew (combined with cpanminus) will make this type of work fun and much less of a pain (and they are popular choices). That would be my first step: set up perlbrew, install Perl 5.22, then install cpanminus. That might sound challenging but it is just a few commands. Something along the lines of:
curl -L http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.22.1
perlbrew switch perl-5.22.1
perlbrew install-cpanm
should do the trick. That will give you a kick-ass Perl with some nice features not available with your "system" Perl. This is a good idea because using /usr/bin/perl requires sudo, it involves messing with the system libraries which might cause an issue, and the recent Apple changes mean that working with root directories/libraries is completely unstable.
You need to install an additional (optional) module to use samtools. That's what the The optional module Bio::DB::Sam message is about. You don't need it for the rest of BioPerl, so it's not a hard dependency.
For Bio::DB::Sam, you need samtools-0.1.17 (the latest version the module works with according to its docs). I downloaded the source and ran make. There were some warnings, but it appears to work. From your question, I don't think you had a problem here.
I then installed Bio::DB::Sam:
$ cpan Bio::DB::Sam
There were some compiler warnings, but the module passed its tests and installed. The cpan command took care of dependencies too, so it also installed BioPerl for me.
If you need some environment variables, you can set them for a one-off run of the command:
$ CFLAGS=... SAMTOOLS=... cpan Bio::DB::Sam
Note that installing Bio::DB::Sam prompted me for the location of samtools. I pointed it at the build directory:
$ cpan5.22.0 Bio::DB::Sam
Running install for module 'Bio::DB::Sam'
Configuring L/LD/LDS/Bio-SamTools-1.43.tar.gz with Build.PL
This module requires samtools 0.1.10 or higher (samtools.sourceforge.net).
Please enter the location of the bam.h and compiled libbam.a files: /Users/brian/Downloads/samtools-0.1.17
I'm betting there's not something complicated like the answer SES gave. You just need an optional module. The README for Bio::DB::Sam notes some problems that people might have and offers so workarounds, but I didn't run into these problems and my setup is close to yours.
Note that Alien::SamTools is a Perl package that installs the non-Perl samtools, but it says it installs 0.1.19. Maybe that works too, but that's not what Bio::DB::Sam says on the tin.
I am trying to install Lib::XML in my ActiveState Perl Windows machine.
perl 5, version 20, subversion 2 (v5.20.2)
I tried the following:
C:\Users\VENKATESH>ppm install XML-LibXML
ppm install failed: Can't find any package that provides XML-LibXML
C:\Users\VENKATESH>ppm install http://theoryx5.uwinnipeg.ca/ppms/XML-LibXML.ppd
ppm install failed: 500 Can't connect to theoryx5.uwinnipeg.ca:80
How do I install packages for Perl on Windows?
As others mentioned, there doesn't seem to be a pre-compiled PPM for ActiveState Perl 5.20. I contributed instructions for building XML::LibXML from source on Windows. Look for them in the README file that comes with the distribution. I haven't done it in a while, but I expect they still work. I'll reproduce them here, but you should check the distribution for updates.
These instructions assume that you already have your system set up to compile
modules that use C components.
First, get the libxml2 binaries from http://xmlsoft.org/sources/win32/
(currently also available at http://www.zlatkovic.com/pub/libxml/).
You need:
iconv-VERSION.win32.zip
libxml2-VERSION.win32.zip
zlib-VERSION.win32.zip
Download the latest version of each. (Each package will probably have a
different version.) When you extract them, you'll get directories named
iconv-VERSION.win32, libxml2-VERSION.win32, and zlib-VERSION.win32, each
containing bin, lib, and include directories.
Combine all the bin, include, and lib directories under c:\Prog\LibXML. (You
can use any directory you prefer; just adjust the instructions accordingly.)
Get the latest version of XML-LibXML from CPAN. Extract it.
Issue these commands in the XML-LibXML-VERSION directory:
perl Makefile.PL INC=-Ic:\Prog\LibXML\include LIBS=-Lc:\Prog\LibXML\lib
nmake
copy c:\Prog\LibXML\bin\*.dll blib\arch\auto\XML\LibXML
nmake test
nmake install
(Note: Some systems use dmake instead of nmake.)
By copying the libxml2 DLLs to the arch directory, you help avoid conflicts
with other programs you may have installed that use other (possibly
incompatible) versions of those DLLs.
As ikegami mentioned, XML-LibXML is available upto perl 5.16 and not later.
ppm install XML-LibXML
You can use cpan utility with ActiveState's Perl.
> cpan XML::LibXML
Background
Working with OS X and using macports for additional utilities and libraries. The macports are installing everything into /opt/local. But the default perl in macports is 5.12, specifying an higher version like to break many ports, so I'm using my own 5.16 perl installed with perlbrew.
So, I have libraries in the default /usr/lib (provided by Apple) but want linking XS based perl modules with the macports provided libs and includes at /opt/local.
Now the question, when installing modules with cpanm (into my perlbrew's perl tree), is here some way how to specify globally the default search path for libraries and includes for cpanm (to the modules build process) to search /opt/local/{lib|include} at first?
AFAIK the cpanm havent any switches for this, so maybe, some ENV variables? Or any simpler solution as edit every Makefile.PL?
Install half manually. Run cpanm --look Some::Dist and supply the appropriate INC and LIBS or --include_dirs and --extra_compiler_flags to the build tool on the command line to configure, then finish off with the build, test, install steps and close the subshell.
Alternatively, if you need to fully automate this, then use a full-featured CPAN client instead of cpanm. For example, run the cpan shell and configure makepl_arg and mbuildpl_arg. This is then supplied to subsequent installations (instead of just one, as above).
i'm having loads of problem in trying to install CPAN Modules. Using the cpan.exe, I try to install a module with, for example, "install Win32::IE::Mecahnize" but I end up hitting a wall. In the beginning it find dmake.EXE and is okay, but when the install finishes it says dmake.exe is NOT OK, and Dmake.exe Error code 255 , while making 'test-dynamic'.
I'm very confused as to what is happening and why its not working?? Help is much appreciated.
This is the current error I get:
dmake.EXE: Error code 255, while making 'test_dynamic'
C:\strawberry\c\bin\dmake.EXE test -- NOT OK
Running make install
make test had returned bad status, won't install without force
ABELTJE/Win32-IE-Mechanize-0.009.tar.gz : make_text NO
It's not your fault. That module doesn't work for anyone. When you run into a failure with a module, investigate it to see if other people are having problems. You can look on its CPAN Search page to see that there are no passing testers reports for that distribution. That distribution should not install without force. We cover some of this in Effective Perl Programming's section on researching modules.
Can you install other modules without a problem?
ya, well here's the thing, I have both ActivePerl and Strawberry Perl installed, is that a problem?
Shouldn't be an issue. However, you need to make sure that Strawberry Perl's distro contains the binaries and libraries you need to build and install non-text only modules. You need to make sure you're using Strawberry Perl's stuff and not ActivePerl. I recommend putting Strawberry Perl in your PATH, but not ActivePerl.
Easiest thing to do is not use CPAN, but ActivePerl's own PPM manager. ActivePerl has probably prebuilt about 90% of the CPAN modules and have them available via their PPM manager. Try that.