New version of Perl messed up #INC - perl

I'm using Linux Mint 17.
I've installed Perl version 5.20 over 5.18 version and now I have problems with installing new modules, because cpan is installing then into 5.20 folders, but #INC contains only:
(#INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18
/usr/local/lib/site_perl .)
What is the best solution for this mess? Should I just add new 5.20 folders into #INC or is it too dirty way and I should somehow delete previous Perl version or even redo it all over again?
Tahnks a lot.

As Quentin suggested, NEVER touch your system's Perl. Use local::lib or perlbrew.
What you can do now is to use your distro's package manager to uninstall and install Perl, then leave it as it is and install perlbrew.

Related

How to resolve #INC related issue in Perl

I am getting the following error, while run the perl script.
Can't locate File/stat.pm in #INC (you may need to install the File::stat module) (#INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/local/share/perl/5.24.1/Path/Class/Entity.pm line 9.
I have tried to install the missing package thorugh CPAN install.
When i tried CPAN ,I am getting the following error
Can't locate File/Find.pm in #INC (you may need to install the File::Find module) (#INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl/5.24/CPAN/CacheMgr.pm line 8.
Can u please any one help me to resolve the issue.
File::stat has been a part of the standard Perl distribution since Perl 5.004 in 1997. There should never be a reason to install it separately. If you find yourself in that situation, then something has gone badly wrong in your Perl installation and I would strongly suggest reinstalling from scratch using the pre-built packages supplied by your Linux distribution.

Which modules are missed?

On my system:
$ uname -ra
Linux web.feel-safe.net 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
I get next errors while installing modules:
Can't locate inc/ExtUtils/MY_Metafile.pm in #INC (you may need to install the inc::ExtUtils::MY_Metafile module) (#INC contains: /home/feelsafe/web/local/lib/perl5/x86_64-linux-gnu-thread-multi /home/feelsafe/web/local/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at Makefile.PL line 4.
BEGIN failed--compilation aborted at Makefile.PL line 4.
.
Configuring List-MoreUtils-0.416
Running Makefile.PL
Can't locate inc/latest.pm in #INC (you may need to install the inc::latest module) (#INC contains: /home/feelsafe/web/local/lib/perl5/x86_64-linux-gnu-thread-multi /home/feelsafe/web
/local/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/per
l/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at Makefile.PL line 51.
BEGIN failed--compilation aborted at Makefile.PL line 51.
.
Configuring MRO-Compat-0.12
Running Makefile.PL
Can't locate inc/Module/Install.pm in #INC (you may need to install the inc::Module::Install module) (#INC contains: /home/feelsafe/web/local/lib/perl5/x86_64-linux-gnu-thread-multi /home/feelsafe/web/local/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
-> N/A
-> FAIL Configure failed for MRO-Compat-0.12. See /home/feelsafe/.cpanm/work/1524673518.17946/build.log for details.
Currently I have found this article, but still do not understand the problem.
What did I miss on my system? And what is the problem?
Because I use Carton to deploy my application:
carton install --deployment
I have List-MoreUtils-0.416 in my cpanfile.snapshot. Thus I use old module version which relies on "." exists at #INC.
But on target host, where I was faced into Can't locate inc/latest.pm in #INC problem there is DEBIAN perl-5.24.1 which apply patch from perl-5.26 which removes '.' from #INC
Because of this inc::latest is not found in bundled directory
To resolve my issue I just add next line into cpanfile:
requires 'List::MoreUtils', '>=0.428'
Unfortunately carton update do not update all modules from cpanfile.snapshot just only mentioned at cpanfile.
Also, I think, it will be OK to install inc::latest
You may be using the "system" perl (cf. perlbrew) where the library paths in %INC assume modules are installed using the operating system's package manager.
When building modules it's sometimes easier to use a locally built perl, a module "bootstrapping" utility like local::lib, or perlbrew to manage your "non-system" instance of perl. This allows you to easily avoid mixing module packages installed by the OS with your own locally built modules.

CPAN on Ubuntu Can't locate local/lib.pm

I just set up an Ubuntu 16.04 box and am trying to get some Perl modules installed. I launched CPAN, and it went through the automatic config procedure. At the end it dumped a few questionable messages:
Couldn't untar local-lib-2.000019.tar: 'Cannot allocate memory'
'YAML' not installed, will not store persistent state
HAARG/local-lib-2.000019.tar.gz
Had problems unarchiving. Please build manually
Can't locate local/lib.pm in #INC (you may need to install the local::lib module) (#INC contains: /home/steve/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base /home/steve/waternow) at /usr/share/perl/5.22/CPAN/FirstTime.pm line 1347.
When I restarted it, it came up with the CPAN shell command line like nothing is wrong. Did it get configured correctly, or is there something else I need to do? I'm not a Lunix noob but not an expert either.
Also are there any better options for installing Perl modules on Ubuntu besides CPAN (for example like Activestate Perl Package Manager on Windows)? I've never been too fond of CPAN because of experiences like this.

Cannot locate a perl module

I am trying to run a topology generation tool (http://informatique.umons.ac.be/networks/igen/) on linux where I need to install plenty of modules of perl.
For now, I have already installed CPAN. This tool requires a Statistics::Basic module which I also installed successfully.
However, after installing this module, the tool requires a package in this Statistics::Basic module. Here are the hints appeared in the command line:
Can't locate Statistics/Basic/CoVariance.pm in #INC (you may need to install the Statistics::Basic::CoVariance module) (#INC contains: /usr/local/share/perl/5.18.2/ /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .)
I get confused on this request since it is already included in the Statistics::Basic module. Even though I tried to install it independently, the cpan responded this:
cpan[1]> install Statistics::Basic::CoVariance
Warning: Cannot install Statistics::Basic::CoVariance, don't know what it is.
Does anyone know how to fix it? I am new to perl so I don't know how to make it work. Thx.
You need to replace the capital V with a small v in a couple of files and you need also some other modifications. You can find here a guide on how to make IGen-0.15 work again.

CPAN module installation problems

I have installed cpan module by cpan install semantics3 and cpanm install semantics3 but still it is throwing error like this
Can't locate Net/Semantics3.pm in #INC (you may need to install the Net::Semantics3 module) (#INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at extraction.pl line 1.
BEGIN failed--compilation aborted at extraction.pl line 1.
You need to specify the whole module name for installation, not just the last part. Thus, your command should be
cpan Net::Semantics3
instead of just install semantics3.
From its GitHub repo, you can try:
perl -MCPAN -e "install Net::Semantics3"