diff --git a/03_classification.ipynb b/03_classification.ipynb index 6c8e0db..6c8c7fc 100644 --- a/03_classification.ipynb +++ b/03_classification.ipynb @@ -2374,7 +2374,14 @@ "source": [ "# if running this notebook on Colab or Kaggle, we just pip install urlextract\n", "if IS_COLAB or IS_KAGGLE:\n", - " !pip install -q -U urlextract" + " %pip install -q -U urlextract" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Note:** inside a Jupyter notebook, always use `%pip` instead of `!pip`, as `!pip` may install the library inside the wrong environment, while `%pip` makes sure it's installed inside the currently running environment." ] }, { diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index 8bb30cb..bd65f6b 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -52,7 +52,7 @@ "IS_KAGGLE = \"kaggle_secrets\" in sys.modules\n", "\n", "if IS_COLAB or IS_KAGGLE:\n", - " !pip install -q -U tfx==0.21.2\n", + " %pip install -q -U tfx==0.21.2\n", " print(\"You can safely ignore the package incompatibility errors.\")\n", "\n", "# Scikit-Learn ≥0.20 is required\n", diff --git a/16_nlp_with_rnns_and_attention.ipynb b/16_nlp_with_rnns_and_attention.ipynb index 3c03bc3..e20a868 100644 --- a/16_nlp_with_rnns_and_attention.ipynb +++ b/16_nlp_with_rnns_and_attention.ipynb @@ -57,8 +57,8 @@ "IS_KAGGLE = \"kaggle_secrets\" in sys.modules\n", "\n", "if IS_COLAB:\n", - " !pip install -q -U tensorflow-addons\n", - " !pip install -q -U transformers\n", + " %pip install -q -U tensorflow-addons\n", + " %pip install -q -U transformers\n", "\n", "# Scikit-Learn ≥0.20 is required\n", "import sklearn\n", diff --git a/18_reinforcement_learning.ipynb b/18_reinforcement_learning.ipynb index 5e188d1..787dd6b 100644 --- a/18_reinforcement_learning.ipynb +++ b/18_reinforcement_learning.ipynb @@ -52,8 +52,8 @@ "\n", "if IS_COLAB or IS_KAGGLE:\n", " !apt update && apt install -y libpq-dev libsdl2-dev swig xorg-dev xvfb\n", - " !pip install -q -U tf-agents pyvirtualdisplay gym[box2d]\n", - " !pip install -q -U atari_py==0.2.5\n", + " %pip install -q -U tf-agents pyvirtualdisplay gym[box2d]\n", + " %pip install -q -U atari_py==0.2.5\n", "\n", "# Scikit-Learn ≥0.20 is required\n", "import sklearn\n", @@ -220,7 +220,7 @@ "Alternatively, you can install the [pyvirtualdisplay](https://github.com/ponty/pyvirtualdisplay) Python library which wraps Xvfb:\n", "\n", "```bash\n", - "python3 -m pip install -U pyvirtualdisplay\n", + "%pip install -U pyvirtualdisplay\n", "```\n", "\n", "And run the following code:" @@ -2812,7 +2812,7 @@ "metadata": {}, "source": [ "## 8.\n", - "_Exercise: Use policy gradients to solve OpenAI Gym's LunarLander-v2 environment. You will need to install the Box2D dependencies (`python3 -m pip install -U gym[box2d]`)._" + "_Exercise: Use policy gradients to solve OpenAI Gym's LunarLander-v2 environment. You will need to install the Box2D dependencies (`%pip install -U gym[box2d]`)._" ] }, { diff --git a/19_training_and_deploying_at_scale.ipynb b/19_training_and_deploying_at_scale.ipynb index 526c725..a0cb2b3 100644 --- a/19_training_and_deploying_at_scale.ipynb +++ b/19_training_and_deploying_at_scale.ipynb @@ -54,7 +54,7 @@ " !echo \"deb http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal\" > /etc/apt/sources.list.d/tensorflow-serving.list\n", " !curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | apt-key add -\n", " !apt update && apt-get install -y tensorflow-model-server\n", - " !pip install -q -U tensorflow-serving-api\n", + " %pip install -q -U tensorflow-serving-api\n", "\n", "# Scikit-Learn ≥0.20 is required\n", "import sklearn\n",