tensorflow: "No matching distribution found for tensorflow" when installing with pip on macOS 11
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 11.2.1, x86-64
- TensorFlow installed from (source or binary):
pip3 install tensorflow - TensorFlow version: latest
- Python version: 3.8
- Installed using: pip3
Describe the problem
Installation with pip fails with:
$ pip3 install tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
Provide the exact sequence of commands / steps that you executed before running into the problem
# TensorFlow apparently does not yet support 3.9, so fall back to 3.8
brew install python@3.8
brew link --overwrite python@3.8
pip3 install tensorflow
Any other info / logs
Here is verbose output:
$ pip3 install --upgrade -v tensorflow
Using pip 20.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Non-user install because site-packages writeable
Created temporary directory: /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-ephem-wheel-cache-v942l1u1
Created temporary directory: /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-req-tracker-vv4x81gu
Initialized build tracking at /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-req-tracker-vv4x81gu
Created build tracker: /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-req-tracker-vv4x81gu
Entered build tracker: /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-req-tracker-vv4x81gu
Created temporary directory: /private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-install-wju8g2vw
1 location(s) to search for versions of tensorflow:
* https://pypi.org/simple/tensorflow/
Fetching project page and analyzing links: https://pypi.org/simple/tensorflow/
Getting page https://pypi.org/simple/tensorflow/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/tensorflow/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/tensorflow/ HTTP/1.1" 304 0
Skipping link: none of the wheel's tags match: cp27-cp27m-macosx_10_11_x86_64: https://files.pythonhosted.org/packages/90/cf/1d1e12f9f39b6a0ed1c49792ef5ce7615dddc2ce7287fc83ede0dddb9b3c/tensorflow-0.12.0rc0-cp27-cp27m-macosx_10_11_x86_64.whl#sha256=feaf06c7df5c0a480654bf1f38dd4d3b809c7315502a7d9f295033f9d2bd9b13 (from https://pypi.org/simple/tensorflow/)
... OMITTING EXTREMELY LONG LIST OF WHEELS ...
Skipping link: none of the wheel's tags match: cp38-cp38-win_amd64: https://files.pythonhosted.org/packages/ad/fc/fccaa149d7ccc165de01d62d19e5e9492e87ad23a7106f6dfe132800ca6f/tensorflow-2.4.1-cp38-cp38-win_amd64.whl#sha256=eedcf578afde5e6e69c75d796bed41093451cd1ab54afb438760e40fb74a09de (from https://pypi.org/simple/tensorflow/)
Given no hashes to check 0 links for project 'tensorflow': discarding no candidates
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
return func(self, options, args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 323, in run
requirement_set = resolver.resolve(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
self._populate_link(req)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
req.link = self._find_requirement_link(req)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
best_candidate = self.finder.find_requirement(req, upgrade)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 928, in find_requirement
raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for tensorflow
Removed build tracker: '/private/var/folders/7g/m6tkc5n56l7ds_6dyr28jvb00000gn/T/pip-req-tracker-vv4x81gu'
The cause seems to be that it expects at least one wheel whose tags match my machine, but none do. My guess is that this is due to using macOS 11. All lines look like macosx_10_*_x86_64, but I guess it’s looking for a line matching macosx_11_*_x86_64. (Apologies: I know nothing about the python ecosystem; this is just my educated guess.)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 19 (12 by maintainers)
Note: Homebrew now seems to have updated
python@3.8to includepip3version21.0.1. So the following now seems to work:Google does not have access to develop on M1, so until that happens we cannot provide any support there
Doesn’t work on Macbook Air M1, with macOS Big Sur 11.6, Python 3.8.12 and pip 21.3
TF cannot yet support Py3.9 (#44485)
MacOS support is hard to obtain as we depend on a different team which provides us with VMs but they are older macs
So with some help from @8bitmp3 (https://github.com/tensorflow/docs/pull/1820) and @pfmoore (https://github.com/pypa/pip/issues/9621), I found the root cause.
pip from
brew install python@3.8is version 20.2.4, which on macOS 11 only acceptsmacosx_11wheels. But pip 20.3+ includes a change to acceptmacosx_10when running on macOS 11.The fact remains that the TensorFlow installation instructions on macOS are broken. To fix it, at least one of these solutions needs to happen:
brew install python@3.8, dragging in an old version of pip.macos_11, as per https://github.com/tensorflow/tensorflow/issues/45120.python@3.8to 20.3+.