I tried to follow a tutorial on how to setup tensorflow gpu (https://www.youtube.com/watch?v=tPq6NIboLSc) but on the jupyter step i am getting this error :https://pastebin.com/gm3g8cC5
(ive set in in a pastebin because its very long)
I dont know what to do, ive also tried others tutorial but none of the others works, they also got errors ( but they are differents) at the jupyter step.
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
from object_detection.utils import ops as utils_ops
if StrictVersion(tf.__version__) < StrictVersion('1.12.0'):
raise ImportError('Please upgrade your TensorFlow installation to v1.12.*.')
Here is the part where the errors pops.
I dont know what is my tensorflow version since when i am trying to import it i am getting OSError: [WinError 193] %1 is not a valid Win32 application
Related
I had been using a simple "import tensorflow as tf" command to import tensorflow on my Colab notebook for months. However, just recently the same code and notebooks started giving me the error "from future imports must occur at the beginning of the file".
The tensorflow package version I found on using "!pip list" was "2.8.2+zzzcolab20220719082949".
The main thing confusing me is how a notebook/code that was working perfectly 2 weeks back suddenly starts giving errors.
The code for the cell I ran which gave this error was:
import sys
from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader
from tflite_model_maker.image_classifier import EfficientNetLite0Spec
from tflite_model_maker.image_classifier import EfficientNetLite4Spec
from __future__ import absolute_import, division, print_function, unicode_literals
import matplotlib.pylab as plt
import tensorflow as tf
The error I got was -
File "", line 9
import tensorflow as tf
^
SyntaxError: from future imports must occur at the beginning of the file
You only have to move your __future__ import at the top of your code to make it work:
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader
from tflite_model_maker.image_classifier import EfficientNetLite0Spec
from tflite_model_maker.image_classifier import EfficientNetLite4Spec
import matplotlib.pylab as plt
import tensorflow as tf
Please have a look at the future-statements docs:
A future statement must appear near the top of the module. The only
lines that can appear before a future statement are:
the module docstring (if any),
comments,
blank lines, and
other future statements.
In your case you have other imports before your __future__, which is not allowed.
FileNotFoundError while taking input an image in "load_img" in keras in jupyter notebook
import pickle
import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator,load_img
import json
import requests
import PIL
import matplotlib.pyplot as plt
img=np.array(load_img("IMG_2996.jpg").resize((224,224))).tolist() #Iam getting problem here,in jupyter notebook it is showing filenotfound
url='http://127.0.0.1:5000/model'
requested_data=json.dumps({'img':img})
response = requests.post(url,requested_data)
response.text
Your image file is not in the same directory as your current working directory. This will tell you the directory it's looking for.
import os
print(os.getcwd())
Correct your relative path or use an absolute path.
I am getting this error after running this line of codes to import libraries for implementing a neural style algorithm:
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np
import tensorflow as tf
%matplotlib inline
Do you have a copy of nst_utils.py?
It is part of the work done when going through deeplearning.ai's Deep Learning specialization online course, specifically Week 4 of Convolutional Neural Networks. You need to have a copy of nst_utils.py in the same directory as that code you're running (or that it's added to your sys.path).
If you do a search for nst_utils.py, you'll get some links to github repositories of people who went through the course, and posted their work online, like this: https://github.com/JudasDie/deeplearning.ai. You could probably copy their nst_utils.py code (check their README for usage and license notes), though it would have been better if you went through the course yourself.
I have a deep learning python code (Anaconda3, Ubuntu 16.04) which uses TensorFlow for some machine learning algorithms on video inputs. It imports the following packages:
import time, os, glob, subprocess
import skvideo.io
import numpy as np
import tensorflow as tf
import time, cv2, librosa
import skvideo.io
import numpy as np
import tensorflow as tf
from sklearn.externals import joblib
When running, it get the following warning. How can I remove this warning (or hide it from printing)?
/home/user/anaconda3/lib/python3.5/site-packages/sklearn/base.py:311: UserWarning: Trying to unpickle estimator SVC from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
I am trying to do Google's deep learning course on Udemy. For assignment one I need to verify that the following modules are working on my machine, but can't get matplotlib.pyplot working. The python code I must get to compile is the following:
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle
# Config the matplotlib backend as plotting inline in IPython
%matplotlib inline
When I compile and run this like so:
python3.6 nn_assignment_1.py
I get the following error:
Traceback (most recent call last):
File "nn_assignment_1.py", line 9, in <module>
from IPython import display, Image
ImportError: cannot import name 'Image'
Any ideas how to get matplotlib working for python 3 here? I have been banging my head against the keyboard for hours trying to figure this out.