-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't load R libraries #587
Comments
This is my output on
|
I tried to run .libPaths()
[1] "/Users/roaldarbol/Library/R/x86_64/4.3/library"
[2] "/Users/roaldarbol/Research/Test/.pixi/env/lib/R/library" Do you also have a global non-pixi R installed? If not, can you try that too - and also install EDIT: It seems you need to set > .libPaths()
[1] "/Users/roaldarbol/Library/R/x86_64/4.3/library"
[2] "/Users/roaldarbol/Research/Test/.pixi/env/lib/R/library"
> .libPaths("/Users/roaldarbol/Research/Test/.pixi/env/lib/R/library")
> .libPaths()
[1] "/Users/roaldarbol/Research/Test/.pixi/env/lib/R/library"
> library(tidyverse)
── Attaching core tidyverse packages ───────────────────────────────────────────────────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ─────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
> |
As an aside, using virtual environments is not common in R-land unfortunately, and currently . If pixi could function as or interact as an R Project that also specifies R installation, that would be huge. Especially since 99% work in RStudio, so would be amazing if RStudio could pick up the R installation from pixi. Surely would have to involve RStudio, but I could easily see them having an interest in it - they collaborate quite a bit with various Jupyter folks. |
As a short-term fix, the user can create an
|
Nice find, is there a difference between |
Haven't tried with In the end the easiest thing ended up using |
Yes I would love to hear more about it as I (and I think the team) doesn't have a lot of R experience so far. |
R in conda is supposed to only set libpaths to the cond environment; this seems true for any channel (it seems that's the case for the r and conda-forge channel at least), however R will still source a lot of files outside the conda environment. So @roaldarbol try running |
@notPlancha Just tried, and that doesn't change the library paths unfortunately. I guess the "sourcing files outside the conda environment" is the crux of the issue here: identifying where it does that and ensuring that it doesn't. |
@roaldarbol How did you install R globally? Asking to see if I can reproduce the problem. Also could you run |
I've installed R globally with Running R is /Users/roaldarbol/Research/Test/.pixi/env/bin/R
R is /usr/local/bin/R
R is /usr/local/bin/R Running × Unexpected character.
│ ()
│ ~ But running [1] "/Users/roaldarbol/Library/R/x86_64/4.3/library"
[2] "/Users/roaldarbol/Research/Test/.pixi/env/lib/R/library" |
My suspicion of what's happening is that the environment variable I made some googling and my conclusion is that even though r-base in conda-forge already isolates packages (for some reason), it's not officially supported conda-forge/r-base-feedstock#65 (comment), so I think the best solutions right now are:
The disadvantages of 1 is that if .Rprofile is set site wise, then it can lead to unreproducible results, and if it's set project wise, it'll not load the site wise .Rprofile, which some people find it useful. I haven't tested 2 so I don't know if it actually works, but looking into it it seems it basically just changes If the latter actually works, I think it's a great opportunity for pixi to implement this change itself, or at least add an option for default (user-defined) packages on But before that, @roaldarbol please check if either |
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pixi, using
pixi --version
.Reproducible example
When installing R libraries, there's an error when you try to load that library. Effectively it means that R currently cannot be used with pixi unfortunately.
Here's a
pixi.toml
:Start a shell with
pixi shell
.which R
to make sure that it is indeed the pixi R installation being used.Then open R with
Then once R (like
ipython
) is open, run:library(tidyverse)
Which returns the error:
Issue description
I've tried with multiple packages, both with
R
but also trying to run an R script withRscript
- same outcome. I've frequently run R scripts from the command line, so I'm fairly sure it's a pixi issue.Expected behavior
I would expect pixi to detect the installed packages and simply load the library.
The text was updated successfully, but these errors were encountered: