On 2022-02-14 at 01:07:55 +0000, Ed . wrote:
> Hi all,
> 
> I’ve just uploaded 2.020 of PDL::Graphics::Gnuplot featuring Zaki’s excellent 
> fix for this problem.
> 
> Ingo, if your users were to use perlbrew to have an individual Perl 
> installation and set of libraries, then they would have much greater 
> reproducibility of results as only they could update them. I gather 
> reproducibility of results is considered a good thing in science ;-)

Hello everyone,

For some aspects of reproducibility, I like Carton. The
`cpanfile.snapshot` file can be checked into the repo for the final
research output. Though a complete approach to reproducibility would
also save the versions of all the underlying libraries (including
non-Perl libraries*). I have not seen a non-container tool for this that
does not force you into using a specific package manager. Containers do
everything, but then you have the added complexity and storage
requirements of containers.

But if you must install modules that are shared with others, you can:

a) create a local::lib/Carton directory in a location that is readable
   by all that need it (this can be per-project),

b) or if you must install into the system Perl @INC (`perl -V:installsitelib`),
   instead of doing `sudo cpanm My::Module`, use `cpanm --sudo My::Module`.
   That way the tests are run as your user and root privileges are only
   used for `make install`.

Cheers,
- Zaki Mughal

* This is a real problem I've had where I had installed a newer version
  of library and my collaborator had an older one. The code changed
  between versions and we were getting different results. I had to track
  this down by looking at changes in the upstream code.

> 
> Best regards,
> Ed
> 
> From: Zakariyya Mughal<mailto:zaki.mug...@gmail.com>
> Sent: 13 February 2022 23:39
> To: Ingo Schmid<mailto:ingo...@gmx.at>
> Cc: David Mertens<mailto:dcmertens.p...@gmail.com>; Ed 
> .<mailto:ej...@hotmail.com>; 
> pdl-devel@lists.sourceforge.net<mailto:pdl-devel@lists.sourceforge.net>
> Subject: Re: [Pdl-devel] PDL::Graphics::Simple
> 
> On 2022-02-13 at 23:16:12 +0100, Ingo Schmid wrote:
> > Well, it is several machines for several users, not that many. We don't
> > have formal admins and developers, we just do. It's called science. ;)
> > And I have used it for years and this is one of the rare occasions where
> > it causes troubles.
> >
> > Out of curiosity, how do manage modules?
> 
> Hello Ingo,
> 
> I have put together a PR that should work around this specific issue so
> that the tests pass: 
> <https://github.com/PDLPorters/PDL-Graphics-Gnuplot/pull/82>.
> 
> As for managing modules, I use perlbrew + local::lib because I have to
> test against various versions of Perl.
> 
> I have also been using <https://metacpan.org/pod/App::plx> lately to
> easily switch between different combinations of Perl + Perl modules (but
> have not used it as much as I would like to). This helps consolidate
> uses of local::lib and Carton into a single command.
> 
> The tension between running tests as root and security is something that
> can come up with other modules. For example, I have a module that I have
> not yet put on CPAN that will never be testable as root since it
> controls a GUI that uses Chromium internally and because Chromium has
> a sandbox that refuses to run with root privileges, it exits before I
> can run the tests.
> 
> Best regards,
> - Zaki Mughal
> 
> >
> > Ingo
> >
> > On 2/13/2022 10:11 PM, David Mertens wrote:
> > > Ingo,
> > >
> > > It sounds like you are the system administrator for your machines?
> > > That is the only situation in which I would consider using sudo cpanm.
> > >
> > > David
> > >
> > > On Sun, Feb 13, 2022 at 11:11 AM Ingo Schmid <ingo...@gmx.at> wrote:
> > >
> > >     Hi Ed,
> > >
> > >     I see what you mean. But then it is just me having access to those
> > >     modules and not other users. Are you suggesting it is best
> > >     practice to install perl modules per user? That requires a lot of
> > >     redundant work if you have a group using the software.
> > >
> > >     I suppose in the particular case, catching an empty
> > >     XDG_RUNTIME_DIR and setting to some temp directory would resolve
> > >     the issue.
> > >
> > >     Best wishes Ingo
> > >
> > >     On 2/13/2022 2:26 PM, Ed . wrote:
> > >>
> > >>     Hi Ingo,
> > >>
> > >>
> > >>
> > >>     cpanm is certainly the best tool for installing Perl modules! But
> > >>     if you’re in a package-managed environment and want to use the
> > >>     system Perl (which is understandable, it’s very stable), then
> > >>     current best practice is to not install any non-package-managed
> > >>     modules in the system location. Instead, you should use a
> > >>     local::lib as Zaki said, so that your personally-installed
> > >>     modules overlay any system ones. In particular, if you find
> > >>     yourself using “sudo” to install Perl modules off CPAN, that is a
> > >>     sign of poor practice.
> > >>
> > >>
> > >>
> > >>     Another benefit of this strategy is that because you install
> > >>     modules as your normal user, it has access to all your normal
> > >>     environment. There are also security benefits.
> > >>
> > >>
> > >>
> > >>     Best regards,
> > >>
> > >>     Ed
> > >>
> > >>
> > >>
> > >>     *From: *Ingo Schmid <mailto:ingo...@gmx.at>
> > >>     *Sent: *13 February 2022 09:09
> > >>     *To: *Zakariyya Mughal <mailto:zaki.mug...@gmail.com>;
> > >>     pdl-devel@lists.sourceforge.net
> > >>     *Subject: *Re: [Pdl-devel] PDL::Graphics::Simple
> > >>
> > >>
> > >>
> > >>     Hi Zaki,
> > >>
> > >>     thank you for the suggestion. Yes, that is exactly the issue. The
> > >>     question to me is rather, if this is desired. Who runs an X
> > >>     session as
> > >>     root ?
> > >>
> > >>     Isn't using cpanm the way to maintain Perl modules these days? I will
> > >>     open an issue and I have a hunch this could easily be caught
> > >>     during build.
> > >>
> > >>     Ingo
> > >>
> > >>     On 2/12/2022 12:59 AM, Zakariyya Mughal wrote:
> > >>     > On 2022-02-11 at 10:49:12 +0100, Ingo Schmid wrote:
> > >>     >> Hi,
> > >>     >>
> > >>     >> the other mail made me aware of P:G:S, now I was doing
> > >>     >>
> > >>     >> #> sudo cpanm PDL::Graphics::Simple
> > >>     >>
> > >>     >> on Debian testing and during make test I received this error
> > >>     after the
> > >>     >> label plot is shown:
> > >>     >>
> > >>     >> Gnuplot error: "QStandardPaths: XDG_RUNTIME_DIR not set,
> > >>     defaulting to
> > >>     >> '/tmp/runtime-root'" while sending final multiplot command. at
> > >>     >> /usr/local/share/perl/5.32.1/PDL/Graphics/Gnuplot.pm line
> > >>     4346, <STDIN>
> > >>     >> line 7.
> > >>     >>     PDL::Graphics::Gnuplot::multiplot(undef, "layout",
> > >>     >> ARRAY(0x55c8040dbb08)) called at
> > >>     >>
> > >>     
> > >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple/Gnuplot.pm
> > >>     >> line 360
> > >>     >>
> > >>      
> > >> PDL::Graphics::Simple::Gnuplot::plot(PDL::Graphics::Simple::Gnuplot=HASH(0x55c8040e2378),
> > >>     HASH(0x55c8040f5910), ARRAY(0x55c80410c888)) called at
> > >>     
> > >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> > >>     line 1044
> > >>     >>
> > >>      
> > >> PDL::Graphics::Simple::plot(PDL::Graphics::Simple=HASH(0x55c8040ede58),
> > >>     "with", "image", PDL=SCALAR(0x55c8040d3e58)) called at
> > >>     
> > >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> > >>     line 1127
> > >>     >>     PDL::Graphics::Simple::_convenience_plot("image",
> > >>     >> PDL::Graphics::Simple=HASH(0x55c8040ede58),
> > >>     PDL=SCALAR(0x55c8040d3e58),
> > >>     >> HASH(0x55c8040edae0), HASH(0x55c8040d3e88)) called at
> > >>     >>
> > >>     
> > >> /root/.cpanm/work/1644572352.1118703/PDL-Graphics-Simple-1.007/blib/lib/PDL/Graphics/Simple.pm
> > >>     >> line 1143
> > >>     >>
> > >>      
> > >> PDL::Graphics::Simple::image(PDL::Graphics::Simple=HASH(0x55c8040ede58),
> > >>     PDL=SCALAR(0x55c8040d3e58), HASH(0x55c8040edae0)) called at
> > >>     t/simple.t line 145
> > >>     >>
> > >>     >> Have you got any ideas?
> > >>     >> Ingo
> > >>     >
> > >>     > Hello Ingo,
> > >>     >
> > >>     > Since you are using `sudo` to install, it is using the root user's
> > >>     > environment (actually a reduced environment that `sudo`
> > >>     creates*) which
> > >>     > does not have `XDG_RUNTIME_DIR` set. Gnuplot needs to have
> > >>     > `XDG_RUNTIME_DIR` set in order to run during the dist's tests.
> > >>     You can
> > >>     > set the variable to a temporary directory:
> > >>     >
> > >>     >   sudo bash -c 'XDG_RUNTIME_DIR=$(mktemp -d) cpanm --test-only
> > >>     PDL::Graphics::Simple'
> > >>     >
> > >>     > I would recommend installing packages to a `local::lib` instead
> > >>     of using `sudo`.
> > >>     >
> > >>     > Best regards,
> > >>     > - Zaki Mughal
> > >>     >
> > >>     > * Run `sudo env` to see what is set.
> > >>     >
> > >>     >> _______________________________________________
> > >>     >> pdl-devel mailing list
> > >>     >> pdl-devel@lists.sourceforge.net
> > >>     >> https://lists.sourceforge.net/lists/listinfo/pdl-devel
> > >>
> > >>
> > >>     _______________________________________________
> > >>     pdl-devel mailing list
> > >>     pdl-devel@lists.sourceforge.net
> > >>     https://lists.sourceforge.net/lists/listinfo/pdl-devel
> > >>
> > >>
> > >>
> > >     _______________________________________________
> > >     pdl-devel mailing list
> > >     pdl-devel@lists.sourceforge.net
> > >     https://lists.sourceforge.net/lists/listinfo/pdl-devel
> > >
> > >
> > >
> > > --
> > >  "Debugging is twice as hard as writing the code in the first place.
> > >   Therefore, if you write the code as cleverly as possible, you are,
> > >   by definition, not smart enough to debug it." -- Brian Kernighan
> 


_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to