Python Forum
Error in code tensorflow is installed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in code tensorflow is installed
#1
The following code on Windows 10 creates the error shown.


import math
import numpy as np
import pandas as pd
import os
import yfinance as yf
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
%matplotlib inline
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()

from keras.models import Sequential
from keras import layers
from keras.layers import Activation, Dropout, Flatten, Dense, Conv2D, MaxPooling2D
Error:
ModuleNotFoundError Traceback (most recent call last) ~\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\__init__.py in <module> 2 try: ----> 3 from tensorflow.keras.layers.experimental.preprocessing import RandomRotation 4 except ImportError: ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) <ipython-input-1-162fe132a741> in <module> 10 register_matplotlib_converters() 11 ---> 12 from keras.models import Sequential 13 from keras import layers 14 from keras.layers import Activation, Dropout, Flatten, Dense, Conv2D, MaxPooling2D ~\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\__init__.py in <module> 4 except ImportError: 5 raise ImportError( ----> 6 'Keras requires TensorFlow 2.2 or higher. ' 7 'Install TensorFlow via `pip install tensorflow`') 8 ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`
However, tensorflow is installed. Both pip list and conda list confirm this.So what is going on? I am using tensorflow 2.3.

Any help appreciated.Thanks in advance.

Respectfuuly,

ErnestTBass
Reply


Messages In This Thread
Error in code tensorflow is installed - by ErnestTBass - Nov-03-2020, 03:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 3,351 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  error : "Microsoft Visual C++ 14.0 is required. " Even its installed Barak 4 4,026 Oct-13-2021, 10:39 PM
Last Post: Underscore
  Installed pip install openpyxl, Requirement already satisfied, but, still have error jonah88888 3 6,686 Sep-24-2021, 02:11 AM
Last Post: jonah88888
  ibm_db error even though package is installed runnerpaul 6 8,859 Mar-28-2017, 07:22 AM
Last Post: runnerpaul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020