Closed moldach closed 5 years ago
Thanks. I know the tests no longer pass with devtools::check()
(but they do with test()
) and will try to debug next week. Your reprex should help so thanks!
Does the error happen too if you create the project not nested in another project, by the way?
And can you confirm that pRojects::createTrainingProject("testProj", external_setup = NULL)
works? Thank you!
The tests of the package pass again so it must be something not covered by tests.
Hi sorry about the delayed response and thanks for your help! I can confirm that the pRojects::createTrainingProject("testProj", external_setup = NULL)
command also produces an error:
✔ Initialising Git repo
✔ Adding '.Rhistory', '.RData' to '.gitignore'
OK to make an initial commit of 7 files?
1: Negative
2: Yes
3: Nope
Selection: 2
✔ Adding files and committing
Error: Error in 'git2r_signature_default': config value 'user.name' was not found
Oops! An error was found and the `testProj` directory was deleted
Error: No root directory found in C:/Users/moldach/Documents/testProj or its parent directories. Root criterion: contains a file `DESCRIPTION` with contents matching `^Package: `
Oops! An error was found and the `testProj` directory was deleted
Error: No root directory found in C:/Users/moldach/Documents/testProj or its parent directories. Root criterion: contains a file `DESCRIPTION` with contents matching `^Package: `
Perhaps this is a naive response but I'm not sure how to create a project not nested in another project... It's my understanding that when you start RStudio fresh and it says Project: (None)
(in the upper-right hand corner) that you are not in a project. Documents
is what I have set as my root
, confirmed by here::here()
? The typical way I would create a new project is via File > New Project ...
.
And this is the latest version of pRojects master branch right? I fixed some things today.
Is there a DESCRIPTION, .git or .RProj right under Documents?
Do you get the error with createBasicProject()
?
Sorry for all the questions! Trying to locate the error.
I downloaded the latest version today via devtools::install_github("stephlocke/pRojects", force = TRUE)
I do not see a DESCRIPTION, .git or .RProj in Documents
I get an error with createBasicProject()
:
> pRojects::createBasicProject("basicProjectTest")
✔ Setting active project to 'C:/Users/moldach/Documents/basicProjectTest'
✔ Setting active project to 'C:/Users/moldach/Documents/basicProjectTest'
✔ Creating 'R/'
✔ Writing 'basicProjectTest.Rproj'
✔ Adding '.Rproj.user' to '.gitignore'
✔ Setting active project to 'C:/Users/moldach/Documents/basicProjectTest'
✔ Writing 'DESCRIPTION'
Unable to connect to MRAN. Skipping some date validations.
Can I create directoryC:/Users/moldach/Documents/basicProjectTest/.checkpointfor internal checkpoint use?
Continue (y/n)? y
✔ Writing 'README.Rmd'
● Add a Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge by adding the following line to your README:
Copying code to clipboard:
[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
✔ Initialising Git repo
✔ Adding '.Rhistory', '.RData' to '.gitignore'
OK to make an initial commit of 5 files?
1: Nope
2: Absolutely not
3: Definitely
Selection: 3
✔ Adding files and committing
Error: Error in 'git2r_signature_default': config value 'user.name' was not found
Oops! An error was found and the `basicProjectTest` directory was deleted
✔ Setting active project to 'C:/Users/moldach/Documents'
Warning message:
Unable to reach MRAN root at http://mran.microsoft.com/snapshot/
Thanks for the troubleshooting. I should point out that I saw the initial error at home on my personal computer but also seeing it at work too (both windows).
Thanks! Can we start by solving the errror in createBasicProject? https://usethis.r-lib.org/articles/articles/usethis-setup.html#configure-user-name-and-user-email
We will solve this 😉
:wave: @moldach! Happy New Year! Could you provide further info so that I might solve the issue? :pray:
Thank you and a very happy, and healthy, New Year too @maelle!
I followed the instructions you provided for the usethis::
setup. Confirming that I had configured user.name
and user.email
on Git, that I could connect to github, stored default values for DESCRIPTION
fields in all new packages, and prepared to build packages from source (i.e. installed Rtools
) but I still get an error:
> pRojects::createBasicProject("basicProjectTest")
✔ Setting active project to 'C:/Users/Matthew/Documents'
New project 'basicProjectTest' is nested inside an existing project'./', which is rarely a good idea.
Do you want to create anyway?
1: Yes
2: Negative
3: Absolutely not
Selection: 1
✔ Setting active project to '<no active project>'
✔ Setting active project to 'C:/Users/Matthew/Documents/basicProjectTest'
✔ Writing 'DESCRIPTION'
Package: basicProjectTest
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
* Matthew Oldach <moldach686@gmail.com> [aut, cre]
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Can I create directoryC:/Users/Matthew/Documents/basicProjectTest/.checkpointfor internal checkpoint use?
Continue (y/n)? y
✔ Writing 'README.Rmd'
✔ Adding Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge to 'README.Rmd'
● Re-knit 'README.Rmd'
✔ Initialising Git repo
✔ Adding '.Rhistory', '.RData', '.Rproj.user' to '.gitignore'
There are 4 files uncommited files:
* '.checkpoint/'
* '.gitignore'
* 'DESCRIPTION'
* 'README.Rmd'
Is it ok to commit them?
1: No
2: Absolutely not
3: I agree
Selection: 3
✔ Adding files
✔ Commit with message 'First commit of this super-excellent project, yow!'
Error: argument is not a character vector
Oops! An error was found and the `basicProjectTest` directory was deleted
✔ Setting active project to 'C:/Users/Matthew/Documents'
Thank you!
git2r
version up to date?git2r
stuff e.g. initialize a repo and commit something?Btw we've just renamed the package starters
because there's a projects
package on CRAN.
I've just been able to reproduce your bug by using the add-in (from @jonmcalder's branch https://github.com/lockedata/starters/pull/101/). You do not get this bug whilst not using the addin right? cc @jonmcalder
I also get the error when running starters::create_basic_project("coolcool", folder = "Documents/locke_data", packagedeps = "none")
directly.
Great, so now I can hope to solve this! Maybe not before next week but now that I can reproduce it, things will be easier. :tada:
I can no longer reproduce the error. For some reason there was an orphan .Rpoj under home/Maelle/ and I deleted it.
@moldach run rprojroot::find_root(usethis:::proj_crit(), path)
where path is the path you want to create the project under.
It should return another path. At that other path look for the things usethis:::proj_crit()
is looking for (a .Rproj, a DESCRIPTION...) and assess whether that's a needed file.
git2r
works - I can initialize repo's, commit, etc.starters::create_basic_project("coolcool", folder = here::here(), packagedeps = "none")
DESCRIPTION
or .Rporj
under my home directory `C:/Users/Matthew/Documents" (I checked for hidden files)When I run rprojroot::find_root(usethis:::proj_crit(), here::here())
I get this error:
Error: No root directory found in C:/Users/Matthew/Documents or its parent directories. Root criterion: one of
- contains a file `.here`
- contains a file matching `[.]Rproj$` with contents matching `^Version: ` in the first line
- contains a file `DESCRIPTION` with contents matching `^Package: `
- contains a directory `.git`
- contains a file `.git` with contents matching `^gitdir: `
- contains a file `remake.yml`
- contains a file `.projectile`
But if you run usethis::create_package it tells you there is a nested project?
usethis::create_package()
does not tell me it's a nested project creates a package and opens a new IDE.
usethis::create_package(here::here())
✔ Setting active project to 'C:/Users/Matthew/Documents'
Overwrite pre-existing file 'DESCRIPTION'?
1: Nope
2: For sure
3: Not now
Selection: 3
✔ Leaving 'C:/Users/Matthew/Documents/DESCRIPTION' unchanged
Overwrite pre-existing file 'Documents.Rproj'?
1: I agree
2: Not now
3: Negative
Selection: 2
✔ Leaving 'C:/Users/Matthew/Documents/Documents.Rproj' unchanged
✔ Opening new project 'Documents' in RStudio
but with starters
you get the question
New project 'basicProjectTest' is nested inside an existing project'./', which is rarely a good idea.
Do you want to create anyway?
?
And doesn't the feedback from usethis
tell you have a DESCRIPTION right under Documents/?
but with
starters
you get the questionNew project 'basicProjectTest' is nested inside an existing project'./', which is rarely a good idea. Do you want to create anyway?
?
Yes that is correct
And doesn't the feedback from
usethis
tell you have a DESCRIPTION right under Documents/?
usethis::create_package()
does not tell me it's a nested project creates a package and opens a new IDE.usethis::create_package(here::here()) ✔ Setting active project to 'C:/Users/Matthew/Documents' Overwrite pre-existing file 'DESCRIPTION'? 1: Nope 2: For sure 3: Not now Selection: 3 ✔ Leaving 'C:/Users/Matthew/Documents/DESCRIPTION' unchanged Overwrite pre-existing file 'Documents.Rproj'? 1: I agree 2: Not now 3: Negative Selection: 2 ✔ Leaving 'C:/Users/Matthew/Documents/Documents.Rproj' unchanged ✔ Opening new project 'Documents' in RStudio
Terribly sorry 🤦 I notice that I must have run this twice! The initial time it actually displayed this:
usethis::create_package(here::here()) ✔ Setting active project to 'C:/Users/Matthew/Documents' ✔ Creating 'man/' ✔ Writing 'DESCRIPTION' ✔ Writing 'NAMESPACE' ✔ Writing 'Documents.Rproj' ✔ Adding '.Rproj.user' to '.gitignore' ✔ Adding '^Documents\.Rproj$', '^\.Rproj\.user$' to '.Rbuildignore' ✔ Opening new project 'Documents' in RStudio
If I delete all those files/folders and run starters::create_basic_project
in root I get the error:
starters::create_basic_project("rocknroll", folder = here::here(), packagedeps = "none") ✔ Setting active project to 'C:/Users/Matthew/Documents/rocknroll' ✔ Setting active project to 'C:/Users/Matthew/Documents/rocknroll' ✔ Creating 'R/' ✔ Writing 'rocknroll.Rproj' ✔ Adding '.Rproj.user' to '.gitignore' ✔ Setting active project to 'C:/Users/Matthew/Documents/rocknroll' ✔ Writing 'DESCRIPTION' ✔ Writing 'README.Rmd' ● Add a Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge by adding the following line to your README: Copying code to clipboard: ✔ Initialising Git repo ✔ Adding '.Rhistory', '.RData' to '.gitignore' OK to make an initial commit of 4 files? 1: No way 2: Yes 3: Negative
Selection: 2
✔ Adding files and committing
Error: argument is not a character vector
Oops! An error was found and the rocknroll
directory was deleted
✔ Setting active project to 'C:/Users/Matthew/Documents'
Thanks.
Trying to find exactly where the problem happens. What happens if you run
starters::create_basic_project("rocknroll", folder = here::here(), packagedeps = "none", external_setup = NULL)
?
For reasons unknown to me I can now reproduce the bug. I do not have a solution yet but here are my notes.
It happens at the usethis::use_git()
stage. Inside usethis::use_git()
it happens usethis:::restart_rstudio()
, more precisely the code failing is
usethis:::in_rstudio(usethis::proj_get())
This code does not fail if I run it from an RStudio project I open. It fails if I have a browser()
whilst running starters
.
I'm going to explore further. I'm imagining it has to do with starters
being run in an RStudio session but not the one corresponding to the project.
Oh and I guess the tests aren't failing... because of the non interactive mode?
@moldach I've found the reason for the error, thanks for the report and your patience!
I've just pushed a quick fix using usethis
internal functions so now
starters::create_basic_project("coolproject", folder = here::here(), packagedeps = "none", external_setup = NULL)
should work.
I'll leave this issue open because in the long term we'll either be able to use usethis::use_git()
again or re-write a use_git()
function using git2r
exported functions instead of usethis
unexported functions.
That's great you were finally able to reproduce this error. Sadly,
starters::create_basic_project("coolproject", folder = here::here(), packagedeps = "none", external_setup = NULL)
does not work (I get the same error).
I knew nothing about debugging before today but this has started to pluck me from my ignorance.
Not sure how to use browser()
yet but I found the error message ("Oops! An error was found and the %s
directory was deleted") in the tryCatch()
statement by searching for it with Ctrl + f
in RStudio with:
debug(starters::create_basic_project)
starters::create_basic_project("rockandroll", folder = here::here(), packagedeps = "none", external_setup = NULL)
Please excuse my ignorance but once you found that code section did you just run every usethis
function in that chunk to find out that the error stemmed from sethis:::in_rstudio(usethis::proj_get())
in browser()
?
so you re-installed the package and still get the exact same error? :crying_cat_face:
yes I looked at the source of the usethis
function and ran each function. Not necessarily a good workflow. I found this talk about debugging quite helpful. https://www.rstudio.com/resources/videos/debugging-techniques-in-rstudio-amanda-gadrow-june-2018/
@moldach what error message do you get before "Oops! An error was found and the %s directory was deleted"? This is the generic error message we output when something went wrong but there should be another message right before it telling you what went wrong. Thank you!
Besides why use folder = here::here()
? This means you explicitely want to create the new project inside the current existing project?
so you re-installed the package and still get the exact same error? 😿
Oops silly me! Of course it's not going to work if don't reinstall 🤦 I'm going to run this from my home computer after work and see if it works, sorry. I will just drop the folder = here::here()
from the command then.
After re-installing the package I'm now getting a new error:
library(starters) starters::create_basic_project("CatchEmAll", packagedeps = "none", external_setup = NULL) ✔ Setting active project to 'C:/Users/Matthew/Documents/CatchEmAll' ✔ Setting active project to 'C:/Users/Matthew/Documents/CatchEmAll' ✔ Creating 'R/' ✔ Writing 'CatchEmAll.Rproj' ✔ Adding '.Rproj.user' to '.gitignore' ✔ Setting active project to 'C:/Users/Matthew/Documents/CatchEmAll' ✔ Writing 'DESCRIPTION' ✔ Writing 'README.Rmd' ● Add a Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge by adding the following line to your README: Copying code to clipboard: Error: object 'ui_done' not found Oops! An error was found and the
CatchEmAll
directory was deleted ✔ Setting active project to 'C:/Users/Matthew/Documents'
Yay new error, progress! :smile_cat:
What do you get if you run usethis:::ui_done("test")
?
usethis:::ui_done("test") ✔ test
And you have starters
and usethis
latest versions, correct? :thinking:
At this point, it might be better to do some screensharing and interactive debugging. @moldach book in some time with me calendly.com/lockedata/office-hours
Thank you for all your help @maelle much appreciated. I'll take you up on the screensharing/debugging @stephlocke. I signed up for the 7:30am January 29th slot.
Hello,
I'm getting errors trying to create a project with the
Addins
featureI'm also getting similar errors when I try via the command line:
Here's under the hood