Skip to content

Error: Python module QuantLib was not found. #1804

Closed
@avhz

Description

@avhz

I am trying to use QuantLib in an R package via reticulate, but am running into the following:

.onLoad <- function(libname, pkgname) {
    reticulate::py_require("QuantLib")
    ql <<- reticulate::import("QuantLib", delay_load = TRUE)
}

When I run devtools::load_all(), I get:

> devtools::load_all() 

List of 22
 $ python              : chr "/opt/venv/bin/python"
 $ libpython           : chr "/usr/lib/python3.12/config-3.12-x86_64-linux-gnu/libpython3.12.so"
 $ pythonhome          : chr "/opt/venv:/opt/venv"
 $ pythonpath          : chr "/usr/lib/python312.zip:/usr/lib/python3.12:/usr/lib/python3.12/lib-dynload:/opt/venv/lib/python3.12/site-packages"
 $ prefix              : chr "/opt/venv"
 $ exec_prefix         : chr "/opt/venv"
 $ base_exec_prefix    : chr "/usr"
 $ virtualenv          : chr "/opt/venv"
 $ virtualenv_activate : chr ""
 $ executable          : chr "/opt/venv/bin/python"
 $ base_executable     : chr "/usr/bin/python3.12"
 $ version_string      : chr "3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0]"
 $ version             :Classes 'package_version', 'numeric_version'  hidden list of 1
  ..$ : int [1:2] 3 12
 $ architecture        : chr "64bit"
 $ anaconda            : logi FALSE
 $ conda               : chr "False"
 $ numpy               : NULL
 $ required_module     : chr "QuantLib"
 $ required_module_path: NULL
 $ available           : logi TRUE
 $ python_versions     : chr "/opt/venv/bin/python"
 $ forced              : chr "VIRTUAL_ENV"
 - attr(*, "class")= chr "py_config"
Error: Python module QuantLib was not found.

Detected Python configuration:

>

Am I doing something wrong ? The docs say it is not recommended to use py_install anymore, so I am a bit stuck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions