armagedescu
armagedescu

Reputation: 2155

Perldl failing to plot. Gnuplot fails to deploy with cpan

Started separated topic with clean new install as suggested by Håkon Hægland.
For those who are interested in solution, skip to end. Gnuplot failing to install. Problem described here
Now removed all perl and started from clean install.
Using strawberry perl pdl edition, from zip package strawberry-perl-5.32.1.1-64bit-PDL, no msi.
First according to Documentation for PDL First Steps.
I ran cpan PDL::Graphics::Simple. Looks like successful. Now run perldl according to Documentation for PDL First Steps

pdl> use PDL::Graphics::Simple
PDL::Graphics::Simple::register: PDL::Graphics::Simple::Prima is out of date - winging it at perlhome/perl/site/lib/PDL/Graphics/Simple.pm line 1397, <DATA> line 209.
pdl>imag (sin(rvals(200,200)+1))
Trying gnuplot (PDL::Graphics::Gnuplot)...nope
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Sorry, all known plotting engines failed.  Install one and try again.

So, first warning went not according to Documentation for PDL First Steps. The further errors after calling imag (sin(rvals(200,200)+1)) went also not according to documentation. Test any plot

pdl> use PDL::Graphics::Gnuplot;
Can't locate PDL/Graphics/Gnuplot.pm in @INC (you may need to install the PDL::Graphics::Gnuplot module) (@INC contains: perlhome/perl/site/lib perlhome/perl/vendor/lib perlhome/perl/lib) at (eval 61) line 4, <DATA> line 209.
BEGIN failed--compilation aborted at (eval 61) line 4, <DATA> line 209.

Already knowing in advance is no plot installed, proceeding to install gnuplot, first one on the list.

cpan PDL::Graphics::Gnuplot

Upvotes: 1

Views: 254

Answers (1)

armagedescu
armagedescu

Reputation: 2155

I would suggest to skip directly to UPDATE 1, and if doesn't work try from the beginning.

Following suggestion from @Ed, I separated the answer from the question.
As a long try&fail. With assistance from @HåkonHægland.
Note: The documentation for PDL specifies only the step N4 from enumerated here. Everything else is not part of documentation. This discrepancy is not something that is actually expected (!!). When starting perldl I see such a remark:
enter image description here
On a software that pretends to be scientific, this looks rather like an excuse why pdl does not work, and documentation is inconsistent.

##########################################
First solution which worked, but on a clean new Windows 11 laptop did not work, so I don't expect it to work on other clean platform either.
The steps to perform:

  1. Prepare clean new system. Not that critical, the step N3 should be much enough to avoid interference.
  2. Deployed a new clean Perl, latest versions. Probably not that significative, but I unpacked clean new "strawberry-perl-5.32.1.1-64bit-PDL" for windows, zip package, no msi, from strawberry perl. Suppose unpacked here perlhome
  3. In the command line removed the path to gnuplot from system %PATH% variable. If there is no gluplot remnants this step is not required. It can be done globally, or locally in same command line you execute the remaining steps.
  4. Downloaded gnuplot stable zip package mingw edition for windows, from official gnuplot site. Unpacked the bin folder into perlhome\perl\bin, without overwriting existing dlls.
  5. Executed cpan PDL::Graphics::Simple in command line.
  6. Executed cpan PDL::Graphics::Gnuplot in command line.

Note, steps 5 and 6 shown some lwp failures while downloading, but not really critical. The lwp was failing one source, then downloading from alternative resource.

##########################################
Update 1: On a clean new system, Windows 11, but I expect will work for any other system. The steps to perform are similar to above ones, with small difference, add to the path variable the c++ compiler the which comes with the perl package, also step 4, unpacking the gnuplot, must be done at the very end, not before deploying packages from steps 5, 6: The above steps did not work, so do not follow them. Maybe is even better to do the following steps, on a separated system, so you will create a perl+pdl+gnuplot portable, ready to run from a stick or an external drive, or copy and run where it is needed.

  1. The new computer, was already clean
  2. Deployed a new clean from strawberry perl, unpacked "strawberry-perl-5.32.1.1-64bit-PDL" for windows, zip package, no msi. Suppose unpacked here perlhome. Note, this is portable edition+PDL, meaning it is meant to just copy and work, for instance on a memory stick. Set the path to Perl set path=%path%;perlhome\perl\bin if is not added to system.
  3. Strawberry perl comes with C/C++ compiler. perlhome\c\bin, so add it to the environment PATH variable set path=%path%;perlhome\c\bin. Note, using any other external tool may lead, and will lead to abberations during install.
  4. Do nothing, meaning do not unpack gnuplot so far, because it will lead to further failures in deployment of PDL::Graphics::Gnuplot.
  5. Executed cpan PDL::Graphics::Simple in command line.
  6. Executed cpan PDL::Graphics::Gnuplot in command line. So far installation executed successfully, but PDL Graphics still will not work.
  7. Download gnuplot stable zip package mingw edition for windows, from official gnuplot site. Unpacked the bin folder into perlhome\perl\bin, without overwriting existing dlls. Now it works, but I still do not understand why still I see the error about PDL::Graphics::PGPLOT::Window. Using PDL AutoLoader doesn't fix this error. enter image description here

Trying to use cpan to install PDL::Graphics::PGPLOT::Window fails. I must emphasize, I installed gnuplot under Julia and that works exactly as is specified in the documentation, is self sufficient, has no interference with system no matter what. Nothing required to dig in, guess, investigate, documentation is high quality, and so is the support.

Upvotes: 2

Related Questions