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

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)))")

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,

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

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

Yep, that worked, thanks!