Skip to content

Allow location of project .Rproj.user folder to be configured by user #14778

Closed

Description

@kevinushey

A number of users have reported trouble related to RStudio's attempts to read / write content in the project's .Rproj.user folder. This includes, broadly:

  • Slow networked filesystems, where the repeated accesses made by RStudio are prohibitively slow;
  • Tools like Google Drive / Dropbox might lock files for editing in the .Rproj.user folder, leading to unexpected errors when saving files.

We should make it possible for users to configure the .Rproj.user directory location.


Activity

  1. added
    new
    on Jun 3, 2024
  2. added and removed
    new
    on Jun 5, 2024
  3. added this to the Cranberry Hibiscus milestone on Jun 17, 2024
  4. ronblum commented on Jun 17, 2024

    @ronblum
    Contributor

    Initial implementation might be limited to RStudio Desktop.

  5. added
    remote storage
    on Jun 25, 2024
  6. ronblum commented on Jun 25, 2024

    @ronblum
    Contributor

    The option for changing the scratch path location isn't in the project options:
    scratch

  7. ronblum commented on Jun 25, 2024

    @ronblum
    Contributor

    The was the previous build (2024.07.0-daily+245). The new build (2024.07.0-daily+250) has it. Gonna test it.

  8. ronblum commented on Jun 27, 2024

    @ronblum
    Contributor

    A few things:

    1. When I saved in a location that's under the home directory using ~, a directory called ~ is created in the project directory.
      Image
    2. We might want to change "Project scratch path" to something else. I'm not sure that people will know what scratch refers to. Should I open a separate issue for this, or leave it be?
  9. ronblum commented on Jul 9, 2024

    @ronblum
    Contributor

    Verified no more ~ directories in RStudio Desktop 2024.07.0-daily+303 on Windows 11.

  10. remlapmot commented on Sep 25, 2024

    @remlapmot

    Thanks so much for adding this new configuration to RStudio Desktop and Server. You might like to know another use case it fixes. When running rstudio-server from a Docker image which is writing to a directory on a Windows 11 Dev Drive (ReFS file system) having the .Rproj.user directory on the Dev Drive shows an error/warning every few seconds such as

    rsession-rstudio[77]: ERROR system error 1 (Operation not permitted) [path: /workspace/.Rproj.user/A15061CB/sources/session-32bb5c84/lock_file]; OCCURRED AT void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617; LOGGED FROM: void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617
    

    Using this new config, setting the .Rproj.user dir location to be inside the container makes this error/warning stop.

    Is there any way of setting this in one of the config files, say rserver.conf/rsession.conf, or is it only available through the Project Options window?

  11. gtritchie commented on Nov 7, 2024

    @gtritchie
    Member

    Is there any way of setting this in one of the config files, say rserver.conf/rsession.conf, or is it only available through the Project Options window?

    Yes, this was added via #15140.

    Each user can specify a default scratch file location that will be used for all their projects. This is under Global Options / General / Advanced / "Default project user data directory". Note that the per-project setting (in Project Options) will override this global setting for a given project.

    An admin (RStudio Server only, not desktop) can set a default for all users via the /etc/rstudio/rsession.conf file:

    session-project-user-data-dir=/shared/scratch
    

    There's also an option to prevent users from overriding a scratch path specified via rsession.conf. Set to 0 (zero) to prevent users from overriding the scratch path, 1 (one) is the default and allows overrides.

    session-allow-project-user-data-dir-override=0
    
  12. zhanghao-njmu commented on Mar 15, 2025

    @zhanghao-njmu
    rsession-rstudio[77]: ERROR system error 1 (Operation not permitted) [path: /workspace/.Rproj.user/A15061CB/sources/session-32bb5c84/lock_file]; OCCURRED AT void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617; LOGGED FROM: void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617
    

    This error occurs because the rstudio-server user lacks write permissions to the specified path. Specifically, the /workspace/.Rproj.user/ directory requires adjusted file permissions.

    Solutions:

    Modify permissions: Grant write access to the /workspace/.Rproj.user/ directory for the rstudio-server user.
    Alternative approach (as suggested by @gtritchie ): Create a unified session-project-user-data-dir directory and assign appropriate permissions to it for rstudio-server user. This ensures consistent access across sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementprojectsremote storage

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions