@@ -68,11 +68,16 @@ function init_context()
6868 Deps. resolve ()
6969 exe_path = Deps. python_exe ()
7070 isfile (exe_path) || error (" cannot find python executable" )
71+ elseif exe_path == " @PyCall"
72+ haskey (Base. loaded_modules, PYCALL_PKGID) || Base. require (PYCALL_PKGID)
73+ PyCall = Base. loaded_modules[PYCALL_PKGID]
74+ exe_path = PyCall. python:: String
75+ CTX. lib_path = PyCall. libpython:: String
7176 end
7277
7378 # Ensure Python is runnable
7479 try
75- run (pipeline (` $exe_path --version` , devnull ))
80+ run (pipeline (` $exe_path --version` , stdout = devnull , stderr = devnull ))
7681 catch
7782 error (" Python executable $(repr (exe_path)) is not executable." )
7883 end
@@ -118,14 +123,6 @@ function init_context()
118123 end
119124 init_pointers ()
120125
121- # Compare libpath with PyCall
122- PyCall = get (Base. loaded_modules, PYCALL_PKGID, nothing )
123- if PyCall === nothing
124- @require PyCall= " 438e738f-606a-5dbb-bf0a-cddfbfd45ab0" check_libpath (PyCall)
125- else
126- check_libpath (PyCall)
127- end
128-
129126 # Initialize
130127 with_gil () do
131128 if Py_IsInitialized () != 0
@@ -238,10 +235,18 @@ const PYTHONCALL_PKGID = Base.PkgId(PYTHONCALL_UUID, "PythonCall")
238235const PYCALL_UUID = Base. UUID (" 438e738f-606a-5dbb-bf0a-cddfbfd45ab0" )
239236const PYCALL_PKGID = Base. PkgId (PYCALL_UUID, " PyCall" )
240237
241- check_libpath (PyCall) = begin
242- if realpath (PyCall. libpython) == realpath (CTX. lib_path)
243- # @info "libpython path agrees between PythonCall and PyCall" PythonCall.CONFIG.libpath PyCall.libpython
244- else
245- @warn " PythonCall and PyCall are using different versions of libpython. This will probably go badly." CTX. lib_path PyCall. libpython
246- end
247- end
238+ # # Compare libpath with PyCall
239+ # PyCall = get(Base.loaded_modules, PYCALL_PKGID, nothing)
240+ # if PyCall === nothing
241+ # @require PyCall="438e738f-606a-5dbb-bf0a-cddfbfd45ab0" check_libpath(PyCall)
242+ # else
243+ # check_libpath(PyCall)
244+ # end
245+
246+ # check_libpath(PyCall) = begin
247+ # if realpath(PyCall.libpython) == realpath(CTX.lib_path)
248+ # # @info "libpython path agrees between PythonCall and PyCall" PythonCall.CONFIG.libpath PyCall.libpython
249+ # else
250+ # @warn "PythonCall and PyCall are using different versions of libpython. This will probably go badly." CTX.lib_path PyCall.libpython
251+ # end
252+ # end
0 commit comments