Cannot import tensorflow in Spyder - tensorflow

When I run import keras in Spyder, the error message states that keras cannot find a tensorflow with version > 2.2
When I run import tensorflow, I get the following error message:
File "C:\Users\xxx\Anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Det går inte att hitta den angivna modulen.
(Last message in local tribal language translates as "Can not find the specified module")
I have installed keras and tensorflow via Anaconda using pip. The tensorflow version installed is 2.4.0, Keras 2.4.3 and Python 3.8
If I look in the folder C:\Users\xxx\Anaconda3\Lib\site-packages\tensorflow\python_pywrap_tensorflow_internal, there is a file called _pywrap_tensorflow_internal.lib
I am not a Python expert, but I am guessing this file contains the binary code that should be called when the error is thrown ? The folder C:\Users\xxx\Anaconda3\Lib\site-packages is added to the Python path manager from within Spyder-
I used to being able to run Keras with this computer (Windows 10, x64). But since I formatted the hard drive and reinstalled everything from scratch it does not work. No GPU involved.
Sidenote: Some replies (1, 2) to similar questions on this site suggests it has to do with the Visual studio distribution. I have installed VS 2015, previously I used VS 2019. I would prefere not to install VS 2019 if it can be avoided

Installing the Microsoft Visual C++ 2015 Redistrutable Update 3 solved the problem. I think I found it here

Related

Are there problems with Tensorflow and Keras in Mac version 12.2 (OS Monterey)

I bought a new Mac version 12.2 (OS Monterey) and installed Anaconda. Most of the Python packages can be installed correctly. However, Tensorflow (ver 2.8.0) and Keras (ver 2.8.0) have major issues. The Jupyter notebook kernel gets killed when tensorflow and/or keras get imported. I looked up various posts on Stackoverflow and Medium, however, nothing seems helpful. I even tried to convert the .ipynb to .py script, however, the same error occurs.
Is there anything that can be done to resolve this?

Tensorflow not working on Python 3.7, Mac OS, and Pycharm

Attempting to run tensorflow a Mac, using python 3.7 as well as PyCharm and receiving where module tensorflow has no attribute app, at the following.
I've run through a number of potential solutions. Following the instructions provided on this question: Installing tensorflow on Pycharm (Mac). I've managed to successfully create a virtual-env in which I installed the tensorflow package however this folder contains
nothing but the init.py and pycache and the error remains.
I've also tried copying the contents of the tensorflow GitHub repo directly into this folder but it results in an ImportError.
Not sure what the issue is. Should I switch to python 2.7?
Python 3.7 is still unsupported as of this moment by tensorflow.

Python 3.6 Tensor Flow: Cannot import name 'nccl_ops'

I am trying to test NVIDIA's Style GAN and am encountering an error when trying to run the pretrained_example.py file.
I get an import error from the line from tensorflow.python.ops import nccl_ops
ImportError: cannot import name 'nccl_ops'
I think I installed all the prerequisites properly and am using python 3.6. It could be a mac tensorflow issue possibly because it doesn't mention OSX on the github project. Any help would be appreciated. It might be a matter of installing a different version of tensorflow or something else, I'm not sure.
I updated tensorflow and it solved this issue

On win7 when import tensoreflow it shows "no module named_pywrap_tensorflow" after i do use the vc_redist

the redist(x86) is different from those answers provided before(x64).Is that the point?
Meanwhile it shows "Unless you are using bazel, you should try to import tensorflow from its source directory".But i didn't do that.
Ensure that you have Visual Studio Installed and that MSVCP140.DLL is on your computer AND in your PATH envVar. You shouldn't be building from source on Windows as it is not supported. I assume that you installed via pip?
Check for the DLL, VS, your PATH variables and, if that doesn't work, redownload the vc_redist_x64 version.
Failing that, uninstall Tensorflow and try again with pip install tensorflow or from a nightly. I had a similar issue and starting fresh seemed to help.

glibc 2.14 not recognized by TensorFlow installation in Redhat

After TF complaining about lack of glibc_2.14, I installed glibc_2.14 in my home dir (I am using a supercomputing account,and I don't have root access) However, I still get this error when I try running TF. I have installed TF in anaconda using conda install. The system runs a Red Hat OS.
ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by users/ABCD1234/user123/opt/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so)
I suspect this is due to the TF installation not searching for glibc_2.14 in the home dir, instead searching in /lib64 system folder. How can I make TF work using glibc?
You need GLIBC-2.14, not (ancient) GLIBC-2.1.
In addition, you need to read this answer on how to make your TF program use the copy of GLIBC in your home directory.