Skip to content

precompilation error when using module with PythonCall.jl in another module #337

Closed
@kylebeggs

Description

@kylebeggs

Affects: PythonCall

Describe the bug
I have a module Foo which imports a Python package and defines some functions using this Python package. All tests pass and it works great. I have another module Bar which uses Foo. During precompilation of Bar I get this error:

Failed to precompile Bar [03231224-7cb2-45ca-b412-3b82d488d8bd] to "/home/kylebeggs/.julia/compiled/v1.9/Bar/jl_8mIASd".
hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don't enable unless really needed).
ERROR: LoadError: InitError: LoadError: Evaluation into the closed module `Foo` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Foo` with `eval` during precompilation - don't do this.

In Foo, I load the Python package and some user defined Python functions as

const MP = PythonCall.pynew()

function __init__()
    PythonCall.pycopy!(MP, pyimport("some_package"))
    include(joinpath(@__DIR__, "python-funcs.jl"))
    return nothing
end

Your system
Please provide detailed information about your system:

  • Linux - PopOS 22.04
  • Julia 1.9.2
  • PythonCall v0.9.13
  • CondaPkg v0.2.18
Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12700H
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)
  Threads: 8 on 20 virtual cores
Environment:
  LD_PRELOAD = /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8
  JULIA_IMAGE_THREADS = 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions