Skip to content

Instantly share code, notes, and snippets.

@akiatoji
Last active December 29, 2020 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akiatoji/a2e29c00849d145bce5efb80d7459c02 to your computer and use it in GitHub Desktop.
Save akiatoji/a2e29c00849d145bce5efb80d7459c02 to your computer and use it in GitHub Desktop.

This is how I set up GCP VM and my Deep Learning PC for ML and Geo work.

On GCP, I normally use a n1-highmem-4 (4xvCPU, 26GB) with Tesla T4 GPU ($0.4/hr)

My own Deep Learning PC is a Ryzen 3900 (12 cores) 64GB memory and RTX2070 Super ($3K)

Install conda

Install MiniConda.

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 
bash Miniconda3-latest-Linux-x86_64.sh

Install dependencies

These are the go-to packages I use for Machine Learning/Geo/NLTK work.

conda config --add channels conda-forge
conda config --add channels anaconda
conda create -y --name py38-ml python=3.8
conda activate py38-ml

# Note that conda takes a long long looong time to install these
conda install -y qgrid psycopg2 jupyter ipykernel ipython-sql google-cloud-bigquery pandas 
conda install -y beautifulsoup4 gensim nltk seaborn matplotlib
conda install -y tensorflow-gpu scikit-learn ipython-sql python-levenshtein 
conda install -y geopy rtree pyproj shapely geojson krb5 fiona folium geopandas
conda install -y jaydebeapi jupyterthemes

# Install dark theme to stop going blind
jt -t chesterish

# Build a jupyter kernel that uses this environment.  
ipython kernel install --user --name py38-ml

Notes about GeoPandas

GeoPandas adds cool geo features to Pandas. You can do spatial joins (like a GIS), go back/forth between EPSG:4326 and EPSG:3857 easily, and do various map and GeoJSON manipulation using familiar DataFrame paradigm. It's really great for doing Geo work in Jupyter/Python.

Alas, GeoPandas was not easy to install. Above is what I came up with to install GeoPandas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment