Update installation instructions and have just one environment.yml for all platforms

main
Aurélien Geron 2021-02-15 20:31:59 +13:00
parent a187605710
commit 44e1b9b9ff
4 changed files with 4 additions and 66 deletions

View File

@ -24,25 +24,15 @@ Once Anaconda or miniconda is installed, then run the following command to updat
## Install the GPU Driver and Libraries
If you have a TensorFlow-compatible GPU card (NVidia card with Compute Capability ≥ 3.5), and you want TensorFlow to use it, then you should download the latest driver for your card from [nvidia.com](https://www.nvidia.com/Download/index.aspx?lang=en-us) and install it. You will also need NVidia's CUDA and cuDNN libraries, but the good news is that they will be installed automatically when you install the tensorflow-gpu package from Anaconda. However, if you don't use Anaconda, you will have to install them manually. If you hit any roadblock, see TensorFlow's [GPU installation instructions](https://tensorflow.org/install/gpu) for more details.
If you want to use a GPU then you should also edit environment.yml (or environment-windows.yml if you're on Windows), located at the root of the handson-ml2 project, replace tensorflow=2.0.0 with tensorflow-gpu=2.0.0, and replace tensorflow-serving-api==2.0.0 with tensorflow-serving-api-gpu==2.0.0. This will not be needed anymore when TensorFlow 2.1 is released.
## Create the tf2 Environment
Next, make sure you're in the handson-ml2 directory and run the following command. It will create a new `conda` environment containing every library you will need to run all the notebooks (by default, the environment will be named `tf2`, but you can choose another name using the `-n` option):
$ conda env create -f environment.yml # or environment-windows.yml on Windows
$ conda env create -f environment.yml
Next, activate the new environment:
$ conda activate tf2
## Windows
If you're on Windows, and you want to go through chapter 18 on Reinforcement Learning, then you will also need to run the following command. It installs a Windows-compatible fork of the atari-py library.
$ pip install --no-index -f https://github.com/Kojoley/atari-py/releases atari_py
> **Warning**: TensorFlow Transform (used in chapter 13) and TensorFlow-AddOns (used in chapter 16) are not yet available on Windows, but the TensorFlow team is working on it.
## Start Jupyter
You're almost there! You just need to register the `tf2` conda environment to Jupyter. The notebooks in this project will default to the environment named `python3`, so it's best to register this environment using the name `python3` (if you prefer to use another name, you will have to select it in the "Kernel > Change kernel..." menu in Jupyter every time you open a notebook):

View File

@ -38,25 +38,19 @@ Read the [Docker instructions](https://github.com/ageron/handson-ml2/tree/master
### Want to install this project on your own machine?
Start by installing [Anaconda](https://www.anaconda.com/distribution/) (or [Miniconda](https://docs.conda.io/en/latest/miniconda.html)), [git](https://git-scm.com/downloads), and if you have a TensorFlow-compatible GPU, install the [GPU driver](https://www.nvidia.com/Download/index.aspx).
Start by installing [Anaconda](https://www.anaconda.com/distribution/) (or [Miniconda](https://docs.conda.io/en/latest/miniconda.html)), [git](https://git-scm.com/downloads), and if you have a TensorFlow-compatible GPU, install the [GPU driver](https://www.nvidia.com/Download/index.aspx), as well as the appropriate version of CUDA and cuDNN (see TensorFlow's documentation for more details).
Next, clone this project by opening a terminal and typing the following commands (do not type the first `$` signs on each line, they just indicate that these are terminal commands):
$ git clone https://github.com/ageron/handson-ml2.git
$ cd handson-ml2
If you want to use a GPU, then edit `environment.yml` (or `environment-windows.yml` on Windows) and replace `tensorflow=2.0.0` with `tensorflow-gpu=2.0.0`. Also replace `tensorflow-serving-api==2.0.0` with `tensorflow-serving-api-gpu==2.0.0`.
Next, run the following commands:
$ conda env create -f environment.yml # or environment-windows.yml on Windows
$ conda activate tf2
$ python -m ipykernel install --user --name=python3
Then if you're on Windows, run the following command:
$ pip install --no-index -f https://github.com/Kojoley/atari-py/releases atari_py
Finally, start Jupyter:
$ jupyter notebook

View File

@ -1,46 +0,0 @@
name: tf2
channels:
- conda-forge
- defaults
dependencies:
- atari_py=0.2 # used only in chapter 18
- ftfy=5.8 # used only in chapter 16 by the transformers library
- graphviz # used only in chapter 6 for dot files
- gym=0.18 # used only in chapter 18
- ipython=7.20 # a powerful Python shell
- ipywidgets=7.6 # optionally used only in chapter 12 for tqdm in Jupyter
- joblib=0.14 # used only in chapter 2 to save/load Scikit-Learn models
- jupyter=1.0 # to edit and run Jupyter notebooks
- matplotlib=3.3 # beautiful plots. See tutorial tools_matplotlib.ipynb
- nbdime=2.1 # optional tool to diff Jupyter notebooks
- nltk=3.4 # optionally used in chapter 3, exercise 4
- numexpr=2.7 # used only in the Pandas tutorial for numerical expressions
- numpy=1.19 # Powerful n-dimensional arrays and numerical computing tools
- opencv=4.5 # used only in chapter 18 by TF Agents for image preprocessing
- pandas=1.2 # data analysis and manipulation tool
- pillow=8.1 # image manipulation library, (used by matplotlib.image.imread)
- pip # Python's package-management system
- py-xgboost=0.90 # used only in chapter 7 for optimized Gradient Boosting
- pyglet=1.5 # used only in chapter 18 to render environments
- pyopengl=3.1 # used only in chapter 18 to render environments
- python=3.7 # Python! Not using latest version as some libs lack support
- python-graphviz # used only in chapter 6 for dot files
- requests=2.25 # used only in chapter 19 for REST API queries
- scikit-learn=0.24 # machine learning library
- scipy=1.6 # scientific/technical computing library
- tqdm=4.56 # a progress bar library
- transformers=4.3 # Natural Language Processing lib for TF or PyTorch
- wheel # built-package format for pip
- widgetsnbextension=3.5 # interactive HTML widgets for Jupyter notebooks
- pip:
- tensorboard-plugin-profile==2.4.0 # profiling plugin for TensorBoard
- tensorboard==2.4.1 # TensorFlow's visualization toolkit
- tensorflow-addons==0.12.1 # used only in chapter 16 for a seq2seq impl.
- tensorflow-datasets==3.0.0 # datasets repository, ready to use
- tensorflow-hub==0.9.0 # trained ML models repository, ready to use
- tensorflow-probability==0.12.1 # Optional. Probability/Stats lib.
- tensorflow-serving-api==2.4.1 # or tensorflow-serving-api-gpu if gpu
- tensorflow==2.4.1 # Deep Learning library
- tf-agents==0.7.1 # Reinforcement Learning lib based on TensorFlow
- tfx==0.27.0 # platform to deploy production ML pipelines
- urlextract==1.2.0 # optionally used in chapter 3, exercise 4

View File

@ -20,7 +20,7 @@ dependencies:
- pandas=1.2 # data analysis and manipulation tool
- pillow=8.1 # image manipulation library, (used by matplotlib.image.imread)
- pip # Python's package-management system
- py-xgboost=1.3 # used only in chapter 7 for optimized Gradient Boosting
- py-xgboost=0.90 # used only in chapter 7 for optimized Gradient Boosting
- pyglet=1.5 # used only in chapter 18 to render environments
- pyopengl=3.1 # used only in chapter 18 to render environments
- python=3.7 # Python! Not using latest version as some libs lack support