Skip to content

Commit 0d2801b

Browse files
Add M1 guidance to install pages.
PiperOrigin-RevId: 438349806
1 parent 65bd57a commit 0d2801b

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

site/en/install/pip.html

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ <h3>Ubuntu</h3>
9191

9292
<section>
9393
<h3>macOS</h3>
94+
<aside class="note">
95+
<strong>Note:</strong>
96+
<span>
97+
For users of Apple M1 computers, to get native performance, you'll want
98+
to follow the instructions found
99+
<a href="https://developer.apple.com/metal/tensorflow-plugin/"
100+
class="external">here</a>.
101+
Conda has shown to have the smoothest install. Some TensorFlow
102+
binaries (specifically, ones with custom C++ extensions like TensorFlow
103+
Decision Forests, object detection, and TFX) are not compiled against M1
104+
targets. If you need those libraries, you will have to use TensorFlow
105+
with x86 emulation and Rosetta.</span>
106+
</aside>
94107
<p>Install using the <a href="https://brew.sh/" class="external">Homebrew</a> package manager:</p>
95108
<pre class="prettyprint lang-bsh">
96109
<code class="devsite-terminal">/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</code>
@@ -143,7 +156,52 @@ <h2>2. Create a virtual environment (recommended)</h2>
143156

144157
<div class="ds-selector-tabs">
145158
<section>
146-
<h3>Ubuntu / macOS</h3>
159+
<h3>Ubuntu</h3>
160+
<p>
161+
Create a new virtual environment by choosing a Python interpreter and making a
162+
<code>./venv</code> directory to hold it:
163+
</p>
164+
<pre class="devsite-terminal devsite-click-to-copy">python3 -m venv --system-site-packages <var>./venv</var></pre>
165+
<p>
166+
Activate the virtual environment using a shell-specific command:
167+
</p>
168+
<pre class="devsite-terminal prettyprint lang-bsh">source <var>./venv</var>/bin/activate # sh, bash, or zsh</pre>
169+
<pre class="devsite-terminal prettyprint lang-bsh">. <var>./venv</var>/bin/activate.fish # fish</pre>
170+
<pre class="devsite-terminal prettyprint lang-bsh">source <var>./venv</var>/bin/activate.csh # csh or tcsh</pre>
171+
172+
<p>
173+
When the virtual environment is active, your shell prompt is prefixed with <code>(venv)</code>.
174+
</p>
175+
<p>
176+
Install packages within a virtual environment without affecting the host system
177+
setup. Start by upgrading <code>pip</code>:
178+
</p>
179+
<pre class="prettyprint lang-bsh">
180+
<code class="devsite-terminal tfo-terminal-venv">pip install --upgrade pip</code>
181+
182+
<code class="devsite-terminal tfo-terminal-venv">pip list # show packages installed within the virtual environment</code>
183+
</pre>
184+
<p>
185+
And to exit the virtual environment later:
186+
</p>
187+
<pre class="devsite-terminal tfo-terminal-venv prettyprint lang-bsh">deactivate # don't exit until you're done using TensorFlow</pre>
188+
</section>
189+
190+
<section>
191+
<h3>macOS</h3>
192+
<aside class="note">
193+
<strong>Note:</strong>
194+
<span>
195+
For users of Apple M1 computers, to get native performance, you'll want
196+
to follow the instructions found
197+
<a href="https://developer.apple.com/metal/tensorflow-plugin/"
198+
class="external">here</a>.
199+
Conda has shown to have the smoothest install. Some TensorFlow
200+
binaries (specifically, ones with custom C++ extensions like TensorFlow
201+
Decision Forests, object detection, and TFX) are not compiled against M1
202+
targets. If you need those libraries, you will have to use TensorFlow
203+
with x86 emulation and Rosetta.</span>
204+
</aside>
147205
<p>
148206
Create a new virtual environment by choosing a Python interpreter and making a
149207
<code>./venv</code> directory to hold it:

0 commit comments

Comments
 (0)