Installing Perl and PDL - windows

I am currently trying - unsuccessfully to install perl PDL as I would like to automate some of my data analysis and graphics generation.
Unfortunately I seem unable to even install the necessary modules without issue, let alone create a small script to deal with my data files.
I have some rudementary experience with Perl but Nothing fancy and am using Windows 10 x64.
Initially I went for the x64 strawberry perl v5.24 installation, followed by ppm installations of Astro::FITS::Header, Convert::UU, OpenGL and PDL - as instructed here http://pdl.perl.org/?page=install. However, there were issues with the installation of Inline::C and after trying the example listed on page 5 of the PDL_Book_Latest http://sourceforge.net/projects/pdl/files/PDL/2.4.10/PDL-Book-20120205.pdf/download there wasn't any image appearing, nor image file in any location I could think to search. Back to Google and still no luck finding any information on the source of this issue so I decided to go back to square one and use an older version in the hopes that it would be more well documented.
So, uninstallation of strawberry perl through Windows installed programs dialog, deletion of strawberry folder and registry entries containing "strawberry". Then a new installation of perl, with the Padre IDE, v5.14 - maybe some debugging fonctionality will help pinpoint the errors. Started installing the same modules (Astro::FITS::Header, Convert::UU, OpenGL, PGPLOT). Astro and Convert worked fine, but the OpenGL started throwing errors about ExtUtils::F77 which I am apparently missing after a few more hours searching. I go to install this module and it keeps giving errors about 'gfortan' being an unknown command... It was my understanding that the idea of PDL was to avoid fortran and C, and I have found next to no information about this installation problem so far.
So i decided to try an alternative approach. I installed the ppm module from cpan and repeated the initial installation process through the ppm command. This time i get:
"Unknown element 'PROVIDE' found inside SOFTPKG. at C:/Dwimperl/perl/site/lib/PPM.pm line 1462."
So my question is as follows:
Am I missing some critical step in the installation process? Is my system just handing this really badly, and if so is there any sort of possible work around? Is the fact that I tried two different versions liable to create path issues that could be at the root of this problem?
Could anyone provide an alternative and preferably not too complex route to install PDL with a given perl installation on Windows 10?
EDIT 1:
Here is the code for the error I got trying to install Inline::C, an apparent pre-requisite for PDL
code deleted to make space for updates...
EDIT 3:
I reinstalled GnuWin32 in the directory specified by PATH, rather that changing PATH, and the tried the installation again. Inline::C gave the same 'diff' and 'rm' errors. So i ran "cpanm --notest 'package'" to install Inline::C and then PDL, both said they were successful. However, even using '--notest' cpanm could not install OpenGL and PGPLOT.
The final objectif is to be able to produce graphics using the fonctions from PGPLOT: for example
# use PDL;
# use PDL::Graphics::PGPLOT;
# imag(sin(rvals(200,200)+1));
yet this doesn't work of course if PGPLOT can't install.
EDIT 4:
Tried the fix found by #Dr.Avalange at sourceforge https://sourceforge.net/p/pogl/bugs/26/ and noticed that I seem to have multiple copies of this file.
Here
Is this normal...?
EDIT 5:
So i uninstalled perl, deleted any lingering files I could find in %APPDATA%, %USERPROFILE% and C:/DWIM, and then ran ccleaner just in case I missed anything.
I then downloaded Strawberry perl 5.24.1 x64 for Windows and installed it.
After this, I ran 'cpanm Astro::FITS::Header', cpanm 'Convert-UU' and 'cpanm OpenGL' as per http://pdl.perl.org/?page=install. This all worked fine. Then I ran 'cpanm PDL' which installed Inline, Pegex, Win32::Mutex and Module::Compile dependencies. However, if had the same error with Inline::C that you mentioned previously.
I already had GetGnuWin32 installed before so not sure why this isn't working. The Windows 'Path' environment (not PATH - this doesn't exist according to the advaced system dialogue) is noted as
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
In this directory I have the folder GetGnuWin32 which should have installed all the packages from the link you provided, unless there is a supplementary step that I missed to install this correctly? So I redownloaded the DiffUtils setup and ran that, installing to \programfiles(x86) (default option). I then reran 'cpanm PDL'.
I still get the same 'diff' error message. So is DiffUtils, not installing properly? (I did close and re-open the commandline between tries and after the installation)
EDIT 6:
So after installing PDL and PGPLOT with --notest I tried to run the following test and it failed. See below
C:\Windows\system32>perldl
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)
Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)
pdl> use PDL::Graphics//PLplot
Unknown regexp modifier "/P" at (eval 62) line 4, at end of line
Unknown regexp modifier "/L" at (eval 62) line 4, at end of line
Unknown regexp modifier "/t" at (eval 62) line 4, at end of line
BEGIN not safe after errors--compilation aborted at (eval 62) line 5, <DATA> line 207.
pdl> use PDL::Graphics::PLplot
Can't locate PDL/Graphics/PLplot.pm in #INC (you may need to install the PDL::Graphics::PLplot module) (#INC contains: C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at (eval 72) line 5.
BEGIN failed--compilation aborted
pdl> use PDL
pdl> use lib 'C:/Strawberry/perl/site/lib/PDL/Graphics'
pdl> use PGPLOT
pdl> use PDL::Graphics::PGPLOT
pdl> imag(sin(rvals(200,200)+1))
Undefined subroutine &PDL::Graphics::PGPLOT::pgqinf called at C:/Strawberry/perl/site/lib/PDL/Graphics/PGPLOT.pm line 408, <DATA> line 90.
pdl> exit
C:\Windows\system32>cpanm PDL::Graphics::PGPLOT::pgqinf
! Finding PDL::Graphics::PGPLOT::pgqinf on cpanmetadb failed.
! Finding PDL::Graphics::PGPLOT::pgqinf () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution PDL::Graphics::PGPLOT::pgqinf
C:\Windows\system32>cpan PDL::Graphics::PGPLOT::pgqinf
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: CPAN::SQLite loaded ok (v0.211)
Database was generated on Thu, 13 Apr 2017 13:49:14 GMT
C:\Windows\system32>
There was already a directory problem but I managed to point it in th right direction I had thought. Also tried installing the PLplot 'cpanm' said the installation was successful but there is no .pm file, only a .pd in another directory and so the use PDL::Graphics::PLplot fails as there is no .pm file to find.
EDIT: 7
So retrying ppm install http://www.sisyphusion.tk/ppm/PGPLOT.ppd seemed to work this time as the links int he explanation you provided are no longer in use
http://www.kalinabears.com.au/w32perl/pgplot-5.2.2-mingw32.tar.bz2
http://jrfonseca.home.dyndns.org/projects/gnu-win32/software/ported/patches/pgplot-5.2.2-mingw32.diff.gz
And while this seemed to work, there are no traces of the files that were listed as necessary for the installation, unless they were just for this specific method?
pgplot/bin/cpgplot.dll
pgplot/bin/pgplot.dll
pgplot/bin/grfont.dat
pgplot/include/cpgplot.h
pgplot/lib/cpgplot.a
pgplot/lib/pgplot.a
finally, trying the example again gives the following; no errors, but no image either...
Microsoft Windows [version 10.0.14393]
(c) 2016 Microsoft Corporation. Tous droits réservés.
C:\Windows\system32>perldl
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)
Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)
pdl> use PDL
pdl> use PDL::Graphics::PGPLOT
pdl> imag(rvals(200,200)+1)
%PGPLOT, Unable to read font file: grfont.dat
%PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat file.
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...
pdl> $ENV{PGPLOT_FONT} = "C:/Strawberry/perl/site/lib/PGPLOT/pgplot_supp"
pdl> imag(rvals(200,200)+1)
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...
pdl>

