Skip to content

Latest commit

 

History

History
136 lines (101 loc) · 2.48 KB

python-data-science-setup.md

File metadata and controls

136 lines (101 loc) · 2.48 KB

Python for Data Science

Python packages

Install dependencies

# Leave Python virtual environment
deactivate

# Install Graphviz - Keras dependency
brew install Graphviz

Create a Python virtual environment

# Example using Python 3.10.7
pyenv shell 3.10.7
mkvirtualenv py310
pip install --upgrade pip

Install TensorFlow

TensorFlow is an end-to-end open source platform for machine learning.

# Activate the virtual environment
workon py310

# Install TensorFlow
if [[ "$(/usr/bin/uname -m)" == "arm64" ]]; then
    # ARM macOS https://developer.apple.com/metal/tensorflow-plugin
    pip install tensorflow-macos
    pip install tensorflow-metal
else
    # Intel macOS
    pip install tensorflow
fi

Install Keras

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano.

# Activate the virtual environment
workon py310

# Install Keras
pip install h5py pydot keras

Install Python scientific libraires

# Activate the virtual environment
workon py310

# Install libraries
pip install numpy \
            pandas \
            scipy \
            pillow \
            scikit-learn \
            scikit-image \
            sk-video

Install basic libraires

# Activate the virtual environment
workon py310

# Install libraries
pip install autopep8 \
            Cython \
            ipykernel \
            progressbar2 \
            pydocstyle \
            pylint \
            pytest \
            requests \
            markdown

Install Matplotlib

# Activate the virtual environment
workon py310

# Install Matplotlib
pip install ipympl matplotlib

# Fix Matplotlib backend
mkdir -p "${HOME}/.config/matplotlib"
echo "backend : TkAgg" > "${HOME}/.config/matplotlib/matplotlibrc"

Install Jupyter Lab

  1. Install Node

    # Leave Python virtual environment
    deactivate
    
    # Install Node
    brew install node
  2. Install Jupyter Lab

    # Activate Python environment
    workon py310
    
    # Install Jupyterlab
    pip install jupyterlab jupyterlab_widgets ipywidgets
  3. Install Jupyter Lab extensions

    # Activate Python environment
    workon py310
    
    # Install extensions
    pip install tensorboard jupyter-tensorboard jupytext
    
    # Check extensions status
    jupyter labextension list