Reputation: 19
I have installed tensorflow using pip through Terminal on my Mac and I am trying to use it in Pycharm. But for some reason, I keep getting this error:
ModuleNotFoundError: No module named 'tensorflow.python.client'
I am running this code:
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
print(tf.__version__)
I have looked at this page for basic installation (https://www.tensorflow.org/install/pip) and after following the instructions in Terminal I can run this code:
python3 -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
And this is the corresponding output:
2020-07-15 10:57:44.397351: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-15 10:57:44.436720: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x12aa14200 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-15 10:57:44.436757: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
tf.Tensor(-627.3514, shape=(), dtype=float32)
Hopefully, I have provided enough details to sort the issue, I am trying to run basic ML using tensorflow :)
Upvotes: 0
Views: 2087
Reputation: 3648
Pycharm uses a virtual environment for each of the projects. If you go under settings -> python interpreter (see image), you can check which one you're running. I expect it's installed under a different environment and you'll be able to switch it to the correct one.
Upvotes: 1