Skip to content

Instantly share code, notes, and snippets.

@brianspiering
Forked from Gclabbe/readme_conda_py3.8_tf.md
Last active August 17, 2021 17:30
Show Gist options
  • Save brianspiering/f0d3c271d26cabeccff885e0aab837bb to your computer and use it in GitHub Desktop.
Save brianspiering/f0d3c271d26cabeccff885e0aab837bb to your computer and use it in GitHub Desktop.
Setup for 4thBrain Anaconda Tensorflow CPU / GPU

How to setup Python 3.8 with TensorFlow

  • Create conda environment:
$ conda create --name 4thBrain python=3.8
$ conda activate 4thBrain    
  • pandas (will install numpy)
    • conda install pandas
  • nodejs
    • conda install -c conda-forge nodejs
  • jupyterlab
    • conda install jupyterlab "ipywidgets>=7.5"
    • jupyter labextension install jupyterlab-plotly
  • awswrangler (simplies a lot of very frustrating AWS API crap)
    • conda install -c conda-forge awswrangler
  • plotly (and extensions for jupyterlab)
  • matplotlib (commonly needed for online tutorials)
    • conda install matplotlib
  • SKLearn
    • conda install -c conda-forge scikit-learn
  • XGBoost
    • conda install -c conda-forge xgboost
    • conda install -c conda-forge lightgbm
  • Seaborn
    • conda install -c anaconda seaborn
  • tensorflow-gpu -- this will take a while and you might see package conflicts
    • conda install pip
    • pip install tensorflow-gpu==2.3
  • Elyra - code snippet manager for Jupyter lab

To enable GPU use in JupyterLab

import tensorflow as tf print(tf.version)

config = tf.compat.v1.ConfigProto( gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.8), # device_count = {'GPU': 1} ) config.gpu_options.allow_growth = True session = tf.compat.v1.Session(config=config) tf.compat.v1.keras.backend.set_session(session) print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

More stuff

@brianspiering
Copy link
Author

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