Re: [R-pkg-devel] CRAN submission struggle

2023-12-29 Thread Greg Hunt
Christaan,
The elapsed time note is because CRAN expects that examples will be
configured to run single threaded and some package that you use, or a
package used by a package that you use is multi-threading by default and
using more CPU time than clock time. If you cannot figure out how to
reconfigure the multi-threaded package, a number of people have found that
the simplest thing to do is disable running the example (which reduces the
effective test coverage provided by the example).

I haven’t encountered the miktex exception file before but i suspect its a
side effect of a miktex error. Packages should not leave files behind in
the temp directory. If you expect a miktex error you need to remove the
file. If you don’t you need to track down and fix or work around the bug.
The build process is really a quality check on your package.

Greg

On Fri, 29 Dec 2023 at 3:01 am, Christiaan Pieterse <
pietie.cjp.1...@gmail.com> wrote:

> Hi,
>
> Thank you for showing the difference in the ExampleTradeData. I've fixed
> this by adding a .Gitignore file and a "data-raw" folder to load the
> ExampleTradeData. I hope I did this correctly. When I check the package (
> https://github.com/WoutersResearchGroup/R-IO-PS/tree/CRAN-prep) in
> RStudio.
> I only get 3 notes (see below), and if I run it in PositCloud, it crashes
> or yields the same 1 ERROR and 2 NOTES result as before. Why might this be?
> Is it a problem or is it fine if I continue working in RStudio since I
> cannot increase the specs in PositCloud because I'm working on a research
> group account?
>
> Here are the 3 notes I receive in RStudio:
>
> The first is the expected New Submission Note.
>
> The second is the runtime that is too long:
> * checking examples ... [43s] NOTE
> Examples with CPU (user + system) or elapsed time > 5s
>   user system elapsed
> IOPS 10.06   3.35   35.04
> How can I reduce this time? I'm not sure how to reduce the size of my
> ExampleTradeData without the check giving errors when running the example.
>
> The third note I am unsure what it means:
> * checking for detritus in the temp directory ... NOTE
> Found the following files/directories:
>   'lastMiKTeXException'
>
> Kind regards
> Christiaan
>
> On Thu, 28 Dec 2023 at 15:55, Ivan Krylov  wrote:
>
> > Hi Christiaan,
> >
> > В Thu, 28 Dec 2023 14:57:55 +0200
> > Christiaan Pieterse  пишет:
> >
> > > Still, I couldn't figure out why I ran into this problem, so I
> > > created a test file called "Test Example.R" (available at the same
> > > GitHub repository:
> > > https://github.com/WoutersResearchGroup/R-IO-PS/tree/CRAN-prep).
> >
> > I see you're always adding or updating files to the GitHub repo by
> > means of uploading. While that's certainly one way to use GitHub, it's
> > combines the least convenient aspects of two approaches to using GitHub.
> >
> > With GitHub purely in the browser, GitHub is just a website where you
> > keep and edit code, running nothing else on the local computer. Code
> > can be run in Codespaces or using GitHub Actions. Microsoft will want
> > to be paid money to run code on their computers.
> >
> > With GitHub as a Git remote, there is a local checkout [*] that's kept
> > in sync with GitHub by means of commits [**] and pushes [***], letting
> > you create meaningful, describable snapshots of changes in your code
> > spanning multiple files at the same time.
> >
> > Right now, it probably feels like Dropbox but worse.
> >
> > > This file creates the function in the global environment (note that
> > > this is the same function code as available in the package
> > > "R/iopspackage2.0.R" file), and then runs this function with the same
> > > example as in the package (If you want to try this yourself, just
> > > load the data/ExampleTradeData.rda in before running the Test Example
> > > file). This test file yields no errors when I run it and produces the
> > > correct results. When I then proceed to build and check the package,
> > > it yields the same example error as before. I do not understand why
> > > or what could cause this issue.
> >
> > The difference is in the ExampleTradeData variable, which "Test
> > Example.R" doesn't define.
> >
> > With data(ExampleTradeData), the script works.
> >
> > With ExampleTradeData <-
> >
> >
> read.csv(system.file("extdata","ExampleTradeData.csv",package="iopspackage")),
> > the script fails exactly the same way as example(IOPS) does.
> >
> > > I'm not sure if I should send out another email to the developers to
> > > see if someone else spots something I'm not seeing.
> >
> > It may help to keep Cc: r-package-devel@r-project.org in the e-mails
> > for the search engines to index the potential solutions in the mailing
> > list archives.
> >
> > --
> > Best regards,
> > Ivan
> >
> > [*]
> > https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
> >
> > [**]
> >
> >
> https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
> >
> > [***]
> > https://git-scm.com/book/en/

Re: [R-pkg-devel] CRAN submission struggle

2023-12-29 Thread Ivan Krylov
On Thu, 28 Dec 2023 18:00:37 +0200
Christiaan Pieterse  wrote:

> I only get 3 notes (see below), and if I run it in PositCloud, it
> crashes or yields the same 1 ERROR and 2 NOTES result as before. Why
> might this be? 

Does the PositCloud check crash with "Killed" (most likely out of RAM)
or with a different error message?

> Is it a problem or is it fine if I continue working in RStudio since
> I cannot increase the specs in PositCloud because I'm working on a
> research group account?

If your local R CMD check works, it should be fine. Rough
specifications for the machines running CRAN checks can be found at
. We ought to
test our packages on the weakest hardware that could plausibly be used
to run our code, but that's not always easy to do. I know I don't
always dig out my old Intel Atom ultraportable to run the checks myself.

> The second is the runtime that is too long:
> * checking examples ... [43s] NOTE
> Examples with CPU (user + system) or elapsed time > 5s
>   user system elapsed
> IOPS 10.06   3.35   35.04

Similar NOTEs can be seen about the use of multi-threading, but here
the "elapsed" (real, as measured by a clock) time exceeds the "user"
(CPU time spent inside applications) + "system" (CPU time spent inside
the operating system kernel) time, so the code uses less than 100% of
one CPU core on average, which fits comfortably in the 200% allowed by
the CRAN policy for examples and tests.

Unfortunately, 35 seconds is still too much.

> How can I reduce this time? I'm not sure how to reduce the size of my
> ExampleTradeData without the check giving errors when running the
> example.

How does the algorithm work? I've seen it fail due to Proximities being
a 0x0 matrix. Can you work backwards from
economiccomplexity::proximity() returning a 0x0 matrix to derive the
requirements that IOPS places on the dataset? It may help to experiment
with sample.int() to subset the rows and see which combinations work.
Perhaps you can reduce the dataset to two countries and two products?

Have you tried profiling? You can profile your code for both speed and
memory use, and replacing less performant idioms with those using less
CPU time and memory may solve both the CPU time problem and the
OOM-crash problem:
https://cran.r-project.org/doc/manuals/R-exts.html#Tidying-and-profiling-R-code
 
> The third note I am unsure what it means:
> * checking for detritus in the temp directory ... NOTE
> Found the following files/directories:
>   'lastMiKTeXException'

Have you installed the inconsolata MiKTeX package?
https://cran.r-project.org/doc/manuals/R-admin.html#LaTeX-on-Windows
Try running R CMD Rd2pdf on your package directory: maybe MiKTeX will
pop up an interactive dialog to let you install any remaining missing
dependencies. If not, there should be a lastMiKTeXException file for
you to read.

-- 
Best regards,
Ivan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] CRAN submission struggle

2023-12-29 Thread Uwe Ligges



On 28.12.2023 17:00, Christiaan Pieterse wrote:

Hi,

Thank you for showing the difference in the ExampleTradeData. I've fixed
this by adding a .Gitignore file and a "data-raw" folder to load the
ExampleTradeData. I hope I did this correctly. When I check the package (
https://github.com/WoutersResearchGroup/R-IO-PS/tree/CRAN-prep) in RStudio.
I only get 3 notes (see below), and if I run it in PositCloud, it crashes
or yields the same 1 ERROR and 2 NOTES result as before. Why might this be?
Is it a problem or is it fine if I continue working in RStudio since I
cannot increase the specs in PositCloud because I'm working on a research
group account?

Here are the 3 notes I receive in RStudio:

The first is the expected New Submission Note.

The second is the runtime that is too long:
* checking examples ... [43s] NOTE
Examples with CPU (user + system) or elapsed time > 5s
   user system elapsed
IOPS 10.06   3.35   35.04
How can I reduce this time? I'm not sure how to reduce the size of my
ExampleTradeData without the check giving errors when running the example.


Use a subset of the data or less iterations?
If this fails for you, then we need code to reproduce...



The third note I am unsure what it means:
* checking for detritus in the temp directory ... NOTE
Found the following files/directories:
   'lastMiKTeXException'


This can typically be ignored.

Best,
Uwe Ligges



Kind regards
Christiaan

On Thu, 28 Dec 2023 at 15:55, Ivan Krylov  wrote:


Hi Christiaan,

В Thu, 28 Dec 2023 14:57:55 +0200
Christiaan Pieterse  пишет:


Still, I couldn't figure out why I ran into this problem, so I
created a test file called "Test Example.R" (available at the same
GitHub repository:
https://github.com/WoutersResearchGroup/R-IO-PS/tree/CRAN-prep).


I see you're always adding or updating files to the GitHub repo by
means of uploading. While that's certainly one way to use GitHub, it's
combines the least convenient aspects of two approaches to using GitHub.

With GitHub purely in the browser, GitHub is just a website where you
keep and edit code, running nothing else on the local computer. Code
can be run in Codespaces or using GitHub Actions. Microsoft will want
to be paid money to run code on their computers.

With GitHub as a Git remote, there is a local checkout [*] that's kept
in sync with GitHub by means of commits [**] and pushes [***], letting
you create meaningful, describable snapshots of changes in your code
spanning multiple files at the same time.

Right now, it probably feels like Dropbox but worse.


This file creates the function in the global environment (note that
this is the same function code as available in the package
"R/iopspackage2.0.R" file), and then runs this function with the same
example as in the package (If you want to try this yourself, just
load the data/ExampleTradeData.rda in before running the Test Example
file). This test file yields no errors when I run it and produces the
correct results. When I then proceed to build and check the package,
it yields the same example error as before. I do not understand why
or what could cause this issue.


The difference is in the ExampleTradeData variable, which "Test
Example.R" doesn't define.

With data(ExampleTradeData), the script works.

With ExampleTradeData <-

read.csv(system.file("extdata","ExampleTradeData.csv",package="iopspackage")),
the script fails exactly the same way as example(IOPS) does.


I'm not sure if I should send out another email to the developers to
see if someone else spots something I'm not seeing.


It may help to keep Cc: r-package-devel@r-project.org in the e-mails
for the search engines to index the potential solutions in the mailing
list archives.

--
Best regards,
Ivan

[*]
https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository

[**]

https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

[***]
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes



[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel