mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
patch python sysconfig so that extensions (greenlet & grpcio) can build
This commit is contained in:
parent
4c035ad4ae
commit
7707bc7818
@ -29,7 +29,7 @@ OS_NAME=$(uname -s)
|
|||||||
case "${OS_NAME}" in
|
case "${OS_NAME}" in
|
||||||
Linux*) OS_NAME="linux";;
|
Linux*) OS_NAME="linux";;
|
||||||
Darwin*) OS_NAME="darwin";;
|
Darwin*) OS_NAME="darwin";;
|
||||||
*) echo -e "\n----- Unknown OS: $OS_NAME! This script runs only on Linux or MacOS -----\n" && exit
|
*) echo -e "\n----- Unknown OS: $OS_NAME! This script runs only on Linux or macOS -----\n" && exit
|
||||||
esac
|
esac
|
||||||
|
|
||||||
OS_ARCH=$(uname -m)
|
OS_ARCH=$(uname -m)
|
||||||
@ -154,6 +154,19 @@ echo -e "\n***** Unpacked python-build-standalone *****\n"
|
|||||||
|
|
||||||
# create venv
|
# create venv
|
||||||
_err_msg="\n----- problem creating venv -----\n"
|
_err_msg="\n----- problem creating venv -----\n"
|
||||||
|
|
||||||
|
if [ "$OS_NAME" == "darwin" ]; then
|
||||||
|
# patch sysconfig so that extensions can build properly
|
||||||
|
# adapted from https://github.com/cashapp/hermit-packages/commit/fcba384663892f4d9cfb35e8639ff7a28166ee43
|
||||||
|
PYTHON_INSTALL_DIR="$(pwd)/python"
|
||||||
|
SYSCONFIG="$(echo python/lib/python*/_sysconfigdata_*.py)"
|
||||||
|
TMPFILE="$(mktemp)"
|
||||||
|
chmod +w "${SYSCONFIG}"
|
||||||
|
cp "${SYSCONFIG}" "${TMPFILE}"
|
||||||
|
sed "s,'/install,'${PYTHON_INSTALL_DIR},g" "${TMPFILE}" > "${SYSCONFIG}"
|
||||||
|
rm -f ${TMPFILE}
|
||||||
|
fi
|
||||||
|
|
||||||
./python/bin/python3 -E -s -m venv .venv
|
./python/bin/python3 -E -s -m venv .venv
|
||||||
_err_exit $? _err_msg
|
_err_exit $? _err_msg
|
||||||
# In reality, the following is ALL that 'activate.bat' does,
|
# In reality, the following is ALL that 'activate.bat' does,
|
||||||
|
@ -95,7 +95,7 @@ source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # otherwise conda complains abou
|
|||||||
|
|
||||||
conda activate
|
conda activate
|
||||||
if [ "$OS_NAME" == "mac" ]; then
|
if [ "$OS_NAME" == "mac" ]; then
|
||||||
echo "Macintosh system detected. Installing MPS and CPU support."
|
echo "macOS detected. Installing MPS and CPU support."
|
||||||
ln -sf environments-and-requirements/environment-mac.yml environment.yml
|
ln -sf environments-and-requirements/environment-mac.yml environment.yml
|
||||||
else
|
else
|
||||||
if (lsmod | grep amdgpu) &>/dev/null ; then
|
if (lsmod | grep amdgpu) &>/dev/null ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user