Skip to content

Unable to import juliacall in Python #250

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

Closed
zornsllama opened this issue Dec 2, 2022 · 2 comments
Closed

Unable to import juliacall in Python #250

zornsllama opened this issue Dec 2, 2022 · 2 comments

Comments

@zornsllama
Copy link

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!

@cjdoris
Copy link
Collaborator

cjdoris commented Dec 2, 2022

That's really odd. What version of JuliaCall are you on, have you updated recently? Do you set any environment variables?

@zornsllama
Copy link
Author

Ah yep, probably should've realized this myself. Just updated JuliaCall from v0.6.0 to v0.9.9 and the issue has fixed itself. Thanks for your response in any case!

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

2 participants