In my book, Hands-On Machine Learning with Scikit-Learn and Scientific Python Toolkits, I make use of libraries such as Pandas, NumPy, etc.
There are multiple ways to install the needed libraries.
For example you can:
First you need to install Miniforge on your computer. You will find the right installer at the following link for your operating system and architecture. For example, they have installers for Windows, Linux, OSX (Intel) and OSX (Apple Silicon).
Now that you have installed Miniforge, it is time to create a new virtual environment. Let's call it scikitbook, and we will be using Python version 3.6.
To create the environment, go to your terminal (for example, on OSX, open Terminal). Then type the following command into the terminal:
conda create -n scikitbook python=3.6
Note: Newer versions of Python should work too, but the code in the book is tested on 3.6, so let's stick to that version.
Now you need to activate the environment you have just created:
conda activate scikitbook
Then, you need to install NumPy, SciPy, Pandas, etc.
One way is to follow the instructions on page 27 in Hands-On Machine Learning with Scikit-Learn and Scientific Python Toolkits:
pip install --upgrade numpy==1.17.3
pip install --upgrade scipy==1.3.1
pip install --upgrade pandas==0.25.3
pip install --upgrade scikit-learn==0.22
pip install --upgrade matplotlib==3.1.2
pip install --upgrade seaborn==0.9.0
Alternatively, you can clone the book's GitHub repo here, PacktPublishing/Hands-On-Machine-Learning-with-scikit-learn-and-Scientific-Python-Toolkits. Then you can run the following command:
pip install --upgrade -r requirements.txt
You are all set now. Whenever you restart your computer, you just need to run the following command to activate the environment:
conda activate scikitbook
The exact instructions above work for Anaconda too. The only difference is that you need to install the Anaconda/Miniconda from this link instead of Miniforge
Just skip the virtual environment installations, and just install Python 3.6 on your system. Then run the following pip commands:
pip install --upgrade numpy==1.17.3
pip install --upgrade scipy==1.3.1
pip install --upgrade pandas==0.25.3
pip install --upgrade scikit-learn==0.22
pip install --upgrade matplotlib==3.1.2
pip install --upgrade seaborn==0.9.0
Again, you can use the book's GitHub repo here, PacktPublishing/Hands-On-Machine-Learning-with-scikit-learn-and-Scientific-Python-Toolkits. Then run the following command instead of the multiple pip commands above:
pip install --upgrade -r requirements.txt
Feel free to contact me if anything is still not clear.
Links to Amazon are affiliate links.
Tarek Amr