Skip to content
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

Renv breaks jupyter notebooks in vscode #2084

Open
Qile0317 opened this issue Jan 30, 2025 · 0 comments
Open

Renv breaks jupyter notebooks in vscode #2084

Qile0317 opened this issue Jan 30, 2025 · 0 comments

Comments

@Qile0317
Copy link

Qile0317 commented Jan 30, 2025

I'm using a jupyter notebook in vscode with an R kernel installed from IRkernel within WSL2 ubuntu. When I decided to setup renv (version 1.0.11) with renv::init(), when I reloaded the session later, everything appears to work fine, but when I try to run any jupyter notebook cell it errors with Error occurred while trying to start the kernel, options.disableUI=true Error: Unable to start Kernel 'R 4.4.2' due to a timeout waiting for the ports to get used.

I tried checking and updating every single thing related to vscode, the jupyter extension, conda environments, ports, R environments, etc. but nothing was working. Then I came across the jupyter-extension github issue page, it seemed that many times this error occurs due to some issue with the local user environment. So I used the terminal to do renv::deactivate(clean=TRUE) and immediately afterwards everything was working again.

To ensure the issue is related to renv, in any new vscode projects I created, notebooks didnt fail, and neither did any temporary notebooks I made in the same working directory (Before I deactivated renv). I'm guessing it might have something to do with the autogenerated .Rprofile file?

I also probably should try to reproduce the issue in new folders and also in the same folder again, but I dont quite have the time for this for the next few weeks.

For reference the following is my sessionInfo() output:

R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: America/Los_Angeles
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] digest_0.6.37     IRdisplay_1.1     base64enc_0.1-3   fastmap_1.2.0    
 [5] glue_1.8.0        htmltools_0.5.8.1 repr_1.1.7        lifecycle_1.0.4  
 [9] cli_3.6.3         vctrs_0.6.5       pbdZMQ_0.3-13     compiler_4.4.2   
[13] tools_4.4.2       evaluate_1.0.3    pillar_1.10.1     rlang_1.1.5      
[17] jsonlite_1.8.9    crayon_1.5.3      IRkernel_1.3.2    uuid_1.2-1 

I understand that I didn't quite present this issue in the most reproducible way, so let me know of any additional info you guys need. Thanks. But if anyone else encounters the same issue hopefully this helps.

Edit: Ok, I just tried this in a fresh folder and there were 0 issues. I have no idea what caused the aforementioned error. If there are certain commands that I could run that may give useful information please let me know.

@Qile0317 Qile0317 changed the title Renv breaks jupyter notebook in vscode Renv breaks jupyter notebooks in vscode Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant