Меню

Pip install tensorflow ошибка

TensorFlow uses GitHub issues,
Stack Overflow and
TensorFlow Forum
to track, document, and discuss build and installation problems.

The following list links error messages to a solution or discussion. If you find
an installation or build problem that is not listed, please search the GitHub
issues and Stack Overflow. If you still can’t find the error message, ask a new
question on Stack Overflow with the tensorflow tag.

GitHub issue or Stack Overflow Error Message
38896424
31058
«No matching distribution found for tensorflow»:
Pip can’t find a TensorFlow package compatible with your system. Check the
system requirements and
Python version
22390
Unzipping simple_console_for_windows.zip to create runfiles tree...
[./bazel-bin/tensorflow/tools/pip_package/simple_console_for_windows.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of ./bazel-bin/tensorflow/tools/pip_package/simple_console_for_windows.zip or
        ./bazel-bin/tensorflow/tools/pip_package/simple_console_for_windows.zip.zip, and cannot find ./bazel-bin/tensorflow/tools/pip_package/simple_console_for_windows.zip.ZIP, period.
36159194
ImportError: libcudart.so.Version: cannot open shared object file:
  No such file or directory
41991101
ImportError: libcudnn.Version: cannot open shared object file:
  No such file or directory
36371137
libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207] A
  protocol message was rejected because it was too big (more than 67108864 bytes).
  To increase the limit (or to disable these warnings), see
  
CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
35252888
Error importing tensorflow. Unless you are using bazel, you should
  not try to import tensorflow from its source directory; please exit the
  tensorflow source tree, and relaunch your python interpreter from
  there.
33623453
IOError: [Errno 2] No such file or directory:
  '/tmp/pip-o6Tpui-build/setup.py'
42006320
ImportError: Traceback (most recent call last):
  File ".../tensorflow/core/framework/graph_pb2.py", line 6, in 
  from google.protobuf import descriptor as _descriptor
  ImportError: cannot import name 'descriptor'
35190574
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
  failed
42009190
  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
  Found existing installation: setuptools 1.1.6
  Uninstalling setuptools-1.1.6:
  Exception:
  ...
  [Errno 1] Operation not permitted:
  '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' 
36933958
  ...
  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
  Found existing installation: setuptools 1.1.6
  Uninstalling setuptools-1.1.6:
  Exception:
  ...
  [Errno 1] Operation not permitted:
  '/tmp/pip-a1DXRT-uninstall/System/Library/Frameworks/Python.framework/
   Versions/2.7/Extras/lib/python/_markerlib'
42006320
ImportError: Traceback (most recent call last):
File ".../tensorflow/core/framework/graph_pb2.py", line 6, in 
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor'
33623453
IOError: [Errno 2] No such file or directory:
  '/tmp/pip-o6Tpui-build/setup.py'
35190574
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
  failed
42009190
  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
  Found existing installation: setuptools 1.1.6
  Uninstalling setuptools-1.1.6:
  Exception:
  ...
  [Errno 1] Operation not permitted:
  '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' 
33622019
ImportError: No module named copyreg
37810228 During a pip install operation, the system returns:

OSError: [Errno 1] Operation not permitted
33622842 An import tensorflow statement triggers an error such as the
following:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py",
    line 4, in 
    from tensorflow.python import *
    ...
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py",
    line 22, in 
    serialized_pb=_b('n,tensorflow/core/framework/tensor_shape.protox12ntensorflow"dnx10TensorShapeProtox12-nx03x64imx18x02
      x03(x0bx32
      .tensorflow.TensorShapeProto.Dimx1a!nx03x44imx12x0cnx04sizex18x01
      x01(x03x12x0cnx04namex18x02 x01(tbx06proto3')
  TypeError: __init__() got an unexpected keyword argument 'syntax'
42075397 A pip install command triggers the following error:

...
You have not agreed to the Xcode license agreements, please run
'xcodebuild -license' (for user-level acceptance) or
'sudo xcodebuild -license' (for system-wide acceptance) from within a
Terminal window to review and agree to the Xcode license agreements.
...
  File "numpy/core/setup.py", line 653, in get_mathlib_info

    raise RuntimeError("Broken toolchain: cannot link a simple C program")

RuntimeError: Broken toolchain: cannot link a simple C program
41007279
[...stream_executordso_loader.cc] Couldn't open CUDA library nvcuda.dll
41007279
[...stream_executorcudacuda_dnn.cc] Unable to load cuDNN DSO
42006320
ImportError: Traceback (most recent call last):
File "...tensorflowcoreframeworkgraph_pb2.py", line 6, in 
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor'
42011070
No module named "pywrap_tensorflow"
42217532
OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits
43134753
The TensorFlow library wasn't compiled to use SSE instructions
38896424
Could not find a version that satisfies the requirement tensorflow
42006320
ImportError: Traceback (most recent call last):
File ".../tensorflow/core/framework/graph_pb2.py", line 6, in 
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor'
33623453
IOError: [Errno 2] No such file or directory:
  '/tmp/pip-o6Tpui-build/setup.py'
35190574
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
  failed
42009190
  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
  Found existing installation: setuptools 1.1.6
  Uninstalling setuptools-1.1.6:
  Exception:
  ...
  [Errno 1] Operation not permitted:
  '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' 
33622019
ImportError: No module named copyreg
37810228 During a pip install operation, the system returns:

OSError: [Errno 1] Operation not permitted
33622842 An import tensorflow statement triggers an error such as the
following:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py",
    line 4, in 
    from tensorflow.python import *
    ...
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py",
    line 22, in 
    serialized_pb=_b('n,tensorflow/core/framework/tensor_shape.protox12ntensorflow"dnx10TensorShapeProtox12-nx03x64imx18x02
      x03(x0bx32
      .tensorflow.TensorShapeProto.Dimx1a!nx03x44imx12x0cnx04sizex18x01
      x01(x03x12x0cnx04namex18x02 x01(tbx06proto3')
  TypeError: __init__() got an unexpected keyword argument 'syntax'
41293077
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow
  library wasn't compiled to use SSE4.1 instructions, but these are available on
  your machine and could speed up CPU computations.
42013316
ImportError: libcudart.so.8.0: cannot open shared object file:
  No such file or directory
42013316
ImportError: libcudnn.5: cannot open shared object file:
  No such file or directory
35953210 Invoking `python` or `ipython` generates the following error:

ImportError: cannot import name pywrap_tensorflow
45276830
external/local_config_cc/BUILD:50:5: in apple_cc_toolchain rule
  @local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified
  to use an Apple CROSSTOOL.
47080760
undefined reference to `cublasGemmEx@libcublas.so.9.0'
22512
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'
22512, 22794
ImportError: DLL load failed: The specified module could not be found.
24835
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: [long path name]

Содержание

  1. Создание и установка сообщений об ошибках
  2. pip Install Error: don’t could find version that satisfies the requirement tensorflow #39130
  3. Comments
  4. pip install tensorflow could not find a version #37457
  5. Comments
  6. Tensorflow release 2.2.0 not found via pip install #39265
  7. Comments
  8. Tensorflow 1.15 doesn’t exists within pip install #34302
  9. Comments
  10. URL(s) with the issue:
  11. Description of issue (what needs changing):

Создание и установка сообщений об ошибках

TensorFlow использует проблемы GitHub , Stack Overflow и форум TensorFlow для отслеживания, документирования и обсуждения проблем сборки и установки.

В следующем списке сообщения об ошибках связаны с решением или обсуждением. Если вы обнаружите проблему установки или сборки, которой нет в списке, выполните поиск по проблемам GitHub и Stack Overflow. Если вы по-прежнему не можете найти сообщение об ошибке, задайте новый вопрос в Stack Overflow с тегом tensorflow .

Проблема с GitHub или переполнение стека Сообщение об ошибке
38896424 31058 «Для tensorflow не найдено подходящего дистрибутива»: Pip не может найти пакет TensorFlow, совместимый с вашей системой. Проверьте системные требования и версию Python
22390
36159194
41991101
36371137
35252888
33623453
42006320
35190574
42009190
36933958
42006320
33623453
35190574
42009190
33622019
37810228 Во время операции установки pip система возвращает:
33622842 Оператор import tensorflow вызывает следующую ошибку:
42075397 Команда установки pip вызывает следующую ошибку:.
41007279
41007279
42006320
42011070
42217532
43134753
38896424
42006320
33623453
35190574
42009190
33622019
37810228 Во время операции установки pip система возвращает:
33622842 Оператор import tensorflow вызывает следующую ошибку:
41293077
42013316
42013316
35953210 При вызове `python` или `ipython` возникает следующая ошибка: .
45276830
47080760
22512
22512 , 22794
24835

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Источник

pip Install Error: don’t could find version that satisfies the requirement tensorflow #39130

hi, I have win10 and I have tried install through cmd tensorflow with:
pip install tensorflow
pip install tensorflow-cpu
pip3 install —upgrade tensorflow

All these pip gave me the same error:

what’s happened? What I need do to fix it?

The text was updated successfully, but these errors were encountered:

I have a possibly related issue: when I use
pip install tensorflow
pip installs the most recent release candidate: https://pypi.org/project/tensorflow/2.2.0rc4/
I’m trying to get the most recent stable version, 2.1.0.

When I try:
pip install tensorflow==2.1.0

I get the error message:

I updated pip to 20.1. Same behavior.
I tried:
pip install tensorflow>=2.0.0
And still got ver 2.2.0rc4

Why is pip installing only the rc’s?

Okay, I think I figured out my issue: I was using Python 3.8 in my environment. I made a new environment using Python 3.7, and the install worked fine.

@an-white,
TensorFlow 2 packages require a pip version >19.0. Could you please upgrade pip using the below command and let us know if it works.

pip install —upgrade pip .

For more information please check this TensorFlow guide. Thanks!

hi, I forgot say that I have python 3.8, this can affect? When I have already upgrade pip, this occurs:

@an-white : I suggest creating a new env with python 3.7 and try installing TF2 there.

Okay, I think I figured out my issue: I was using Python 3.8 in my environment. I made a new environment using Python 3.7, and the install worked fine.

I saw this recommendation on other forums and tried it, but it didn’t work for me.

I’ve tried on 3.7.0 and 3.6.4

Okay, I think I figured out my issue: I was using Python 3.8 in my environment. I made a new environment using Python 3.7, and the install worked fine.

I saw this recommendation on other forums and tried it, but it didn’t work for me.

I’ve tried on 3.7.0 and 3.6.4

As I expected the problem was my fault. but I think is something that can pass unnoticed and explaining it here may help people with a similar setup and issue.

I’m using Python via pyenv-win which is great, but the thing is that I didn’t realize that pyenv install X.Y.Z will install the 32bit version and tensorflow requires 64bit. So, in my case, it was just a matter of installing an actual 64bit version with pyenv install X.Y.Z-amd64

hi, I forgot say that I have python 3.8, this can affect? When I have already upgrade pip, this occurs:

@an-white,
TensorFlow v2.1 is not compatible with Python 3.8. Instead, could you please try installing TF v2.2.0rc4 using the below command

pip install tensorflow==2.2.0rc4

@an-white,
Also, could you please check if you are using the 64 bit version of Python. TensorFlow is tested and supported only on 64-bit systems. Thanks!

Ok, thanks I’m going to check all this recommendation and find if works

Ready thank you so much, the problem was the version that I have of python 32 bit, and already I install the 64 bit version and only need wait for this finish

Now only need wait, any other problem I’ll tell you

Источник

pip install tensorflow could not find a version #37457

System information

  • macOS Catalina version 10.15.3
  • pip install tensorflow
  • GPU model and memory: Intel Iris Plus Graphics 645 1536 MB

The problem
Both pip install tensorflow and pip install tf-nightly lead to the following error messages:

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)

ERROR: No matching distribution found for tensorflow

The text was updated successfully, but these errors were encountered:

Did you try updating your pip version?

As per the documentation TensorFlow 2 packages require a pip version >19.0.

Could you please try the following commands and let us know if it works.
python3 -m pip install —upgrade pip or pip install —upgrade pip and then try

pip install tensorflow

@alexcreature Try updating pip version by:

and the you can again install tensorflow by:

or you can specify version which you want to install.

This seems to be the same as an issue I had previously with both Windows 10 and Ubuntu 18 and Ubuntu 16, no matter the operating system.
The previous issue ( #37205 ) was closed because I proposed a WORK AROUND of downloading the .whl and installing Tensorflow through the downloaded wheel, which worked just fine for me.

Something is broken in the pypi pipeline of installation and needs to be taken care of.

Yes, the issue is that systems use old pip / setuptools by default and these don’t know how to install packages with manylinux2010 tags. That’s why you need to upload pip and setuptools first (and always install in a virtualenv, not globally)

@alexcreature,
Any updates regarding this issue? Thanks!

Yes, the issue is that systems use old pip / setuptools by default and these don’t know how to install packages with manylinux2010 tags. That’s why you need to upload pip and setuptools first (and always install in a virtualenv, not globally)

Okay so here are ALL of the things I have tried in my attempts to simply install tensorflow via pip install:

pip 20.0.2
Python 3.7.6
Win10, globally
Ubuntu 18.04, globally (source built python 3.7.6 and alias setup to avoid breaking apt)
Ubuntu 16.xx, globally, same as above
Win10 pipenv environment (most recent version of pipenv)
Ubuntu 16, 18 pipenv environment (most recent version of pipenv)

I have tried and tested everything I can possibly come up with to make things different but nothing seems to install Tensorflow 2.1 for Python 3.7 for me, in any way shape or form. I have tried pip install tensorflow I have tried pip install tensorflow==2.1 and the absolute only thing I can do is install by downloading the wheel and installing that wheel directly.

Is there something we can do with pip or python source to get this back to working properly? I don’t have ANY issues with any other packages I use across the board, except for Black, but even then sometimes that will install without a hitch and other times I get the same error, though it’s been a long time since I tried and that is not relevant to Tensorflow.

Edit: I cannot find any PEP which shows a breaking change in manylinux tags and pip installs. The most relevant is 571 which states that any pip that is capable of installing manylinux2010 tags will be backwards compatible, and 600 which shows a new naming convention for manylinux tags, but also states that old tags should still work, if I’m reading correctly.
PEP 599 also adds the manylinux2014 tag, however in true python fashion, retains support for manylinux1 and manylinux2010 tags, so this definately should not be the issue, however, I am no source developer and am simply relaying the information I have found.

These are the most relevant PEP’s I have found regarding manylinux wheel tags.

Источник

Tensorflow release 2.2.0 not found via pip install #39265

tldr; pip does not find the new release 2.2.0 published yesterday

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Not Applicable
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu Server 20.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): Not Applicable
  • Python version: 3.8.2
  • PIP version: 20.1
  • CUDA/cuDNN version: Not Applicable (10.2)
  • GPU model and memory: Not Applicable (RTX 2080 Ti)

Describe the current behavior
From the change log and the Github releases I noticed that Tensorflow 2.2.0 was released and that I could upgrade the Tensorflow version currently used in my project (2.2.0rc4). Sadly, pip install failed to install the update as it was unable to find release 2.2.0. (Clearing the cache of pip didn’t help.) The PyPi website also says latest version is the rc4, not the 2.2.0 release.

Describe the expected behavior
Well, I would like to be able to install Tensorflow 2.2.0 over pip .

Standalone code to reproduce the issue
pip install tensorflow==2.2.0

Other info / logs

The text was updated successfully, but these errors were encountered:

Источник

Tensorflow 1.15 doesn’t exists within pip install #34302

Thank you for submitting a TensorFlow documentation issue. Per our GitHub
policy, we only address code/doc bugs, performance issues, feature requests, and
build/installation issues on GitHub.

The TensorFlow docs are open source! To get involved, read the documentation
contributor guide: https://www.tensorflow.org/community/contribute/docs

URL(s) with the issue:

Please provide a link to the documentation entry, for example:
https://www.tensorflow.org/install/pip

Description of issue (what needs changing):

It says tensorflow 1.15 is final version for 1xx versions yet pip install 1.15 returns this

«$ pip3 install tensorflow==1.15
Collecting tensorflow==1.15
Could not find a version that satisfies the requirement tensorflow==1.15 (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow==1.15
«

It should be corrected I think.

The text was updated successfully, but these errors were encountered:

Источник

Internship at OpenGenus

Get this book -> Problems on Array: For Interviews and Competitive Programming

In this article, we have presented the reason behind the error «No matching distribution found for TensorFlow using pip» along with 3 approaches to fix it.

Command used:

pip install tensorflow --user

Error:

Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

Table of contents:

  1. Reason behind the error
  2. Fix 1: Install wheel file directly
  3. Fix 2: Update Python and Pip
  4. Fix 3: Build TensorFlow from source

Reason behind the error

The reason behind the issue will be that the Python installed on your system does not have a corresponding TensorFlow.

Through pip, TensorFlow only supports specific Python version and cases such as:

  • 64-bit system
  • Python version 3.7 to 3.10
  • Ubuntu 16.04 and later versions
  • Windows 7 and later version (with C++)

So, if your system has 32-bit version of Python or a lower version of Python or an older Ubuntu version, then you will face this error.

Different TensorFlow have different dependencies. For example, TensorFlow version 1.12.0 works with Python version 3.5.2 only while TensorFlow version 2.10.0 requires Python version 3.8+.

Fix 1: Install wheel file directly

If you have a pre-built wheel file that matches your system’s Python and pip version, you can install the wheel file directly.

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-2.10.0-py3-none-any.whl

Fix 2: Update Python and Pip

Installing TensorFlow using pip requires you to have 64-bit version of Python version 3.5 to 3.8 and pip version 8.1 and above.

If you have a lower version, upgrading Python and pip will fix the problem.

pip install --upgrade pip

Fix 3: Build TensorFlow from source

If you build TensorFlow from source, you will not face this issue and TensorFlow will get build with any version of Python and pip.

  • Follow these steps:
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
./configure
  • Build the pip wheel file
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mavx512
--copt=-mavx512f --copt=-mavx512vnni --copt=-mfpmath=both --copt=-msse4.1 
--copt=-msse4.2 -k //tensorflow/tools/pip_package:build_pip_package

Note the optimization flags used such has—copt=-mavx512f

  • Prepare the wheel file
bazel-bin/tensorflow/tools/pip_package/
build_pip_package /tmp/tensorflow_pkg
  • Install the wheel file and use TensorFlow
pip install tensorflow-2.10.0-wheel --force

With this article at OpenGenus, you must have fixed the issue of installing TensorFlow using pip.

Python is known for its versatile syntax and English-like keywords. With thousands of modules, you can do data visualization, data processing and even deploy machine learning models. There are many known machine learning models published which help you, namely, Keras, Sklearn, Tensorflow, and PyTorch. Although, while using Tensorflow, you can encounter a No Module named Tensorflow error while running your first program.

No Module Named Tensorflow Error is a known error that arises when the Python Environment is unable to fetch TensorFlow files in site-packages. There are two main reasons for this error to appear, either you have not installed the TensorFlow external module or you are working on a different python environment that doesn’t have Tensorflow. There are several easy ways to fix this error which are mentioned later in this post. Let’s understand the root cause of the error before jumping on the solution.

No Module Named Tensorflow Error

When a module is absent from the external site-library of the environment, the Python interpreter throws ModuleNotFoundError No Module Named Tensorflow. This error arises most of the time on low-end devices because TensorFlow requires proper setup of the c++ path and other requirements. Most of the time, this error is solved by using the pip install method. But if you have multiple Python versions installed, then you’ll definitely face this error.

Why do I get No Module Named Tensorflow Error?

There is no other reason for the No Module Named Tensorflow error other than missing module files. The main problem arises when you’re using multiple python versions and their virtual environment. Keep in mind that, Anaconda, PyCharm, Jupyter, and Spyder have their own virtual environment and it’s tricky to install modules in that environment.

Causes of No Module Named Tensorflow Error

There are some known causes of this ModuleNotFoundError. As Python lets you handle these errors easily, you can debug them quickly. Following are the cause of the No Module Tensorflow error –

Module Not Installed

If you haven’t installed TensorFlow yet and tried importing TensorFlow in code, then it’ll throw this error. Modules are managed by ‘pip’ which is a package management system for your python. Most of the time, the users forget to tick Add Python to the PATH option while installing it. This creates problems in managing the modules.

Supporting Module Not Installed

Tensorflow has many other supporting modules like numpy, scipy, jupyter, matplotlib, pillow, and scikit-learn. If any of these modules is absent, then it’ll throw an error. Make sure that these modules exist in your library.

Moreover, there are other supporting TensorFlow modules like, tensorflow-addons, tensorflow.contrib which might be absent from your library leading to this error.

Tip: To check which libraries are installed in your environment, enter pip list on your console.

Working on Different Virtual Environment

Virtual Environment: Method by which you isolate your working Python environment from the globally installed Python. This environment has its own installation directories and doesn’t share the libraries from globally installed Python.

Many of the code editors in Windows come with their own virtual environment. Each of these environments acts independently to global python installation and is started with blank external modules. Many times, you install a module but it’s installed on global python, not the python from your virtual environment. This can lead to ModuleNotFoundError No Module named Tensorflow in the code execution.

Code editors namely, Anaconda, Jupyter, and Spyder have their own virtual environment. If you have a similar case, head over to the corresponding solution for each code editor.

Solutions for No Module Named Tensorflow

Following are the solutions for this error in each code editor and OS –

Windows

No Module Tensorflow Windows

In Windows, the path-related issues harras the programmers all the time. As you have limited functionality over the terminal, you’re constantly facing with ModuleNotFoundError error. To install TensorFlow in your Windows, make sure you follow these steps –

  1. Uninstall existing python versions to avoid any conflicts.
  2. Go to Python.org and install the Python setup. Make sure you install the 64-bit version. Unfortunately, Tensorflow is not supported in 32 bit systems.
  3. Open the installer and select the “Add Python x.x to your PATH” option. This will ensure, that python executes from the path.
  4. After installing, open the command terminal or PowerShell and enter the command pip install tensorflow in it.
  5. Wait for it to finish the installation and run your python file by command python file.py

Linux

In Linux, it’s relatively easier to install TensorFlow. First of all, check if you are working on a virtual environment by a command which python. This command will return the path of python which you’re going to execute. If you are in a virtual environment, either leave the environment directory or enter the command deactivate to deactivate the virtual environment.

Note: Please do not try to uninstall python in Linux as it’ll interfere with your GDM (Graphical Display Manager). Instead, install a new version and then create your own virtual environment.

Follow these steps to install Tensorflow in Linux –

sudo pip3 install tensorflow

Mac

In Mac, No Module named Tensorflow is a persistent error because of environment errors. If you are working on your virtual environment, you need to deactivate and activate it again. Then use the pip list command to check if the TensorFlow module exists in your library. If not, then use the pip3 install tensorflow to install TensorFlow.

Anaconda

No Module Named Tensorflow in Anaconda

If you’re using Anaconda and you face no module named Tensorflow error, then you probably haven’t installed TensorFlow in the conda environment. As anaconda has a different environment than your default python environment, you need to install TensorFlow in it. To do it follow these steps –

  1. Open Anaconda Prompt on your computer.
  2. Enter the command conda install tensorflow in it.
  3. Wait for the installation to complete and restart the conda shell and run your program.

Jupyter

If you’ve installed Juptyter Notebook from Anaconda, it’ll use a conda environment. By default, the libraries in this environment need to be installed via command. To do the same, open your Conda Prompt and enter the command conda install tensorflow. This will ensure that your Juptyer Notebook has TensorFlow in it.

If your Jupyter is not installed via Anaconda, then use the pip install tensorflow to install the TensorFlow module. This will resolve the error ModuleNotFoundError No module named Tensorflow instantly.

Spyder

Spyder is installed via Anaconda which operates an Anaconda environment. Simply use the command conda install tensorflow in your Anaconda Prompt to install TensorFlow.

PyCharm

PyCharm is a special application that operates in its own virtual environment. Due to the unavailability of the TensorFlow error, you can face the no module found error. Follow these steps to install TensorFlow –

  1. Press Settings and select the Project Interpreter tab under projects.
  2. Now enter Tensorflow in the box and install it.
  3. After installing the package, your error will be resolved.

Supporting ModuleNotFoundError for Tensorflow

Tensorflow has many addons which come in handy to avoid writing long code. These addons and contributions are added separately in other packages and combine with the original TensorFlow module. Following are the examples of ModuleNotFoundError –

No module named ‘tensorflow.contrib’

Unfortunately, the contrib module in TensorFlow is not included in version 2.0. If you still want to use the contrib module, you’ll have to install the previous version of TensorFlow. Follow these steps –

pip uninstall tensorflow
pip install tensorflow==1.13.2

No module named ‘tensorflow_addons’

Use pip install tensorflow-addons to install the addons for TensorFlow.

No Module Named Tensorflow Still Not Resolved?

If you’ve tried all the methods and were still not able to solve the issue then, there might be some hardware limitations. Tensorflow requires Python 3.5-3.7, 64-bit system, and pip>=19.0. If you’re unable to fulfill these hardware + software requirements, then don’t worry, we still have a solution for you!

Google released a free product named ‘Colab‘ in 2018. Colab allows you to run and test machine learning models online. To explain more, it’s a replica of the jupyter notebook with all modules installed. To use Tensorflow in Google Colab follow these steps –

  1. Sign in to your Google account.
  2. Open Colab in your browser.
  3. Create a new Jupyter Notebook. (This notebook will be saved in your google drive).
  4. Type your code and run it.

Using Tensorflow in Colab

Colab has many libraries like TensorFlow, numpy, pandas, etc pre-installed in its shell. Make sure you make good use of it.

Tip: Do not use Colab to store/process peer-to-peer files. This may result in a ban!

See Also

Conclusion

Tensor flow has a flexible architecture. The easy deployment of the code makes it special in nature. However, we have to be very careful before using it. Any small syntax error can result in incorrect importing of the library.

Tensorflow is an open-source platform for Artificial intelligence and it comprises of extensive libraries and community resources that lets researchers push the state-of-the-art in Machine Learning and engineers effectively manufacture and embed ML controlled applications on Microcontrollers and Microprocessors. The computer geeks are able to install Python and PyCharm easily on their systems but when they try to install Tensorflow they encounter the error message: “Could not find a version that satisfies the requirement TensorFlow (from versions: ) No matching distribution found for TensorFlow”. Many people have installed Flask to get rid of this issue but they aren’t able to hence, keeping this in view I’ve compiled some possible solutions to this problem and follow this guide throughout to get rid of this error.

TensorFlow Error

As it turns out, there are several different causes that might end up causing this issue hence let’s move a step ahead and test some fixes until we are able to eliminate this glitch on Windows.

Method 1: Verify Python Version On Your System

If you are running Windows 10, with Python 3.6.X version on your system then most probably Python-32 bit version would’ve been running on 64bit machine. Keep one thing in mind that TensorFlow is only compatible with 64bit installation of python and not 32bit version of python. If you’ve downloaded Python from python.org, the default installation would be 32 bit hence in order to get rid of this issue download a 64bit installer from here. Now, we need to set the PATH environment variable because it lists the directories that will be searched for executables when you type a command in the command prompt. By adding the path to the Python executable, you will be able to access python.exe by typing the python keyword (you won’t need to specify the full path to the program). If the PATH variable is not set the following error occurs:

C:>python
'python' is not recognized as an internal or external command,
operable program or batch file.

As you can see that the command was not found hence to run python.exe, you need to specify the full path to the executable hence to specify the full path to the variable, follow the steps indexed below:

  1. Right-click on My Computer and afterward click on Properties button.
    Choose Properties
  2. On the left side of the window look for Advanced System Settings and after clicking on it you’ll observe that System Properties Window will be opened.
    System properties
  3. Now look for PATH variable option and click on Edit. Position your cursor at the end of the Variable value line and add the path to the python.exe file preceded with the semicolon character (;). In my case, I have added the following value: C:Python36 because I want to run Python 3.6 version.
    Assign Variable Value
  4. Close all the Windows and search for Command Prompt. In the command window type the following command and hit enter. You’ll see that now the 64bit version is present on your system and now I’ll try to install TensorFlow and check whether the error is still there or not:
    C:>python --version
    
    Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
  5. Run the following command to install TensorFlow on your system and hopefully now the installation will proceed without any error message. Note: TensorFlow is not yet in the PyPI repository, so you have to specify the URL to the appropriate “wheel file” for your operating system and Python version.
    pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

    Install Tensorflow

Method 2: Downgrade Your Python Version On Anaconda

Tensorflow only supports Python 3.6.x and only the 64bit version. Hence if you are running GUI like anaconda and python 3.7 is installed by default on it hence, we have to downgrade it to 3.6 to install the Tensorflow. For doing this task run the commands stated below on your Anaconda prompt:

conda install python=3.6.4

After running this command wait for a couple of seconds and then create a Virtual Environment for installing Tensorflow. Name the virtual environment such as “ab” and then install the current release of CPU-only TensorFlow:

conda create -n ab tensorflow
conda activate tf

After downgrading your python version the Tensorflow will now be installed without displaying any error and even if you’ve installed the Desktop version of Ubuntu it will work for that too.

Method 3: Update Package Installer For Python

Pip is the package installer for Python and we can use pip to install packages from the Python Package Index and other indexes. Although updates are released regularly after three months and these packages need to be updated manually on your system by running certain commands. If these are not outdated they might cause this Tensorflow installation error hence, we will update the pip package by running the following commands below so that all the packages are updated automatically:

pip install --upgrade pip

pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

After updating the pip packages hopefully, your installation will run smoothly and you’ll be able to develop interesting programming projects using Tensorflow now.

Workaround: There may not be a version of TensorFlow that is compatible with your version of Python. This is particularly true if you’re using a new release of Python. For example, there may be a delay between the release of a new version of Python and the release of TensorFlow for that version of Python. In this case, I believe that the options mentioned above like downgrading to the previous version of Python, Compiling TensorFlow from the source code and waiting for a matching version of TensorFlow to be released are all the possible remedies that could allow you to install Tensorflow on your system without any glitches.

Photo of Kevin Arrows

Kevin Arrows

Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Buy Me A Coffee

Hi!

Ok, I’ll write this down. I face this issue from time to time, and then after some searching and reading, I found the solution (again!) and I realize I’ve been done this before.

So, I’m installing Tensorflow on Windows with the amazing single command

# Requires the latest pip
pip install --upgrade pip
# Current stable release for CPU and GPU
pip install tensorflow

And then I get this error

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) 
ERROR: No matching distribution found for tensorflow

error installing tensor flow on windows

So, I decided to see what’s happened and I realize that I only have installed Python 3.8. And there is no official TF version for Python 3.8. So, I need to downgrade Python to 3.7.

Time to install earlier Python version

python current version 3.7.6

and then, try to install TensorFlow again. Now, it’s installing

installing tensorflow with current python version

and after installation, test current TF version

tensorflow installed and tested on windows terminal

So, remember: Using the latest Python version, does not warranty to have all the desired packed up to date. Specially with TensorFlow.

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


References

  • Install TensorFlow 2
  • Download Python

При попытке установить tensorflow: py -3.8 -m pip install —user —upgrade tensorflow
Вылетает ошибка о разрыве соединения, при чем интернет стабильный:
Requirement already satisfied: tensorflow in c:pythonpython38libsite-packages (2.2.0)
Collecting tensorflow
Downloading tensorflow-2.4.0-cp38-cp38-win_amd64.whl (370.7 MB)
|█████████▌ | 111.6 MB 128 kB/s eta 0:33:35ERROR: Exception:
Traceback (most recent call last):
File «C:PythonPython38libsite-packagespip_vendorurllib3response.py», line 438, in _error_catcher
yield
File «C:PythonPython38libsite-packagespip_vendorurllib3response.py», line 519, in read
data = self._fp.read(amt) if not fp_closed else b»»
File «C:PythonPython38libsite-packagespip_vendorcachecontrolfilewrapper.py», line 62, in read
data = self.__fp.read(amt)
File «C:PythonPython38libhttpclient.py», line 454, in read
n = self.readinto(b)
File «C:PythonPython38libhttpclient.py», line 498, in readinto
n = self.fp.readinto(b)
File «C:PythonPython38libsocket.py», line 669, in readinto
return self._sock.recv_into(b)
File «C:PythonPython38libssl.py», line 1241, in recv_into
return self.read(nbytes, buffer)
File «C:PythonPython38libssl.py», line 1099, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] Удаленный хост принудительно разорвал существующее подключение

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File «C:PythonPython38libsite-packagespip_internalclibase_command.py», line 224, in _main
status = self.run(options, args)
File «C:PythonPython38libsite-packagespip_internalclireq_command.py», line 180, in wrapper
return func(self, options, args)
File «C:PythonPython38libsite-packagespip_internalcommandsinstall.py», line 320, in run
requirement_set = resolver.resolve(
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibresolver.py», line 121, in resolve
self._result = resolver.resolve(
File «C:PythonPython38libsite-packagespip_vendorresolvelibresolvers.py», line 445, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File «C:PythonPython38libsite-packagespip_vendorresolvelibresolvers.py», line 339, in resolve
failure_causes = self._attempt_to_pin_criterion(name, criterion)
File «C:PythonPython38libsite-packagespip_vendorresolvelibresolvers.py», line 207, in _attempt_to_pin_criterion
criteria = self._get_criteria_to_update(candidate)
File «C:PythonPython38libsite-packagespip_vendorresolvelibresolvers.py», line 198, in _get_criteria_to_update
for r in self._p.get_dependencies(candidate):
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibprovider.py», line 170, in get_dependencies
return [
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibprovider.py», line 170, in
return [
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibcandidates.py», line 257, in iter_dependencies
requires = self.dist.requires() if with_requires else ()
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibcandidates.py», line 239, in dist
self._prepare()
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibcandidates.py», line 226, in _prepare
dist = self._prepare_distribution()
File «C:PythonPython38libsite-packagespip_internalresolutionresolvelibcandidates.py», line 318, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File «C:PythonPython38libsite-packagespip_internaloperationsprepare.py», line 480, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File «C:PythonPython38libsite-packagespip_internaloperationsprepare.py», line 503, in _prepare_linked_requirement
local_file = unpack_url(
File «C:PythonPython38libsite-packagespip_internaloperationsprepare.py», line 253, in unpack_url
file = get_http_url(
File «C:PythonPython38libsite-packagespip_internaloperationsprepare.py», line 130, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File «C:PythonPython38libsite-packagespip_internalnetworkdownload.py», line 163, in __call__
for chunk in chunks:
File «C:PythonPython38libsite-packagespip_internalcliprogress_bars.py», line 168, in iter
for x in it:
File «C:PythonPython38libsite-packagespip_internalnetworkutils.py», line 64, in response_chunks
for chunk in response.raw.stream(
File «C:PythonPython38libsite-packagespip_vendorurllib3response.py», line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File «C:PythonPython38libsite-packagespip_vendorurllib3response.py», line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File «C:PythonPython38libcontextlib.py», line 131, in __exit__
self.gen.throw(type, value, traceback)
File «C:PythonPython38libsite-packagespip_vendorurllib3response.py», line 455, in _error_catcher
raise ProtocolError(«Connection broken: %r» % e, e)
pip._vendor.urllib3.exceptions.ProtocolError: («Connection broken: ConnectionResetError(10054, ‘Удаленный хост принудительно разорвал существующее подключение’, None, 10054, None)», ConnectionResetError(10054, ‘Удаленный хост принудительно разорвал существующее подключение’, None, 10054, None))

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Pip install talib ошибка
  • Pip install socket ошибка