api_key: IAM API キー。 新しい API キーを作成するには、IBM Cloudウェブサイトにアクセスし、[Manage] > [Access(IAM)] > [API keys] の下にある[Create anIBM Cloud Pak for DataAPI key] をクリックします。
Mac で M シリーズを使用している場合は、以下のスクリプトを使用して最新のパッケージをインストールします。
# -----------------------------------------------------------------------------------------# (C) Copyright IBM Corp. 2023.# https://opensource.org/licenses/BSD-3-Clause# -----------------------------------------------------------------------------------------### Script to create a conda environment and install ibm_watsonx_ai with# the dependencies required for Federated Learning on MacOS.# The name of the conda environment to be created is passed as the first argument.## Note: This script requires miniforge to be installed for conda.#
usage=". install_fl_rt23.1_macos.sh conda_env_name"
arch=$(uname -m)
os=$(uname -s)
if (($# < 1))
thenecho$usageexitfi
ENAME=$1
conda create -y -n ${ENAME} python=3.10
conda activate ${ENAME}
pip install ibm_watsonx_ai
if [ "$os" == "Darwin" -a "$arch" == "arm64" ]
then
conda install -y -c apple tensorflow-deps
fi
python - <<EOF
import pkg_resources
import platform
import subprocess
package = 'ibm_watsonx_ai'
extra = 'fl-rt23.1-py3.10'
extra_ = extra.replace('.','-')
extra_s = '; extra == "{}"'
remove = None
add = []
if platform.system() == "Darwin" and platform.processor() == "arm":
remove = 'tensorflow'
add = ['tensorflow-macos==2.9.2']
pkgs = pkg_resources.working_set.by_key[package].requires(extras=[extra])
pkgs = [ p.__str__().removesuffix(extra_s.format(extra)).removesuffix(extra_s.format(extra_)) for p in pkgs if ( extra in p.__str__() or extra_ in p.__str__() ) and ( not remove or remove not in p.__str__() )]
print( "Installing standard packages for {}[{}]:{}".format(package,extra,pkgs) )
print( "Installing additional packages:{}".format(add) )
cmd = [ 'pip', 'install'] + add + pkgs
subprocess.run( cmd )
EOF