Installation

Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -
Number of replies: 18

tried to restart httpd 2.4 on rhel 8 and got this

 Can't locate DateTime.pm in @INC (you may need to install the DateTime module) 

#> cpanm Date::Parse

Date::Parse is up to date. (2.33)

what is wrong?



In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Peter Staab -
This will also need to be installed with

cpanm DateTime

In reply to Peter Staab

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -

mine is already installed thought

#> cpanm DateTime

DateTime is up to date. (1.54)


all modules as well


$> check_modules.pl apache2


Checking your $PATH for executables required by WeBWorK...

$PATH=      /usr/local/perlbrew/bin

      /usr/local/perlbrew/perls/perl-5.20.3/bin

      /usr/local/texlive/2021/bin/x86_64-linux

      /sbin

      /bin

      /usr/sbin

      /usr/bin

      /usr/local/texlive/2021/bin/x86_64-linux

      /opt/webwork/webwork2/bin


   convert found at /bin/convert

   curl found at /bin/curl

   dvisvgm found at /usr/local/texlive/2021/bin/x86_64-linux/dvisvgm

   mkdir found at /bin/mkdir

   mv found at /bin/mv

   mysql found at /bin/mysql

   tar found at /bin/tar

   git found at /bin/git

   gzip found at /bin/gzip

   latex found at /usr/local/texlive/2021/bin/x86_64-linux/latex

   pdf2svg found at /bin/pdf2svg

   pdflatex found at /usr/local/texlive/2021/bin/x86_64-linux/pdflatex

   dvipng found at /usr/local/texlive/2021/bin/x86_64-linux/dvipng

   giftopnm found at /bin/giftopnm

   ppmtopgm found at /bin/ppmtopgm

   pnmtops found at /bin/pnmtops

   pnmtopng found at /bin/pnmtopng

   pngtopnm found at /bin/pngtopnm


Checking your @INC for modules required by WeBWorK...

@INC=     /usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux-thread-multi

     /usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3

     /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3/x86_64-linux-thread-multi

     /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3

     .


   Archive::Zip found and loaded

   Array::Utils found and loaded

   Benchmark found and loaded

   Carp found and loaded

   CGI found and loaded

   CGI::Cookie found and loaded

   Class::Accessor found and loaded

   Data::Dump found and loaded

   Data::Dumper found and loaded

   Data::UUID found and loaded

   Date::Format found and loaded

   Date::Parse found and loaded

   DateTime found and loaded

   DBD::mysql found and loaded

   DBI found and loaded

   Digest::MD5 found and loaded

   Digest::SHA found and loaded

   Email::Address::XS found and loaded

   Email::Sender::Simple found and loaded

   Email::Sender::Transport::SMTP found and loaded

   Email::Simple found and loaded

   Errno found and loaded

   Exception::Class found and loaded

   File::Copy found and loaded

   File::Find found and loaded

   File::Find::Rule found and loaded

   File::Path found and loaded

   File::Spec found and loaded

   File::stat found and loaded

   File::Temp found and loaded

   GD found and loaded

   Getopt::Long found and loaded

   Getopt::Std found and loaded

   HTML::Entities found and loaded

   HTML::Scrubber found and loaded

   HTML::Tagset found and loaded

   HTML::Template found and loaded

   HTTP::Async found and loaded

   IO::File found and loaded

   IO::Socket::SSL found and loaded

   Iterator found and loaded

   Iterator::Util found and loaded

   JSON found and loaded

Prototype mismatch: sub main::encode_json ($) vs ($;$) at /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3/Exporter.pm line 66.

 at (eval 438) line 2.

