# How to point Julia to a python executable

**URL:** <https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388>\
**Category:** New to Julia\
**Tags:** pythoncall\
**Created:** [May 27, 2025, 3:32pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388 "2025-05-27T15:32:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![keynescoefen](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Post date:** [May 27, 2025, 3:32pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/1 "2025-05-27T15:32:58Z")

</div>

Hello, When trying to precompile `PythonCall` I received the following error

```julia
IOError: could not spawn `/Users/jerome/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/bin/python --version`: no such file or directory (ENOENT)
Stacktrace:
 [1] run
   @ ./process.jl:510 [inlined]
 [2] init_context()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/context.jl:88
 [3] __init__ ()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/C.jl:23
 [4] top-level scope
   @ stdin:6

```

I understand that Julia needs a python executable to function with `pyplot()` etc. Can you help me point Julia to one?  
Thank you!

---

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [May 27, 2025, 3:37pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/2 "2025-05-27T15:37:17Z")

</div>

You can use `ENV["JULIA_PYTHONCALL_EXE"]`, see [Guide · PythonCall & JuliaCall](https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#pythoncall-config).

---

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [May 27, 2025, 5:28pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/3 "2025-05-27T17:28:02Z")

</div>

I had to set these three variables (on Ubuntu):

```julia
 "JULIA_CONDAPKG_EXE" – point to pythonpath
 "JULIA_CONDAPKG_BACKEND"="Null" 
"PYTHON_JULIACALL_HANDLE_SIGNALS"="yes"

```

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [May 27, 2025, 7:58pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/4 "2025-05-27T19:58:30Z")

</div>

Can you give the full log from the precompilation? It’s very odd that Python is not available there, it should have been downloaded by default.

Also can you post the output of `versioninfo()`?

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 28, 2025, 4:16am UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/5 "2025-05-28T04:16:37Z")

</div>

I asseconde that.

Bu default, PyrhonCall, when installed, download and install a “private to Julia” version of Pyrhon. No need to do anything unusual.  
Only if you esplicitly specify , as suggested above, the Python path, it will use that path.

So, something went wrong in the installation of PythonCall (or of a package that requires it)…

---

<div class="post-metadata">

**Author:** ![keynescoefen](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Post date:** [May 28, 2025, 8:22pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/6 "2025-05-28T20:22:02Z")

</div>

The output of `versioning()` is:

```julia
Julia Version 1.11.4
Commit 8561cc3d68* (2025-03-10 11:36 UTC)
Build Info:
  Built by Homebrew (v1.11.4)

    Note: This is an unofficial build, please report bugs to the project
    responsible for this build and not to the Julia project unless you can
    reproduce the issue using official builds available at https://julialang.org/downloads

Platform Info:
  OS: macOS (x86_64-apple-darwin23.6.0)
  CPU: 12 × Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 6 default, 0 interactive, 3 GC (on 12 virtual cores)
Environment:
  JULIA_NUM_THREADS = 6

```

I followed the steps [here](https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#pythoncall-config) and set my conda environment variable to `current` and then it compiled. But now, my environment variable is empty wrt Python again.

```julia

julia> ENV["JULIA_CONDAPKG_BACKEND"]
ERROR: KeyError: key "JULIA_CONDAPKG_BACKEND" not found
Stacktrace:
 [1] access_env
   @ ./env.jl:60 [inlined]
 [2] getindex(::Base.EnvDict, k::String)
   @ Base ./env.jl:164
 [3] top-level scope
   @ REPL[6]:1

```

---

<div class="post-metadata">

**Author:** ![keynescoefen](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Post date:** [May 29, 2025, 10:29am UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/7 "2025-05-29T10:29:23Z")

</div>

Ok, the error persists unfortunately. When wanting to invoke `PythonCall` I am getting this error message.

```julia
using PythonCall
    CondaPkg Initialising pixi
             │ /Users/jerome/.julia/artifacts/cc02fad3b04cfb688ba4e3d60648ad8c3afe3a2d/bin/pixi
             │ init
             │ --format pixi
             └ /Users/jerome/.julia/environments/v1.11/.CondaPkg
✔ Created /Users/jerome/.julia/environments/v1.11/.CondaPkg/pixi.toml
    CondaPkg Wrote /Users/jerome/.julia/environments/v1.11/.CondaPkg/pixi.toml
             │ [dependencies]
             │ 
             │ [project]
             │ name = ".CondaPkg"
             │ platforms = ["osx-64"]
             │ channels = ["conda-forge"]
             │ channel-priority = "strict"
             └ description = "automatically generated by CondaPkg.jl"
    CondaPkg Installing packages
             │ /Users/jerome/.julia/artifacts/cc02fad3b04cfb688ba4e3d60648ad8c3afe3a2d/bin/pixi
             │ install
             └ --manifest-path /Users/jerome/.julia/environments/v1.11/.CondaPkg/pixi.toml
✔ The default environment has been installed.
ERROR: InitError: Python executable "/Users/jerome/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/bin/python" is not executable.
Stacktrace:
 [1] init_context()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/context.jl:90
 [2] __init__ ()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/C.jl:23
during initialization of module C

caused by: IOError: could not spawn `/Users/jerome/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/bin/python --version`: no such file or directory (ENOENT)
Stacktrace:
 [1] run
   @ ./process.jl:510 [inlined]
 [2] init_context()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/context.jl:88
 [3] __init__ ()
   @ PythonCall.C ~/.julia/packages/PythonCall/L4cjh/src/C/C.jl:23

```

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [May 29, 2025, 11:01am UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/8 "2025-05-29T11:01:52Z")

</div>

Aha ok, well since the `[dependencies]` section is empty, the `python` dependency from PythonCall is not being found for some reason.

I suggest you add some print statements inside this function to figure out why it isn’t finding the `CondaPkg.toml` file for PythonCall: [CondaPkg.jl/src/resolve.jl at c1df0aa999b52460757a95225f5482f1a7eb31a0 · JuliaPy/CondaPkg.jl · GitHub](https://github.com/JuliaPy/CondaPkg.jl/blob/c1df0aa999b52460757a95225f5482f1a7eb31a0/src/resolve.jl#L327)

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [May 29, 2025, 11:02am UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/9 "2025-05-29T11:02:52Z")

</div>

Also what is `Pkg.status()`?

---

<div class="post-metadata">

**Author:** ![keynescoefen](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Post date:** [May 29, 2025, 10:30pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-a-python-executable/129388/10 "2025-05-29T22:30:34Z")

</div>

Please see here for `Pkg.status()`

```julia
Status `~/.julia/environments/v1.11/Project.toml`
⌃ [cbdf2221] AlgebraOfGraphics v0.10.4
  [6e4b80f9] BenchmarkTools v1.6.0
  [336ed68f] CSV v0.10.15
⌃ [13f3f980] CairoMakie v0.13.4
  [324d7699] CategoricalArrays v0.10.8
  [35d6a980] ColorSchemes v3.29.0
⌅ [5ae59095] Colors v0.12.11
⌃ [861a8166] Combinatorics v1.0.2
  [992eb4ea] CondaPkg v0.2.29
  [60f91f6f] CovarianceMatrices v0.22.0
  [a93c6f00] DataFrames v1.7.0
⌃ [31c24e10] Distributions v0.25.117
  [8f03c58b] Effects v1.4.0
⌃ [9d5cd8c9] FixedEffectModels v1.11.0
⌅ [f6369f11] ForwardDiff v0.10.38
  [38e38edf] GLM v1.9.0
  [1ecd5474] GraphMakie v0.5.14
  [a2cc645c] GraphPlot v0.6.1
⌃ [bd48cda9] GraphRecipes v0.5.13
⌃ [86223c79] Graphs v1.12.0
⌃ [09f84164] HypothesisTests v0.11.3
  [b964fa9f] LaTeXStrings v1.4.0
  [d3d80556] LineSearches v7.3.0
  [2ab3a3ac] LogExpFunctions v0.3.29
⌃ [d41bc354] NLSolversBase v7.8.3
  [2774e3e8] NLsolve v4.5.1
  [86f7a689] NamedArrays v0.10.3
⌃ [429524aa] Optim v1.11.0
  [8314cec4] PGFPlotsX v1.6.2
  [f8e8dcbf] PanelDataTools v0.3.0
⌃ [91a5bcdd] Plots v1.40.9
  [6099a3de] PythonCall v0.9.25
  [274fc56d] PythonPlot v1.0.6
  [ce6b1742] RDatasets v0.7.7
  [1277b4bf] ShiftedArrays v2.0.0
  [47aef6b3] SimpleWeightedGraphs v1.5.0
  [10745b16] Statistics v1.11.1
  [f3b207a7] StatsPlots v0.15.7
  [22787eb5] Term v2.0.7
  [ebf5ac4f] TexTables v0.3.0
  [9e3dc215] TimeSeries v0.24.2
  [37e2e46d] LinearAlgebra v1.11.0
  [2f01184e] SparseArrays v1.11.0
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`

```
