roaldarbol / r-template

🚀 Pixi Template for R
1 stars 0 forks source link

Ask for platform #2

Closed roaldarbol closed 4 months ago

roaldarbol commented 4 months ago

Until there's a better solution where we can rely on the pixi fetching of the platform, just ask the user which platform they're on.

robinlovelace-ate commented 4 months ago

Sounds good and thanks for opening this issue..

robinlovelace-ate commented 4 months ago

I'm literally working on this right now, not sure how best to progress and would be happy to do a quick call to show you my use case ☎️

Or can keep reporting progress here...

robinlovelace-ate commented 4 months ago

Basically this is what I'm hitting:

image

robinlovelace-ate commented 4 months ago

Guess I need to set the R path to the pixi install?

robinlovelace-ate commented 4 months ago
which R
/workspaces/netgen/.pixi/envs/default/bin/R
roaldarbol commented 4 months ago

Yeah, just report here - I can try to tidy up the issues along the way. I might not be able to respond super quickly as I'm also writing like crazy on my PhD. :P

roaldarbol commented 4 months ago

Yeah, so this is basically the issue I opened on Positron too - there's no good way I know of to discover project/environment-based R installations at present. I opened https://github.com/roaldarbol/r-template/issues/4 to follow it.

robinlovelace-ate commented 4 months ago

Currently looking at adding this to .devcontainer.json:

        "settings": {
            "r.rpath.linux": "/workspaces/netgen/.pixi/envs/default/bin/R"
        },
        "when": "devcontainer"
      },
roaldarbol commented 4 months ago

What I would do is either use RStudio for now (...), or use Jupyter with an R kernel. I'll make a new issue adding the needed Jupyter components to the template. 😊

robinlovelace-ate commented 4 months ago

What I would do is either use RStudio for now (...), or use Jupyter with an R kernel. I'll make a new issue adding the needed Jupyter components to the template. 😊

Issue is I'm developing inside a .devcontainer. I think RStudio can work with GitHub codespaces but not sure how to spin that up ATM.

roaldarbol commented 4 months ago

Currently looking at adding this to .devcontainer.json:

      "settings": {
          "r.rpath.linux": "/workspaces/netgen/.pixi/envs/default/bin/R"
      },
      "when": "devcontainer"
    },

Please keep me updated on #4, would be great to find a solution to it.

roaldarbol commented 4 months ago

Do you need to run a script or do you need the console?

If you need to run a script, you could run it with pixi run Rscript myscript.R

robinlovelace-ate commented 4 months ago

Need in console for interactive development, e.g. in Quarto doc (primary way of working on interactive data analysis).

robinlovelace-ate commented 4 months ago

Another observation after trying to run R from the installed path, without pixi shell:

/workspaces/netgen/.pixi/envs/default/bin/R

R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-conda-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MESSAGES failed, using "C" 
5: Setting LC_MONETARY failed, using "C" 
6: Setting LC_PAPER failed, using "C" 
7: Setting LC_MEASUREMENT failed, using "C" 

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Segmentation fault (core dumped)
robinlovelace-ate commented 4 months ago

This seems to be the solution for VS Code, meaning everything gets installed globally:

pixi global install netgen
robinlovelace-ate commented 4 months ago

Next issue (sorry @roaldarbol and no expectation for quick response):

pixi global install netgen
⚠️No executable entrypoint found in package netgen, are you sure it exists?
✔ Installed package netgen 6.2.2006 py310h6db9624_4 from conda-forge
root@codespaces-f59edc:/workspaces/netgen# R
bash: R: command not found
robinlovelace-ate commented 4 months ago

Do I need to add an entrypoint?

roaldarbol commented 4 months ago

No, so by installing globally, you're installing where there's no R installation - the two things are completely walled off from each other. So I don't think global install is what you want. This seems to be a Docker related issue, can't help much with that unfortunately. Found something on SO: https://stackoverflow.com/a/17510093/13240268

robinlovelace-ate commented 4 months ago

No luck with pixi global install which I tried first:

pixi global install
Installs the defined package in a global accessible location

Usage: pixi global install [OPTIONS] [PACKAGE]...
roaldarbol commented 4 months ago

Closing this issue as the template now asks for and incorporates platform.