Estimated reading time: 6 minutes ![And And](/uploads/1/2/6/7/126741921/898988856.png)
mac, install, download, run, docker, local
Docker Desktop for Mac is the Community version of Docker for Mac.You can download Docker Desktop for Mac from Docker Hub.
By downloading Docker Desktop, you agree to the terms of the Docker Software End User License Agreement and the Docker Data Processing Agreement.
What to know before you install
In this tutorial, we will explain how to install TensorFlow with Anaconda. You will learn how to use TensorFlow with Jupyter. Jupyter is a notebook viewer. Command from answer: py-m pip install –upgrade tensorflow; Now Execute the download of the data that trains the machine. Choose one of the platform install guides, for Mac: Installing TensorFlow on MacOS; Complete install: the r ecommended installation mechanism is `Virtualenv`. Go to the section “Installing with Virtualenv.
- Now install Tensorflow-GPU v1.1 in your conda/virtualenv. For me since I use conda I created a new environment using Terminal: conda create -n egpu python=3 source activate egpu pip install tensorflow-gpu # should install version 1.1 5. Verify that it works. First you have to restart your computer then: In terminal type python and enter.
- To support GPU-backed ML code using Keras, we can leverage PlaidML. These are steps to install TensorFlow, Keras, and PlaidML, and to test and benchmark GPU support. These instructions assume a fresh install of macOS 10.15 Catalina using the system python installation.
README FIRST for Docker Toolbox and Docker Machine users
If you are already running Docker on your machine, first readDocker Desktop for Mac vs. Docker Toolbox to understand theimpact of this installation on your existing setup, how to set your environmentfor Docker Desktop on Mac, and how the two products can coexist.
Relationship to Docker Machine: Installing Docker Desktop on Mac does not affect machines you created with Docker Machine. You have the option to copy containers and images from your local
default
machine (if one exists) to the Docker Desktop HyperKit VM. Whenyou are running Docker Desktop, you do not need Docker Machine nodes running locally (or anywhere else). With Docker Desktop, you have a new, nativevirtualization system running (HyperKit) which takes the place of theVirtualBox system. To learn more, see Docker Desktop for Mac vs. Docker Toolbox.System requirements
Your Mac must meet the following requirements to successfully install Docker Desktop:
- Mac hardware must be a 2010 or a newer model, with Intel’s hardware support for memory management unit (MMU) virtualization, including Extended Page Tables (EPT) and Unrestricted Mode. You can check to see if your machine has this support by running the following command in a terminal:
sysctl kern.hv_support
If your Mac supports the Hypervisor framework, the command printskern.hv_support: 1
. - macOS must be version 10.14 or newer. That is, Mojave or Catalina. We recommend upgrading to the latest version of macOS.If you experience any issues after upgrading your macOS to version 10.15, you must install the latest version of Docker Desktop to be compatible with this version of macOS.Note: Docker supports Docker Desktop on the most recent versions of macOS. Java 1.8 download mac os x. Docker Desktop currently supports macOS Mojave and macOS Catalina.As new major versions of macOS are made generally available, Docker stops supporting the oldest version and support the newest version of macOS.
- At least 4 GB of RAM.
- VirtualBox prior to version 4.3.30 must not be installed as it is not compatible with Docker Desktop.
What’s included in the installer
The Docker Desktop installation includes Docker Engine, Docker CLI client, Docker Compose, Notary, Kubernetes, and Credential Helper.
Install and run Docker Desktop on Mac
- Double-click
Docker.dmg
to open the installer, then drag the Docker icon to the Applications folder. - Double-click
Docker.app
in the Applications folder to start Docker. (In the example below, the Applications folder is in “grid” view mode.)The Docker menu in the top status bar indicates that Docker Desktop is running, and accessible from a terminal.If you’ve just installed the app, Docker Desktop launches the onboarding tutorial. The tutorial includes a simple exercise to build an example Docker image, run it as a container, push and save the image to Docker Hub. - Click the Docker menu () to seePreferences and other options.
- Select About Docker to verify that you have the latest version.
Congratulations! You are now successfully running Docker Desktop.
If you would like to rerun the tutorial, go to the Docker Desktop menu and select Learn.
Uninstall Docker Desktop
To unistall Docker Desktop from your Mac:
- From the Docker menu, select Troubleshoot and then select Uninstall.
- Click Uninstall to confirm your selection.
![And And](/uploads/1/2/6/7/126741921/898988856.png)
Note: Uninstalling Docker Desktop will destroy Docker containers and images local to the machine and remove the files generated by the application.
Switch between Stable and Edge versions
Docker Desktop allows you to switch between Stable and Edge releases. However, you can only have one version of Docker Desktop installed at a time. Switching between Stable and Edge versions can destabilize your development environment, particularly in cases where you switch from a newer (Edge) channel to an older (Stable) channel.
For example, containers created with a newer Edge version of Docker Desktop maynot work after you switch back to Stable because they may have been createdusing Edge features that aren’t in Stable yet. Keep this in mind asyou create and work with Edge containers, perhaps in the spirit of a playgroundspace where you are prepared to troubleshoot or start over.
Experimental features are turned on by default on Edge releases. However, when you switch from a Stable to an Edge release, you must turn on the experimental features flag to access experimental features. From the Docker Desktop menu, click Preferences > Command Line and then turn on the Enable experimental features toggle. Click Apply & Restart for the changes to take effect.
To safely switch between Edge and Stable versions, ensure you save images and export the containers you need, then uninstall the current version before installing another. For more information, see the section Save and Restore data below.
Save and restore data
You can use the following procedure to save and restore images and container data. For example, if you want to switch between Edge and Stable, or to reset your VM disk:
- Use
docker save -o images.tar image1 [image2 ..]
to save any images you want to keep. See save in the Docker Engine command line reference. - Use
docker export -o myContainner1.tar container1
to export containers you want to keep. See export in the Docker Engine command line reference. - Uninstall the current version of Docker Desktop and install a different version (Stable or Edge), or reset your VM disk.
- Use
docker load -i images.tar
to reload previously saved images. See load in the Docker Engine. - Use
docker import -i myContainer1.tar
to create a filesystem image corresponding to the previously exported containers. See import in the Docker Engine.
For information on how to back up and restore data volumes, see Backup, restore, or migrate data volumes.
Where to go next
- Getting started provides an overview of Docker Desktop on Mac, basic Docker command examples, how to get help or give feedback, and links to other topics about Docker Desktop on Mac.
- Troubleshooting describes common problems, workarounds, howto run and submit diagnostics, and submit issues.
- FAQs provide answers to frequently asked questions.
- Release notes lists component updates, new features, andimprovements associated with Stable releases. For information about Edge releases, seeEdge release notes.
- Get started with Docker provides a general Docker tutorial.
![And And](/uploads/1/2/6/7/126741921/912190517.png)
Learning has never been so easy!
TensorFlow doesn't support macOS or AMD/ATI-based GPUs because it uses CUDA, an NVIDIA-specific API. However, many AMD GPUs support OpenCL and Metal. See references for a hardware compatibility list.
To support GPU-backed ML code using Keras, we can leverage PlaidML. These are steps to install TensorFlow, Keras, and PlaidML, and to test and benchmark GPU support.
These instructions assume a fresh install of macOS 10.15 Catalina using the system python installation. If you installed Python from a package or via homebrew these instructions and you probably won't experience the same issues mentioned below.
5 Steps total
Step 1: Download TensorFlow and Keras
First, update pip. Then install TensorFlow.
```
pip install --upgrade pip
pip install tensorflow
```
```
pip install --upgrade pip
pip install tensorflow
```
Step 2: Install PlaidML
```
pip install plaidml-keras plaidbench
```
pip install plaidml-keras plaidbench
```
On macOS 10.15 the system-installed Python does not permit system-wide package installs, so we need to help the plaidml-setup binary locate the plaidml library.
```
export PLAIDML_NATIVE_PATH=/Users/[username]/Library/Python/3.7/lib/libplaidml.dylib
export RUNFILES_DIR=/Users/[username]/Library/Python/3.7/share/plaidml
```
export PLAIDML_NATIVE_PATH=/Users/[username]/Library/Python/3.7/lib/libplaidml.dylib
export RUNFILES_DIR=/Users/[username]/Library/Python/3.7/share/plaidml
```
Replace `[username]` with your username before executing the commands.
Step 3: Configure PlaidML
```
plaidml-setup
```
plaidml-setup
```
You may choose to enable experimental device support, which gives you the OpenCL drivers in addition to the metal ones. You should pick your faster GPU as the default. Then write the configuration file.
Step 4: Test PlaidML
To test PlaidML, we can use the installed `plaidbench` command. However, if using the system Python install on macOS Catalina, we will need to install root SSL certificates, otherwise error `[SSL: CERTIFICATE_VERIFY_FAILED]` will throw during the test.
```
pip install certifi
```
pip install certifi
```
Then run this script:
```
cat > install_certifi.py << EOF
# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module. Uses the certificates provided by the certifi package:
# https://pypi.python.org/pypi/certifi
```
cat > install_certifi.py << EOF
# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module. Uses the certificates provided by the certifi package:
# https://pypi.python.org/pypi/certifi
import os
import os.path
import ssl
import stat
import subprocess
import sys
import os.path
import ssl
import stat
import subprocess
import sys
STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
| stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
| stat.S_IROTH | stat.S_IXOTH )
| stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
| stat.S_IROTH | stat.S_IXOTH )
def main():
openssl_dir, openssl_cafile = os.path.split(
ssl.get_default_verify_paths().openssl_cafile)
openssl_dir, openssl_cafile = os.path.split(
ssl.get_default_verify_paths().openssl_cafile)
# print(' -- pip install --upgrade certifi')
# subprocess.check_call([sys.executable,
# '-E', '-s', '-m', 'pip', 'install', '--upgrade', '--user', 'certifi'])
# subprocess.check_call([sys.executable,
# '-E', '-s', '-m', 'pip', 'install', '--upgrade', '--user', 'certifi'])
import certifi
# change working directory to the default SSL directory
os.chdir(openssl_dir)
relpath_to_certifi_cafile = os.path.relpath(certifi.where())
print(' -- removing any existing file or link')
try:
os.remove(openssl_cafile)
except FileNotFoundError:
pass
print(' -- creating symlink to certifi certificate bundle')
os.symlink(relpath_to_certifi_cafile, openssl_cafile)
print(' -- setting permissions')
os.chmod(openssl_cafile, STAT_0o775)
print(' -- update complete')
os.chdir(openssl_dir)
relpath_to_certifi_cafile = os.path.relpath(certifi.where())
print(' -- removing any existing file or link')
try:
os.remove(openssl_cafile)
except FileNotFoundError:
pass
print(' -- creating symlink to certifi certificate bundle')
os.symlink(relpath_to_certifi_cafile, openssl_cafile)
print(' -- setting permissions')
os.chmod(openssl_cafile, STAT_0o775)
print(' -- update complete')
if __name__ '__main__':
main()
EOF
```
main()
EOF
```
Then run the code to install Python root certs:
```
sudo python3 install_certifi.py
```
```
sudo python3 install_certifi.py
```
Now we can test. Open your Activity Monitor and activate GPU History (Cmd+4). Then run these commands:
```
plaidbench keras mobilenet
plaidbench --batch-size 16 keras --train mobilenet
```
```
plaidbench keras mobilenet
plaidbench --batch-size 16 keras --train mobilenet
```
Compare output with image. Verify a spike in GPU activity.
Step 5: Test with Hello VGG
On the PlaidML Github README, there is a sample Hello VGG script demonstrating how to use PlaidML with Keras. Here is that script:
```
#!/usr/bin/env python
#!/usr/bin/env python
How To Install Tensorflow On Mac
import numpy as np
import os
import time
import os
import time
os.environ['KERAS_BACKEND'] = 'plaidml.keras.backend'
import keras
import keras.applications as kapp
from keras.datasets import cifar10
import keras.applications as kapp
from keras.datasets import cifar10
(x_train, y_train_cats), (x_test, y_test_cats) = cifar10.load_data()
batch_size = 8
x_train = x_train[:batch_size]
x_train = np.repeat(np.repeat(x_train, 7, axis=1), 7, axis=2)
model = kapp.VGG19()
model.compile(optimizer='sgd', loss='categorical_crossentropy',
metrics=['accuracy'])
batch_size = 8
x_train = x_train[:batch_size]
x_train = np.repeat(np.repeat(x_train, 7, axis=1), 7, axis=2)
model = kapp.VGG19()
model.compile(optimizer='sgd', loss='categorical_crossentropy',
metrics=['accuracy'])
print('Running initial batch (compiling tile program)')
y = model.predict(x=x_train, batch_size=batch_size)
y = model.predict(x=x_train, batch_size=batch_size)
# Now start the clock and run 10 batches
print('Timing inference..')
start = time.time()
for i in range(10):
y = model.predict(x=x_train, batch_size=batch_size)
print('Ran in {} seconds'.format(time.time() - start))
```
print('Timing inference..')
start = time.time()
for i in range(10):
y = model.predict(x=x_train, batch_size=batch_size)
print('Ran in {} seconds'.format(time.time() - start))
```
Execute like so after saving file as vgg.py:
```
python3 vgg.py
```
```
python3 vgg.py
```
If you want to compare with TensorFlow, which uses the CPU on macOS instead due to lack of CUDA support, comment out the `os.environ` and keras import statements and replace with this:
```
#!/usr/bin/env python
#!/usr/bin/env python
import numpy as np
import os
import time
import os
import time
#os.environ['KERAS_BACKEND'] = 'plaidml.keras.backend'
#import keras
#import keras.applications as kapp
#from keras.datasets import cifar10
#import keras.applications as kapp
#from keras.datasets import cifar10
How To Download And Install Tensorflow Macos Ubuntu
import tensorflow.keras
import tensorflow.keras.applications as kapp
from tensorflow.keras.datasets import cifar10
import tensorflow.keras.applications as kapp
from tensorflow.keras.datasets import cifar10
(x_train, y_train_cats), (x_test, y_test_cats) = cifar10.load_data()
batch_size = 8
x_train = x_train[:batch_size]
x_train = np.repeat(np.repeat(x_train, 7, axis=1), 7, axis=2)
model = kapp.VGG19()
model.compile(optimizer='sgd', loss='categorical_crossentropy',
metrics=['accuracy'])
batch_size = 8
x_train = x_train[:batch_size]
x_train = np.repeat(np.repeat(x_train, 7, axis=1), 7, axis=2)
model = kapp.VGG19()
model.compile(optimizer='sgd', loss='categorical_crossentropy',
metrics=['accuracy'])
How to download html5 video on mac. print('Running initial batch (compiling tile program)')
y = model.predict(x=x_train, batch_size=batch_size)
y = model.predict(x=x_train, batch_size=batch_size)
# Now start the clock and run 10 batches
print('Timing inference..')
start = time.time()
for i in range(10):
y = model.predict(x=x_train, batch_size=batch_size)
print('Ran in {} seconds'.format(time.time() - start))
```
print('Timing inference..')
start = time.time()
for i in range(10):
y = model.predict(x=x_train, batch_size=batch_size)
print('Ran in {} seconds'.format(time.time() - start))
```
When using TensorFlow, we have to import Keras from TensorFlow instead of calling directly in order to avoid `AttributeError: module 'tensorflow' has no attribute 'get_default_graph'`.
How To Download And Install Tensorflow Macos Installer
By the way, if you get error `RuntimeError: dictionary changed size during iteration` then you either need to upgrade to Python 3.7.5 or edit line 48 of this file:
```
sudo vim /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py
```
Change line 48 from:
```
for mod in sys.modules.values():
```
to:
```
for mod in list(sys.modules.values()): #for mod in sys.modules.values():
```
```
sudo vim /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py
```
Change line 48 from:
```
for mod in sys.modules.values():
```
to:
```
for mod in list(sys.modules.values()): #for mod in sys.modules.values():
```
References
- Apple OpenCL/Metal Hardware Compatibility List
- AttributeError: module 'tensorflow' has no attribute 'get_default_graph
- plaidbench fails with CERTIFICATE_VERIFY_FAILED
- PlaidML
- RuntimeError: dictionary changed size during iteration
- This article on my personal blog
- This article on my personal blog
How To Download Tensorflow On Mac
1 Comment
- Pimientolandolabrum Apr 17, 2020 at 08:15amThat was amazing!! Just trying to wrap my head around what plaidml is doing. I know it is utilizing my GPU's but is this a solution to not getting a eGPU? for my 2020 MacbookPro??