pyjulia icon indicating copy to clipboard operation
pyjulia copied to clipboard

Pyjulia not working on Julia 1.6

Open lvzhibai opened this issue 3 years ago • 11 comments

When I try to install and work with Python3.9.3 with Julia 1.6, the command

julia.install()

works well, but later

from julia import Base # or Pkg, Main ..etc

leads to segmentation fail, and python exits without other error messages inside terminal.

Then I reinstalled julia 1.5, all commands works well.

System: MacOS Big Sur with Command Line Tools

lvzhibai avatar Apr 05 '21 21:04 lvzhibai

I tried with Python 3.8.6 and Julia 1.6 on Kubuntu 20.10 and everything worked fine. I did:

import julia
julia.install()
jl = julia.Julia(compiled_modules=False)
from julia import Base
Base.sind(90)

On the Python REPL.

emanuellima1 avatar Apr 06 '21 21:04 emanuellima1

I have the same issue: MacOS Big Sur. Python 3.8.8 [Clang 10.0.0 ] :: Anaconda, Inc. on darwin julia version 1.6.0

ampbj avatar Apr 07 '21 06:04 ampbj

For reference, there is a similar problem for 1.6 with JuliaCall in R on macOS: https://github.com/Non-Contradiction/JuliaCall/issues/164

So it seems to be a bug in Julia, the issue is being tracked here: https://github.com/JuliaLang/julia/issues/40246

JackDunnNZ avatar Apr 09 '21 20:04 JackDunnNZ

Same problem here. I'm currently using 1.5.3 until this problems fixed.

KwatMDPhD avatar Apr 20 '21 19:04 KwatMDPhD

I posted this in https://github.com/JuliaLang/julia/issues/40246, but I'm going to post it here as well to get a bit more exposure.


So I've been doing some testing trying to get macOS 11.4, Python 3.9, and Julia 1.6 working with pyjulia 0.5.6, and I think I found a way to get it to work somewhat.

Some notes:

  • I am using the Julia 1.6 macOS binary downloaded from julialang.org which exists in /Applications/Julia-1.6.app.
  • I have symlinked the julia binary to my /usr/local/bin like so ln -s /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia1.6 and then whenever I change my default julia I symlink it again like so: ln -s /usr/local/bin/julia1.6 /usr/local/bin/julia
  • I am doing this in a python 3.9 venv

So my first few observations.

  • I had tried this with the Julia 1.7 beta and noticed a few extra debug lines.
  • As others have mentioned, it seems like jl_ is unexported. As a test I just commented out these lines: https://github.com/JuliaPy/pyjulia/blob/master/src/julia/libjulia.py#L34-L35 as it doesn't seem like jl_ is used anywhere?
  • I noticed that I was getting the error:
ERROR: could not load library "libjulia.1.dylib"
dlopen(libjulia.1.dylib, 1): image not found
  • libjulia.1.dylib exists in /Applications/Julia-1.6.app/Contents/Resources/julia/lib but it seems to be looking in /Applications/Julia-1.6.app/Contents/Resources/julia/lib/julia instead, so I symlinked libjulia.1.dylib into the lib/julia folder and it stopped segfaulting.
  • This seems weird to me since 1.5 didn't have that file in that folder either, so I'm not sure why it's looking for it there now.
  • Then I saw an error that it wouldn't find libjulia.dylib which I just applied the same symlink fix as above and then I had no issues

So, as far as I can tell, the issue is that jl_ isn't exported anymore and pyjulia just checks for its existence, and also julia is looking for libjulia.1.dylib and libjulia.dylib in the wrong place?

Hoping this info might help in some way!

fchorney avatar Aug 30 '21 16:08 fchorney

This could be "fixed" for 1.6 by removing the is_windows condition here: https://github.com/JuliaPy/pyjulia/blob/87c669e2729f9743fe2ab39320ec9b91c9300a96/src/julia/libjulia.py#L221-L222

(see https://github.com/JuliaLang/julia/issues/40246#issuecomment-912223287)

ihnorton avatar Sep 03 '21 03:09 ihnorton

Hi, I have it working with Julia 1.6, but with 1.7 I get an error due to missing jl_ Should we change the name of the issue? or create a new one?

dpinol avatar Oct 13 '21 09:10 dpinol

@dpinol https://github.com/JuliaPy/pyjulia/issues/451

KwatMDPhD avatar Oct 13 '21 14:10 KwatMDPhD

There's now PyJulia 0.5.7 and PyCall 1.92.5 that solved a couple of recent issues. It includes @ihnorton's suggestion https://github.com/JuliaPy/pyjulia/issues/437#issuecomment-912223632

tkf avatar Oct 25 '21 07:10 tkf

There's now PyJulia 0.5.7

~~It doesn't look like this has been tagged and registered yet?~~

Edit: Oh wait, this is Python not Julia, it works differently. I was confused haha

fchorney avatar Oct 25 '21 14:10 fchorney

I finally had a chance to try this out. PyJulia 0.5.7 Works perfect on MacOS with Julia 1.6 now. Thanks so much!

fchorney avatar Oct 28 '21 17:10 fchorney