# M1 MacBook, macOS/Julia 1.8 update issue: "cannot find libpython"

**URL:** https://discourse.julialang.org/t/m1-macbook-macos-julia-1-8-update-issue-cannot-find-libpython/88419
**Category:** General Usage
**Created:** [October 7, 2022, 8:47pm UTC](https://discourse.julialang.org/t/m1-macbook-macos-julia-1-8-update-issue-cannot-find-libpython/88419 "2022-10-07T20:47:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)
#### Post date: [October 7, 2022, 8:47pm UTC](https://discourse.julialang.org/t/m1-macbook-macos-julia-1-8-update-issue-cannot-find-libpython/88419/1 "2022-10-07T20:47:18Z")

</div>

Just upgraded to Julia 1.8.2, under macOS 12.6. python is installed via homebrew. I am getting the following error when running update:

```
julia> import Pkg

julia> Pkg.build("PyCall")
    Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/6e47d11ea2776bc5627421d59cdcc1296c058071/build.log`
    Building PyCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/53b8b07b721b77144a0fbbbc2675222ebf40a02d/build.log`
ERROR: Error building `PyCall`:
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

# All requested packages already installed.

Retrieving notices: ...working... done
┌ Info: Using the Python distribution in the Conda package by default.
└ To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-run Pkg.build("PyCall").
[ Info: Running `conda install -y numpy` in root environment
ERROR: LoadError: Couldn't find libpython; check your PYTHON environment variable.

```

when digging down, I finally arrive at the following:

```
dlopen(/Users/glenhenshaw/.julia/conda/3/lib/libpython3.9.dylib) ==> ErrorException("could not load library \"/Users/glenhenshaw/.julia/conda/3/lib/libpython3.9.dylib\"\ndlopen(/Users/glenhenshaw/.julia/conda/3/lib/libpython3.9.dylib, 0x0009): tried: '/Users/glenhenshaw/.julia/conda/3/lib/libpython3.9.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))")

```

---

<div class="post-metadata">

### Author: ![awasserman](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@awasserman](https://discourse.julialang.org/u/awasserman)
#### Post date: [October 7, 2022, 9:22pm UTC](https://discourse.julialang.org/t/m1-macbook-macos-julia-1-8-update-issue-cannot-find-libpython/88419/2 "2022-10-07T21:22:55Z")

</div>

Assuming you want to use the version of python installed by homebrew, you should set the “PYTHON” environment variable to the path for the python executable that homebrew installed. If you start your Julia REPL with something like the following,

```bash
PYTHON=$(brew --prefix python3)/bin/python3 julia 

```

see if running `using Pkg; Pkg.build("PyCall")` works.

---

<div class="post-metadata">

### Author: ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)
#### Post date: [October 7, 2022, 9:31pm UTC](https://discourse.julialang.org/t/m1-macbook-macos-julia-1-8-update-issue-cannot-find-libpython/88419/3 "2022-10-07T21:31:35Z")

</div>

Yep, that worked, thanks!
