Struggle getting PDL book example to work on Windows 10
Encouraged by Enkidu I decided to write a little about my unsuccessful trial to run PDL Book example on Windows. It all started in December 2019 as I decided to learn Perl and looked for a way to create SVM (Support Vector Machine) model with it as I am able to do similar tasks in R or Python. As a side effect and to my surprise I have found that there exists such a thing as Perl Data Language (PDL) that has many modules suited for data science.
Intrigued by PDL I have installed Strawberry Perl 5.30.1.1 PDL edition. I followed first steps from PDL book and tried to install PDL::Graphics::Simple. Just ran typical installation with cpan and got an error:
Test Summary Report
-------------------
t/simple.t (Wstat: 1536 Tests: 85 Failed: 6)
Failed tests: 5, 73-74, 78, 80, 82
Non-zero exit status: 6
Files=1, Tests=85, 2 wallclock secs ( 0.05 usr + 0.00 sys = 0.05 CPU)
Result: FAIL
Failed 1/1 test programs. 6/85 subtests failed.
gmake: *** [Makefile:871: test_dynamic] Error 6
-> FAIL Installing PDL::Graphics::Simple failed.
I got a suggestion at perlmonks that I might try to skip tests with cpanm --notest. Well ... it did not help either as I got stuck with the first example: imag(sin(rvals(200,200)+1)). I got errors that all known plotting engines failed:
Trying gnuplot ...... Gnuplot exists but yours doesn't support either the x11 or wxt terminal
Trying pgplot ...... nope
Trying plplot ...... nope
Trying prima ...... nope
I tried to install PDL::Drawing::Prima separately with cpanm but it failed too. I found a build.log file and apparently some test failed:
Test Summary Report
-------------------
t/Widget/Mouse.t (Wstat: 256 Tests: 10 Failed: 1)
Failed test: 10
Non-zero exit status: 1
Files=43, Tests=8516, 40 wallclock secs ( 1.00 usr + 0.42 sys = 1.42 CPU)
Result: FAIL
Failed 1/43 test programs. 1/8516 subtests failed.
gmake: *** [Makefile:1765: test_dynamic] Error 255
-> FAIL Installing Prima failed. See C:\sw\pdl\data\.cpanm\work\1581777650.11760\build.log for details. Retry with --force to force install it.
-> FAIL Installing the dependencies failed: Module 'Prima' is not installed
-> FAIL Bailing out the installation for PDL-Drawing-Prima-0.12.
So I thought: what about other plotting modules? I ran cpanm PDL::Graphics::PLplot and it was written that the module was successfully installed! Maybe the PDL book example will work now? And the answer is ... Nope!
And in case of PDL::Graphics::PGPLOT::Window - it is written that a module is up to date...
As a workaround I was able to run an example on dual booted Linux and did not delve more deeply what was wrong on Windows as I wanted to learn more of Perl basics first and started reading Llama book.
I Guess you need to install an X server in order to pass these tests.
You need to install Prima without tests if it gives you headaches. However PDL::Drawing::Prima is old and won't compile. I've sent a pull request that fixed it (check on github)
Dmitry, thank you for help, I was able to run an example with Prima!
Plot was generated, but somehow on the top I see PDL/Prima (Not Responding) and if I move the cursor on the top of the plot I see that the cursor is spinning constantly.
What I have done was this:
1. Downloaded dk/PDL-Drawing-Prima from Github. Extracted it to folder C:\sw\pdl\cpan\build
2. Opened shell by clicking portableshell.bat in C:\sw\pdl\. Used shell to navigate to the folder that was extracted from zip file.
3. From shell ran these commands to install PDL::Drawing::Prima:
perl Build.PL
Build
Build test
Build install
4. Installed PDL::Graphics::Prima with cpanm.