Skip to content

Conversation

@sounkou-bioinfo
Copy link

No description provided.

@sounkou-bioinfo
Copy link
Author

sounkou-bioinfo commented Oct 25, 2025

This should not be merged,
There is a segfault when using threaded python. This pull request modifies the libpython finding regex

echo ================ Non threaded python =================
UV_VENV_CLEAR=1 uv venv --python  python@3.14
uv run Rscript -e 'library(reticulate);use_virtualenv(".venv/"); py_config()$version ;os <- import("os"); os$listdir()'
# 
echo ===============the other python=============
UV_VENV_CLEAR=1 uv venv --python  python@3.14t
gdb --batch --ex run --ex bt --ex quit --args  uv run Rscript -e 'library(reticulate)  ;use_virtualenv(".venv/") ; cat(py_config()$version);os <- import("os"); os$listdir()'

the log

================ Non threaded python =================
Using CPython 3.14.0
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
[1] ‘3.14’
 [1] ".git-blame-ignore-revs"        ".github"                      
 [3] "cran-comments.md"              "reticulate.Rproj"             
 [5] "man"                           "src"                          
 [7] "NAMESPACE"                     "log.out"                      
 [9] "tests"                         "NEWS.md"                      
[11] "tools"                         "DESCRIPTION"                  
[13] ".Rbuildignore"                 ".git"                         
[15] ".gitignore"                    ".venv"                        
[17] "deactivate"                    "inst"                         
[19] "activate"                      "_pkgdown.yml"                 
[21] "a.out"                         "LICENSE"                      
[23] "README.md"                     "reticulate_1.44.0.9000.tar.gz"
[25] "vignettes"                     "R"                            
===============the other python=============
Using CPython 3.14.0
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff717f6c0 (LWP 747818)]
[Detaching after fork from child process 747819]

 *** caught segfault ***
address 0xffffffffffffffe0, cause 'memory not mapped'

Traceback:
 1: py_initialize(config$python, config$libpython, config$pythonhome,     config$virtualenv_activate, config$version$major, config$version$minor,     interactive(), numpy_load_error)
 2: (function() {    Sys.setenv(PYTHONPATH = newpythonpath)    on.exit(Sys.setenv(PYTHONPATH = oldpythonpath), add = TRUE)    py_initialize(config$python, config$libpython, config$pythonhome,         config$virtualenv_activate, config$version$major, config$version$minor,         interactive(), numpy_load_error)})()
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch({    oldpythonpath <- Sys.getenv("PYTHONPATH")    newpythonpath <- Sys.getenv("RETICULATE_PYTHONPATH", unset = paste(config$pythonpath,         system.file("python", package = "reticulate"), sep = .Platform$path.sep))    local({        Sys.setenv(PYTHONPATH = newpythonpath)        on.exit(Sys.setenv(PYTHONPATH = oldpythonpath), add = TRUE)        py_initialize(config$python, config$libpython, config$pythonhome,             config$virtualenv_activate, config$version$major,             config$version$minor, interactive(), numpy_load_error)    })}, error = function(e) {    Sys.setenv(PATH = oldpath)    if (is.na(curr_session_env)) {        Sys.unsetenv("R_SESSION_INITIALIZED")    }    else {        Sys.setenv(R_SESSION_INITIALIZED = curr_session_env)    }    stop(e)})
 7: initialize_python()
 8: ensure_python_initialized()
 9: py_config()
10: cat(py_config()$version)
An irrecoverable exception occurred. R is aborting now ...
[Thread 0x7ffff717f6c0 (LWP 747818) exited]
[Inferior 1 (process 747815) exited with code 0213]
No stack.


@sounkou-bioinfo sounkou-bioinfo changed the title find libpython find libpython in for uv threaded python venvs Oct 25, 2025
@sounkou-bioinfo sounkou-bioinfo changed the title find libpython in for uv threaded python venvs find libpython for uv threaded python venvs Oct 25, 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

Successfully merging this pull request may close these issues.

1 participant