@@ -292,6 +292,34 @@ def is_different_exe(pyprogramname, sys_executable):
292
292
return not is_same_path (pyprogramname , sys_executable )
293
293
294
294
295
+ def raise_separate_cache_error (runtime , pyprogramname ):
296
+ message = """\
297
+ It seems your Julia and PyJulia setup are not supported.
298
+
299
+ Julia interpreter:
300
+ {runtime}
301
+ Python interpreter used by PyCall.jl:
302
+ {pyprogramname}
303
+ Python interpreter used to import PyJulia.
304
+ {sys.executable}
305
+
306
+ In Julia >= 0.7, above two paths to the Python interpreters have to match
307
+ exactly in order for PyJulia to work. To configure PyCall.jl to use Python
308
+ interpreter "{sys.executable}",
309
+ run the following commands in the Julia interpreter:
310
+
311
+ ENV["PYTHON"] = "{sys.executable}"
312
+ using Pkg
313
+ Pkg.build("PyCall")
314
+
315
+ For more information, see:
316
+ https://github.com/JuliaPy/pyjulia
317
+ https://github.com/JuliaPy/PyCall.jl
318
+ """ .format (runtime = runtime , pyprogramname = pyprogramname ,
319
+ sys = sys )
320
+ raise RuntimeError (message )
321
+
322
+
295
323
_julia_runtime = [False ]
296
324
297
325
@@ -448,14 +476,20 @@ def __init__(self, init_julia=True, jl_runtime_path=None, jl_init_path=None,
448
476
if init_julia :
449
477
if use_separate_cache :
450
478
# First check that this is supported
451
- self ._call ("""
452
- if VERSION < v"0.5-"
453
- error(\" ""Using pyjulia with a statically-compiled version
454
- of python or with a version of python that
455
- differs from that used by PyCall.jl is not
456
- supported on julia 0.4""\" )
457
- end
458
- """ )
479
+ version_range = self ._unbox_as (self ._call ("""
480
+ Int64(if VERSION < v"0.6-"
481
+ 2
482
+ elseif VERSION >= v"0.7-"
483
+ 1
484
+ else
485
+ 0
486
+ end)
487
+ """ ), "int64" )
488
+ if version_range == 2 :
489
+ raise RuntimeError (
490
+ "PyJulia does not support Julia < 0.6 anymore" )
491
+ elif version_range == 1 :
492
+ raise_separate_cache_error (runtime , depsjlexe )
459
493
# Intercept precompilation
460
494
os .environ ["PYCALL_PYTHON_EXE" ] = sys .executable
461
495
os .environ ["PYCALL_JULIA_HOME" ] = PYCALL_JULIA_HOME
0 commit comments