Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modules install successfully but cannot be found

I am wondering why I get "Installing the dependencies failed: Module 'Module::Name' is not installed" even when dependency is has been installed. I am using perlbrew and cpanm. Here is an example of what happens with many modules that I try to install:

  1. I try to install for example URI::ws as follow
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm --installdeps URI::ws
--> Working on URI::ws
Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/URI-ws-0.03.tar.gz ... OK
Configuring URI-ws-0.03 ... OK
==> Found dependencies: URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
! Installing the dependencies failed: Module 'URI' is not installed
! Bailing out the installation for URI-ws-0.03.
1 distribution installed
  1. it tells me URI is not installed. So I install URI as follow:
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
1 distribution installed
  1. I go back to what I originally wanted which was URI::ws and here is what I get:
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm URI::ws
--> Working on URI::ws
Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/URI-ws-0.03.tar.gz ... OK
Configuring URI-ws-0.03 ... OK
==> Found dependencies: URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
! Installing the dependencies failed: Module 'URI' is not installed
! Bailing out the installation for URI-ws-0.03.
1 distribution installed

Can anyone tell me why this is happening and what I can do to stop it? If there is any more information that you need which I have missed please let me know.

Thank you

like image 468
Hamster Avatar asked Sep 23 '26 20:09

Hamster


2 Answers

Thanks to https://stackoverflow.com/users/2019415/g-cito

hamid@caspian:~$ PERL_MM_OPT=""; PERL_MB_OPT="";

has done the job :)

local::lib was messing stuff up. URI.pm was installed but not under the perlbrew directory.

like image 199
Hamster Avatar answered Sep 26 '26 11:09

Hamster


With perlbrew you can install a perlbrew specific cpanm which facilitates installing to the various perls/ that are installed/managed using the perlbrew tool. I have found that this works very well.

However perlbrew can become confused if you mix in your own local::lib and set related environment variables like PERL5LIB, PERL_MM_OPT, PERL_MB_OPT etc. (see for example the post by @cjm in perlbrew and local::lib at the same time?). Some of these environment vars can interact and interfere with perlbrew's own environment so it's generally best to avoid mixing them or simply to let perlbrew manage the environment using its own versions of those variables.

It is of course possible to use local::lib environments "inside" perlbrew with the lib command) and to do very complicated things for testing with different perl versions, shipping an application with requirements (c.f. Carton). In my own environment I was able to manage system perl; a user installed local::lib that used the system perl; and a huge set of perlbrew perls all with judicious use of environment variables (thankfully a temporary set up while migrating between versions).

That sort of set up can get complicated very quickly, and is difficult to replicate. One of the greatest advantages of perlbrew is you can easily setup matching perl environments on multiple machines; or different perl environments on the same machine.

like image 39
G. Cito Avatar answered Sep 26 '26 12:09

G. Cito