@@ -52,33 +52,41 @@ function init_context()
5252 # Find Python executable
5353 exe_path = get (ENV , " JULIA_PYTHONCALL_EXE" , " " )
5454 if exe_path == " " || exe_path == " @CondaPkg"
55- if Sys. islinux ()
56- # Ensure libstdc++ in the Conda environment is compatible with the one
57- # linked in Julia. This is platform/version dependent, so needs to occur at
58- # runtime.
59- #
60- # To figure out cxx_version for a given Julia version, run
61- # strings /path/to/julia/lib/julia/libstdc++.so.6 | grep GLIBCXX
62- # then look at
63- # https://gcc.gnu.org/onlinedocs/gcc-12.1.0/libstdc++/manual/manual/abi.html
64- # for the highest GCC version compatible with the highest GLIBCXX version.
65- if Base. VERSION <= v " 1.6.2"
66- # GLIBCXX_3.4.26
67- cxx_version = " >=3.4,<9.2"
68- else
69- # GLIBCXX_3.4.29
70- # checked up to v1.8.0
71- cxx_version = " >=3.4,<11.4"
55+ if CondaPkg. backend () == :Null
56+ exe_path = Sys. which (" python" )
57+ if exe_path === nothing
58+ error (" CondaPkg is using the Null backend but Python is not installed" )
59+ end
60+ exe_path:: String
61+ else
62+ if Sys. islinux ()
63+ # Ensure libstdc++ in the Conda environment is compatible with the one
64+ # linked in Julia. This is platform/version dependent, so needs to occur at
65+ # runtime.
66+ #
67+ # To figure out cxx_version for a given Julia version, run
68+ # strings /path/to/julia/lib/julia/libstdc++.so.6 | grep GLIBCXX
69+ # then look at
70+ # https://gcc.gnu.org/onlinedocs/gcc-12.1.0/libstdc++/manual/manual/abi.html
71+ # for the highest GCC version compatible with the highest GLIBCXX version.
72+ if Base. VERSION <= v " 1.6.2"
73+ # GLIBCXX_3.4.26
74+ cxx_version = " >=3.4,<9.2"
75+ else
76+ # GLIBCXX_3.4.29
77+ # checked up to v1.8.0
78+ cxx_version = " >=3.4,<11.4"
79+ end
80+ CondaPkg. add (" libstdcxx-ng" , version= cxx_version, channel= " conda-forge" , temp= true , file= joinpath (@__DIR__ , " .." , " .." , " CondaPkg.toml" ), resolve= false )
7281 end
73- CondaPkg. add (" libstdcxx-ng" , version= cxx_version, channel= " conda-forge" , temp= true , file= joinpath (@__DIR__ , " .." , " .." , " CondaPkg.toml" ), resolve= false )
82+ # By default, we use Python installed by CondaPkg.
83+ exe_path = Sys. iswindows () ? joinpath (CondaPkg. envdir (), " python.exe" ) : joinpath (CondaPkg. envdir (), " bin" , " python" )
84+ # It's not sufficient to only activate the env while Python is initialising,
85+ # it must also be active when loading extension modules (e.g. numpy). So we
86+ # activate the environment globally.
87+ # TODO : is this really necessary?
88+ CondaPkg. activate! (ENV )
7489 end
75- # By default, we use Python installed by CondaPkg.
76- exe_path = Sys. iswindows () ? joinpath (CondaPkg. envdir (), " python.exe" ) : joinpath (CondaPkg. envdir (), " bin" , " python" )
77- # It's not sufficient to only activate the env while Python is initialising,
78- # it must also be active when loading extension modules (e.g. numpy). So we
79- # activate the environment globally.
80- # TODO : is this really necessary?
81- CondaPkg. activate! (ENV )
8290 CTX. which = :CondaPkg
8391 elseif exe_path == " @PyCall"
8492 # PyCall compatibility mode
0 commit comments