Skip to content

Unable to import juliacall in Python #250

Closed
@zornsllama

Description

@zornsllama

Hi,

I have not had any issues in using PythonCall within Julia, but when importing juliacall in Python I obtain the following error message:

❯ python3
Python 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from juliacall import Main as jl
[juliapkg] Locating Julia ^1.6
[juliapkg] Querying Julia versions from https://julialang-s3.julialang.org/bin/versions.json
[juliapkg] Using Julia 1.8.2 at /usr/bin/julia
[juliapkg] Using Julia project at /home/---/.julia/environments/pyjuliapkg
[juliapkg] Installing packages:
           julia> import Pkg
           julia> Pkg.add([Pkg.PackageSpec(name="PythonCall", uuid="6099a3de-0909-46bc-b1f4-468b9a2dfc0d")])
           julia> Pkg.resolve()
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/pyjuliapkg/Project.toml`
  No Changes to `~/.julia/environments/pyjuliapkg/Manifest.toml`
  No Changes to `~/.julia/environments/pyjuliapkg/Project.toml`
  No Changes to `~/.julia/environments/pyjuliapkg/Manifest.toml`
ERROR: InitError: AssertionError: pystr_asstring(jl.__version__) == string(VERSION)
Stacktrace:
  [1] init_juliacall()
    @ PythonCall ~/.julia/packages/PythonCall/Z6DIG/src/juliacall.jl:14
  [2] (::PythonCall.var"#176#180")()
    @ PythonCall ~/.julia/packages/PythonCall/Z6DIG/src/PythonCall.jl:89
  [3] with_gil
    @ ~/.julia/packages/PythonCall/Z6DIG/src/cpython/gil.jl:14 [inlined]
  [4] with_gil
    @ ~/.julia/packages/PythonCall/Z6DIG/src/cpython/gil.jl:9 [inlined]
  [5] __init__()
    @ PythonCall ~/.julia/packages/PythonCall/Z6DIG/src/PythonCall.jl:84
  [6] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [7] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [8] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [9] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
 [10] macro expansion
    @ ./loading.jl:1180 [inlined]
 [11] macro expansion
    @ ./lock.jl:223 [inlined]
 [12] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
 [13] top-level scope
    @ none:5
during initialization of module PythonCallTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/---/.local/lib/python3.10/site-packages/juliacall/__init__.py", line 137, in <module>
    init()
  File "/home/---/.local/lib/python3.10/site-packages/juliacall/__init__.py", line 131, in init
    raise Exception('PythonCall.jl did not start properly')
Exception: PythonCall.jl did not start properly

Any help in resolving this would be greatly appreciated!

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