Prototype mismatch: sub main::decode_json: none vs ($;$$) at /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3/Exporter.pm line 66.

 at (eval 438) line 2.

   JSON::MaybeXS found and loaded

   Locale::Maketext::Lexicon found and loaded

   Locale::Maketext::Simple found and loaded

   LWP::Protocol::https found and loaded

   MIME::Base64 found and loaded

   Net::IP found and loaded

   Net::LDAPS found and loaded

   Net::OAuth found and loaded

   Net::SMTP found and loaded

   Net::SSLeay found and loaded

   Opcode found and loaded

   PadWalker found and loaded

   Path::Class found and loaded

   PHP::Serialization found and loaded

   Pod::Usage found and loaded

   Pod::WSDL found and loaded

   Safe found and loaded

   Scalar::Util found and loaded

   SOAP::Lite found and loaded

   Socket found and loaded

   Statistics::R::IO found and loaded

   String::ShellQuote found and loaded

   Template found and loaded

   Text::CSV found and loaded

   Text::Wrap found and loaded

   Tie::IxHash found and loaded

   Time::HiRes found and loaded

   Time::Zone found and loaded

   URI::Escape found and loaded

   UUID::Tiny found and loaded

   XML::Parser found and loaded

   XML::Parser::EasyTree found and loaded

   XML::Simple found and loaded

   XML::Writer found and loaded

   XMLRPC::Lite found and loaded

   YAML found and loaded

   Apache2::Request found and loaded

   Apache2::ServerRec found and loaded

   Apache2::ServerUtil found and loaded


 checking for SQL::Abstract


You have version 1.87 of SQL::Abstract installed.  This will be used

[root@srv]# cpanm DateTime

DateTime is up to date. (1.54)



In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -
I think some are missing the DateTime here?

[root@srv bin]# cd /usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux-thread-multi

[root@srv x86_64-linux-thread-multi]# ls

Apache APR.pm Cpanel DateTime DBI Digest Encode.pm GD IO MIME Net Params Sub Test Variable XSLoader.pm

Apache2 auto Cwd.pm DateTime.pm DBI.pm Email encoding.pm GD.pm IO.pm ModPerl Package Scalar Template Text Win32 XString.pm

APR Bundle Data DBD dbixs_rev.pl Encode File HTML List mod_perl2.pm PadWalker.pm Socket.pm Template.pm Time XML

[root@srv x86_64-linux-thread-multi]# cd /usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3

[root@srv 5.20.3]# ls

Algorithm B CGI.pod DateTime Eval HTML JSON Mock namespace Params Scope SQL Test Time WWW

Apache Bundle Class DBIx Exception HTTP JSON.pm Module Net Parse SOAP StackTrace Test2 TimeDate.pm x86_64-linux-thread-multi

AppConfig Capture Clone Devel ExtUtils Importer.pm libwww Moo newgetopt.pl Path Specio Statistics Test2.pm Try XML

AppConfig.pm Carp Convert Digest Fh.pm IO Locale Moo.pm Number perldoc.pod Specio.pm String Text UNIVERSAL XMLRPC

Archive Carp.pm CPAN Dist File IPC LWP MooX ok.pm PHP Spiffy Sub Throwable URI YAML

Array CGI Data Email Getopt Iterator LWP.pm Mozilla oo.pm Pod Spiffy.pm Task Throwable.pm URI.pm YAML.pm

auto CGI.pm Date Encode Hash Iterator.pm Method MRO Package Role Spiffy.pod Term Tie UUID YAML.pod

[root@srv 5.20.3]# cd /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3/x86_64-linux-thread-multi/

[root@srv x86_64-linux-thread-multi]# ls

arybase.pm B.pm Config.pm Data DynaLoader.pm Errno.pm Hash IPC MIME ops.pm POSIX.pod Socket.pm threads.pm

attributes.pm Compress Config.pod DB_File.pm Encode Fcntl.pm I18N lib.pm mro.pm PerlIO re.pm Storable.pm Tie

auto Config_git.pl CORE Devel Encode.pm File IO List Opcode.pm perllocal.pod Scalar Sys Time

B Config_heavy.pl Cwd.pm Digest encoding.pm Filter IO.pm Math O.pm POSIX.pm SDBM_File.pm threads Unicode

[root@srv x86_64-linux-thread-multi]# cd /usr/local/perlbrew/perls/perl-5.20.3/lib/5.20.3

[root@srv 5.20.3]# ls
AnyDBM_File.pm bigint.pm Class diagnostics.pm Exporter.pm HTTP Memoize Parse sigtrap.pm Tie vmsish.pm
App bignum.pm Compress Digest ExtUtils I18N Memoize.pm Perl sort.pm Time warnings
Archive bigrat.pm Config Digest.pm Fatal.pm if.pm Module perl5db.pl strict.pm Unicode warnings.pm
Attribute blib.pm constant.pm DirHandle.pm feature.pm inc Net perlfaq.pm subs.pm unicore x86_64-linux-thread-multi
autodie bytes_heavy.pl CORE.pod Dumpvalue.pm fields.pm integer.pm NEXT.pm PerlIO Symbol.pm UNIVERSAL.pm XSLoader.pm
autodie.pm bytes.pm CPAN dumpvar.pl File IO open.pm PerlIO.pm TAP User
AutoLoader.pm Carp CPAN.pm Encode FileCache.pm IPC overload pod Term utf8_heavy.pl
AutoSplit.pm Carp.pm DBM_Filter encoding FileHandle.pm JSON overloading.pm Pod Test utf8.pm
autouse.pm CGI DBM_Filter.pm English.pm filetest.pm less.pm overload.pm Safe.pm Test.pm vars.pm
B CGI.pm DB.pm Env.pm Filter Locale Package Search Text version
base.pm _charnames.pm deprecate.pm experimental.pm FindBin.pm locale.pm Params SelectSaver.pm Thread version.pm
Benchmark.pm charnames.pm Devel Exporter Getopt Math parent.pm SelfLoader.pm Thread.pm version.pod
In reply to Peter Staab

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -
Jul 23 09:28:56 srvTestServer httpd[432410]: Can't locate DateTime.pm in @INC (you may need to install the DateTime module) (@INC contains: /opt/apps/webwork/webwork2/lib /usr/local/lib64/perl5
In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

your @INC isn't pointing to the perlbrew version of perl. It's unclear to me why that might be the case. You have perlbrew enabled in your ~/.bashrc? 

Maybe try enabling perlbrew for all users:

  • sudo nano /etc/bashrc
  • add line at the end of file: `source /usr/local/perlbrew/etc/bashrc`

See if that helps the apache daemon find the right perl to use...

In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -

Yup/// already have and still that error.. I don't get it


...

-- Unit httpd.service has begun starting up.

Jul 23 20:49:05 srvA httpd[455019]: AH00526: Syntax error on line 48 of /etc/httpd/conf.d/webwork.conf:

Jul 23 20:49:05 srvA httpd[455019]: Can't locate DateTime.pm in @INC (you may need to install the DateTime module) (@INC contai>

Jul 23 20:49:05 srvA systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE

Jul 23 20:49:05 srvA systemd[1]: httpd.service: Failed with result 'exit-code'.


line 48 in the webwork.conf is this

 47 <Perl>

 48

 49 #########################################################


In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -
with or without the quote?
In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

without the quote.

What you're experiencing sounds familiar, and I'm pretty sure that I ran into this situation when I was working on the wiki instructions. I didn't end up finding my way out of it, and instead restarted the installation process. Things to keep in mind:

  • make sure to install perlbrew right away
  • make sure that your user (and the root user) have perlbrew in their shell (log out, log back in, check for perlbrew, `sudo -s`, check for perlbrew)
  • use cpanm for installing perl modules instead of RHEL packages
  • always install cpan modules with sudo (or as root directly)
  • do not apply `--force` (exception for XMLRPC::Lite)

In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -

or maybe if I was "smart" I would just go with ubuntu instead lol

how can I start from scratch by deleting the modules properly? the only force I had to do was for DBD:MYSQL I believe.. can't remember so long ago

I even changed the bash_profile that when I log in, it shows me the current perl version in the CLI and it is 5.20.3$>

perl-5.20.3$> perl -le'use DateTime; print $INC{"DateTime.pm"}'

/usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux-thread-multi/DateTime.pm

I solved that by adding a redhat8 repository similar to PowerTools on CentOS. On RHEL 8 we have the CodeReady Builder repository ...  but that created more problems like missing


$>  sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms

$> yum install "perl(DateTime)"

$> yum install "perl(HTML::Scrubber)"

$> yum install "perl(Locale::Maketext)"

DateTime (fixed)

HTML::Scrubber (fixed)

Locale::Maketext (fixed)

Locale::Maketext:: Lexicon (stuck here)

$> yum install "perl(Locale::Maketext::Lexicon)"

Updating Subscription Management repositories.

Last metadata expiration check: 2:10:18 ago on Sat 24 Jul 2021 10:08:24 AM PDT.

No match for argument: perl(Locale::Maketext::Lexicon)

Error: Unable to find a match: perl(Locale::Maketext::Lexicon)

Yet....

$> cpanm Locale::Maketext::Lexicon

Locale::Maketext::Lexicon is up to date. (1.00)



In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by L Ng -
cpanm --uninstall App:Module right?
In reply to L Ng

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Sukhjit Singh Sehra -

After creating a symbolic link
ln -s /opt/webwork/webwork2/conf/webwork.apache2.4-config /etc/httpd/conf.d/webwork.conf
I am trying to start the apache, but  I am getting the
AH00526: Syntax error on line 48 of /etc/httpd/conf.d/webwork.conf:
WEBWORK httpd[2179]: Can't locate DateTime.pm in @INC (you may need to install the DateTime module) (@INC contains: /opt/webwork/webwork2/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 /etc/httpd) at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 30.\nBEGIN failed--compilation aborted at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 30.\nCompilation failed in require at /opt/webwork/webwork2/lib/WeBWorK/CourseEnvironment.pm line 57.\nBEGIN failed--compilation aborted at /opt/webwork/webwork2/lib/WeBWorK/CourseEnvironment.pm line 57.\nCompilation failed in require at (eval 5) line 1.\nBEGIN failed--compilation aborted at (eval 5) line 1.\n

I checked with check_modules.pl apache2.. all the packages are available but server is throwing above error!!

Thanks in advance
In reply to Sukhjit Singh Sehra

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

@INC:

/opt/webwork/webwork2/lib

/usr/local/lib64/perl5 

/usr/local/share/perl5 

/usr/lib64/perl5/vendor_perl 

/usr/share/perl5/vendor_perl

/usr/lib64/perl5 /usr/share/perl5 

/etc/httpd


Maybe try 'find'ing the DateTime.pm module? `find /usr -name DateTime.pm`

In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Sukhjit Singh Sehra -

I ran 'find /usr -name DateTime.pm`

and I was able to see it at:

/usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux-thread-multi/DateTime.pm

What could be the reason  'webwork.conf' is not able to find it and throwing the syntax error as shared in the previous post?

Thanks for the help in advance.

In reply to Sukhjit Singh Sehra

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

Based on the @INC as you shared above, your system is not looking in /usr/local/perlbrew/... for modules.

Keep in mind, there's the 'system' perl, and then there's the various installation(s) of perl that you're managing with perlbrew. It seems that apache (via mod_perl) is using the system perl (and it's subdirectories -- as evidenced in the "@INC includes:" in the error message above) rather than perlbrew.

Is it possible that you have not enabled perlbrew for the root user? (I'm trying to figure out why your apache restarts are not using the perlbrew-installed version of perl.)

In order to be persistent, the last line (`source /usr/local/perlbrew/etc/bashrc`) needs to be added to the `.bashrc` file for the wwadmin user: /home/wwadmin/.bashrc; and should also be added for the root user as well.


In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Sukhjit Singh Sehra -
Those lines were already added to (source /usr/local/perlbrew/etc/bashrc) for wwadmin, root and also at /etc/bashrc.

One thing I did differently then tutorial was, I installed the following packages:
yum install expat-devel
yum install perl-ExtUtils-Embed
yum install mod_perl <--- is this a problem point, if yes what could be the remedy.
yum install httpd-devel

Is it also possible to update the entry at
# nano /etc/httpd/conf.modules.d/02-perl.conf
so that it can find the perl modules

PS: ( I have checked DateTime is available under `/usr/local/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux-thread-multi/DateTime.pm`)
In reply to Sukhjit Singh Sehra

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

Yes, the problem is that you installed mod_perl via yum.

It should instead be installed with cpanminus after having compiled your own perl with perlbrew.

https://webwork.maa.org/wiki/Installation_Manual_for_2.16_on_RHEL8#Installing_Perl_Modules

I do not know how cleanly it will work to uninstall the system-mod_perl and re-install with `cpanm mod_perl2` -- but that is what needs to happen. (When working on this installation guide, I tried many means of getting mod_perl installed in RHEL8 -- the only reason this guide has you install perlbrew and a custom perl is precisely to get mod_perl working.) 


In reply to Andrew Parker

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Sukhjit Singh Sehra -

I had to start from scratch and now I have successfully built the server on oracle linux!!

Thanks for your constructive suggestions Prof Parker.

In reply to Sukhjit Singh Sehra

Re: Can't locate DateTime.pm in @INC (you may need to install the DateTime module)

by Andrew Parker -

Glad to hear it! I can't tell you how many times I had to start from scratch in the process of developing those instructions... it's not pleasant, but sometimes it's the only way.