0

I am trying to follow a tutorial for deep learning. I can use my desktop but not my laptop, and I can't find an explanation for why not. I thought it might be that I have python3 installed incorrectly so I reformatted the disk and tried again. Same result.

The test program with most of the lines commented out is

import numpy as np
import tensorflow as tf
#import keras as ks
#from keras.models import Sequential
#from keras.layers import LSTM, Input, Dropout
#from keras.layers import Dense
#rom keras.layers import RepeatVector
#from keras.layers import TimeDistributed
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.preprocessing import MinMaxScaler, StandardScaler
#from keras.models import Model
import seaborn as sns

#dataframe = pd.read_csv('data/GE.csv')
#df = dataframe[['Date', 'Close']]
#df['Date'] = pd.to_datetime(df['Date'])

#sns.lineplot(x=df['Date'], y=df['Close'])

#print("Start date is: ", df['Date'].min())
#print("End date is: ", df['Date'].max())
print("Hello")

If I comment out line 2 with the import tensorflow then it will reach the end and print Hello. If I remove the comment on either tensorflow or keras, the program will crash with a core dump.

My initial guess was perhaps python3 was missing something, so I used synaptic on both the desktop and the laptop. With the hundreds of python3 entries, I failed to see anything which was missing.

Another possibility was either tensorflow or keras was not properly installed, or that keras was missing some prerequisite file. Looking at the documentation, and failed to see anything missing. I also looked to see if they were installed. I got:

ilan@ilan-Lenovo-G585:~$ pip3 list | grep -i keras
Keras                  2.4.3               
Keras-Applications     1.0.6               
Keras-Preprocessing    1.1.2               
ilan@ilan-Lenovo-G585:~$ pip3 list | grep -i tensorflow
tensorflow             2.3.1               
tensorflow-estimator   2.3.0               
tensorflow-gpu         2.3.1               
ilan@ilan-Lenovo-G585:~$ cd ilan/python/python/
ilan@ilan-Lenovo-G585:~/ilan/python/python$ ls
data  ds180.txt  test.py
ilan@ilan-Lenovo-G585:~/ilan/python/python$ python3 test.py
Illegal instruction (core dumped)
ilan@ilan-Lenovo-G585:~/ilan/python/python$ 

The error message didn't give me a clue as to what could be wrong. It just said illegal instruction with a core dump. Import tensorflow as tf isn't exactly illegal, so something must have happened behind the scenes, but what??

Thanks for pointing out that my CPU is simply not good enough to do Tensor flow. This is the first time I have come across such a case, so it didn't cross my mind as a possibility....

Ilan Tal
  • 509
  • 2
  • 8
  • 22
  • There are currently 75 more questions if you search "tensorflow illegal instruction", so please make some search before asking. The duplicate question linked has the reason on why it crashes. – Dr. Snoopy Dec 10 '20 at 15:21

1 Answers1

0

Have you tried to use the setup from anaconda? https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/

or

you can also run it in a container https://www.tensorflow.org/install

Its probably save a lot of time.

Fernando Silva
  • 182
  • 1
  • 11
  • Yes, I did (on the laptop). On the desktop I didn't need to. In the container suggestion it mentions pip. i use pip3 with python3. I assume pip3 is OK? – Ilan Tal Dec 10 '20 at 14:20