To install Swift for Tensorflow visit https://github.com/tensorflow/swift/.
Creating a new Xcode Projects?
See NewProjects.md.
Take the following steps to install OpenAI Gym using Miniconda:
brew install cmake boost boost-python sdl2 swig wget
(if sdl2 fails / try proceeding without it)
https://conda.io/docs/_downloads/conda-cheatsheet.pdf
Setting up miniconda
brew install wget
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x Miniconda3-latest-MacOSX-x86_64.sh
./Miniconda3-latest-MacOSX-x86_64.sh
Add miniconda to user path / zsh
code ~/.zshrc
export PATH="/Users/YOURUSERNAMENAMEHERE/miniconda3/bin:$PATH"
Install GymAI / pyTorch / sklearn
// https://conda.io/miniconda.html
conda create -n gymai2 python=2.7.9
conda activate gymai2
pip install --upgrade pip
pip install "gym[atari]"
pip install sklearn
# for pytorch
conda install -c pytorch pytorch
pip install Cython
pip install torchvision
IMPORTANT
-
Be sure to use python 2.7.9 to avoid missing python symbols (__PyCodecInfo_GetIncrementalDecoder)
-
There's a hack required to get torchvision to load testing / training data used in Pytorch.swift.
In your Users/USERNAMEHERE/miniconda3/envs/gymai2/lib/python2.7/site-packages/
rename torchvision-0.2.1-py2.7.egg file to
torchvision-0.2.1-py2.7.zip
unzip files to site-packages -
You will need to update variable customClassPath in PyTorch.swift to point to hard coded path of project Sources folder. Why? The app at runtime will read in the NeuralNet.py class NeuralNet.py
Troubleshooting
Ensure conda environment is correctly activate in pre-actions of xcode schema.
Schema > Run > Pre-actions
conda activate gymai2