After translating from French I can see that you don't have diff in your system. Either install diff (part of gnu32: http://gnuwin32.sourceforge.net/) or just skip the tests. See also:
https://github.com/ingydotnet/inline-c-pm/issues/60
With Strawberry 5.24.1 simply type the following from the command prompt:
cpanm --notest PDL
or if you want to watch everything that's going on:
cpanm -v --notest PDL
This will take some time to run.

Related

Installing toolboxes in Octave

In order to realise some course's activity in Octave, found in the following site
https://nbviewer.org/github/gpeyre/numerical-tours/blob/master/matlab/audio_1_processing.ipynb#
I needed to install some toolboxes found in
http://www.numerical-tours.com/installation_matlab/
Two of them seems to be easily installed via pkg install -forge ... (I have Linux Mint 19), these toolboxes are 'general' and 'signal', but 'graph' and 'wavelet_meshes' seems not to be directly available for Octave.
1 - So, if I downloaded them manually.. how should I install these packages? I do not even find Octave directory using 'whereis' in order to localise a proper folder to throw toolboxes files (its path shown located in /app/share/octave when open).
2 - Another thing.. should I spect to use toolboxes automatically after toolbox is installed? or may I indicate its selection in some specific way? ..I ask this because after running the following script chunk
n = 1024*16;
options.n = n;
[x,fs] = load_sound('bird', n);
command window throws the following message
error: 'load_sound' undefined near line 3, column 4
so I understand Octave does not recognises 'load_sound' function, which is from 'signal' toolbox (that is already installed).
Any suggestions?

Octave: error installing package on Windows

First of all, I know a lot of questions similar to mine have been asked, and nevertheless they don't help me solve the problem I'm facing. I'm running Octave 5.1.0.0 on Windows 10 Pro 64 bit. I'm having no issues but one: when I try to install Symbolic package by pkg install symbolic-2.7.1.tar.gz (downloaded from Octave Forge), I get the error
unpack: unarchiving program exited with status: 1
tar: Error opening archive: Failed to open
'/C/Users/smlvcfncst/Downloads/symbolic-2.7.1.tar.gz'
error: called from
unpack at line 274 column 5
untar at line 48 column 5
install at line 81 column 9
pkg at line 441 column 9
and I have no clue where the problem related to the unpacking could be. Not only I have 7z and Winrar installed, but moreover I use a full installation of Cmder, so my system has everything that is needed to work with a .tar.gz
I've tried in different terminals, both with and without administrator privileges, and the problem persists. How should I proceed then?
EDIT: Following Andy's suggestion, I let you know that even before installing Octave I already have installed and used both Python and MinGW, as well as sympy module. Moreover, my Octave installation was the most standard possible for Windows, that is using the official .exe installer. No other package, apart from those included with installation, have been added before I tried adding symbolic.
Thank you in advance.

Fault in reticulate in rstudio

476/5000
rstudio generates error when running R code with python code. At first the code worked very well but in the second installation it started to generate faults. Here is the link of the code in case you want to play #https: //www.r-bloggers.com/r-and-python-using-reticulate-to-get-the-best-of-both-worlds/
. My laptop is hp 4 gigs of ram and 500 mb of hard disk.
I would greatly appreciate who can explain the failure and how to solve it.
I have reinstalled anaconda last version twice.
library(reticulate)
use_python("/usr/local/bin/python")
use_virtualenv("r-reticulate")
os <- import("os")
Error: lexical error: invalid char in json text.
WARNING: The conda.compat modul
(right here) ------^
os$listdir(".")
Error: object 'os' not found
py_config()
Error: lexical error: invalid char in json text.
WARNING: The conda.compat modul
(right here) ------^
Actually, it comes from a deprecation warning reported a few days ago (fix compat import showing warning #8507).
But the fact is that this warning in "conda.compat" generates some errors, for example in the case of using conda environments in R through "reticulate" functions. This issue has been reported quite recently Conda warnings taken as errors #477.
The solution is to simply install the github version of "reticulate" in order to avoid these errors and ignore the conda warnings which shouldn't necessarily impede these functionalities. You can do it like this way:
remotes::install_github("rstudio/reticulate")
And don't forget to have the latest Rtools installed in your operating system!
This might be useful for you: https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/
I have Anaconda, and set up Python 2 environment. Once activated, run 'use_python' with the path to that environment and set the 'required' parameter to TRUE.
I had the same problem. I solved the problem by installing an older version of conda.
In anaconda promt
conda install conda = 4.1.6

On Windows, packages installed with cabal seem to be unavailable in ghc/ghci

I'm running the latest version of Haskell Platform 8.6.3 on a fairly standard Windows 10 x64 system.
Now I am at my wits end getting packages installed from Hackage to work reliably. Attributing my issues to local configuration problems, I've taken all steps short of nuking my Windows installation. I have uninstalled and reinstalled Hackage, rebooted, scoured every last configuration file I could in any hidden directory or otherwise, deleted every registry key apparently related to Haskell, most of them multiple times, all to no avail:
Packages installed with cabal just don't appear to be available under ghci, WinGHCI, either to be loaded interactively with (:m) under ghci or when compiling using ghc under WinGHCI, no matter what I do.
Below are some symptoms. Any suggestions?
#cabal new-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal new-update 'hackage.haskell.org,2019-04-02T19:24:19Z'
#cabal new-install --lib vector
Resolving dependencies...
Up to date
#ghci
Prelude> :m Data.Vector
<no location info>: error:
Could not find module ‘Data.Vector’
Perhaps you meant Data.Functor (from base-4.12.0.0)
#ghc -O -optc-O3 -funfolding-use-threshold=16 -fexcess-precision -Wall -Wno-type-defaults -Wno-unused-imports -Wno-unused-top-binds -rtsopts "P663.hs"
[1 of 1] Compiling Main ( P663.hs, P663.o )
P663.hs:54:1: error:
Could not find module ‘Data.Vector.Unboxed’
Use -v to see a list of the files searched for.
|
54 | import Data.Vector.Unboxed (Vector, (!)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
#ghc-pkg list --user-package-db=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
primitive-0.6.4.0
vector-0.12.0.2
#set GHC_PACKAGE_PATH=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db;
#ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
C:\Users\Carl\AppData\Roaming\ghc\x86_64-mingw32-8.6.3\package.conf.d
(no packages)
C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
primitive-0.6.4.0
vector-0.12.0.2
# ghci
GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
Prelude> :m Data.Vector
Prelude Data.Vector> toList $ empty
Access violation in generated code when reading 0xffffffffffffffff
Attempting to reconstruct a stack trace...
Frame Code address
* 0x7e5dd90 0x3d7d618 C:\Program Files\Haskell Platform\8.6.3\bin\ghc.exe+0x397d618
So it looks like you solved your problem by setting GHC_PACKAGE_PATH, right? You might wish to file a bug about that.
The second issue, the runtime "Access violation in generated code when reading" error seems to be documented here:
https://github.com/commercialhaskell/stack/issues/3765
https://gitlab.haskell.org/ghc/ghc/issues/13112
Supposedly passing -fexternal-interpreter to ghci is a workaround. You might want to manually edit the ghc/ghci shim scripts to ensure the flag is always passed until the bug can be fixed.
Thanks for all the responses. I've experimented both with running ghc on some version of UN*X under VirtualBox and uninstalling Haskell Platform and going purely with stack under Windows 10 x64.
Both seem to avoid the many issues I listed above, but stack under Windows seems a little more light-weight and integrates better with my preferred editors (Sublime Text and Visual Studio Code), so that is what I'm going with for now.
In the meantime, with all due gratitude for all the great, free work done by the Haskell Platform guys and the author of WinGHCI, I cannot urge anybody reading this strongly enough to stay away from it, in particular version 8.6.3 under Windows, at least until things are much improved.

Python 3 installation, additional to existing Python 2 on Windows: Fatal Python error: Py_Initialize: unable to load the file system codec

Sorry if this is a re-post. I have been searching for hours and there are a lot of similar problems, but they are not exactly the same as my issue.
I have been working with Python27 on my 64bit Windows for a while now and I would like to install Python 3 in parallel.
I downloaded and executed the installation .exe of Python 3.5 for 64bit Windows. The installation worked without any errors and added C:/Python35 to the Windows PATH variable.
However, when I click on python.exe in the directory C:\Python35, instead of launching a python 3.5 shell as it's supposed to do, it pops up a Window saying
Python has stopped working
Also there is a command shell saying:
Fatal Python error: Py_Initialize: unable to load the file system
codec File "C:\Python27\Lib\encodings__init__.py", line 123
raise CodecRegistryError,\
^ SyntaxError: invalid syntax
Current thread 0x00001ce0 (most recent call first):
So appearently Python 3.5 is using the Lib directory of Python 2.7. This is probably related to the PYTHONPATH variable that is set to
C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
When I change the PYHTONPATH variable to
C:\Python35;C:\Python35\Lib;C:\Python27\DLLs;C:\Python35\Lib\lib-tk
Python 3.5 works, but Python 2.7 throws the error above.
Is there any way to permanently define that the command "python3" uses one PYTHONPATH and the command "python2" uses another PYTHONPATH?
Copying python.exe and renaming it to python3.exe didn't help. Neither did uninstalling and installing Python 3.5 again.
I have a lot of old jupyter notebooks that are written in Python 2.7 and it would be great if I could continue to use them by choosing different kernels (see here).

Resources