Importing tensorflow_datasets - installation

I am trying to import tensorflow_datasets to load a data set, but I found that I should install tensorflow_datasets using either pip or conda. I installed it twice using both methods. But tensorflow_datasets do not still work in jupyter notebook. In the last attempt I got the following error:
ImportError: cannot import name 'kwarg_only' from 'tensorflow.python.util.tf_export'
Plus
Failed to import TensorFlow. Please note that TensorFlow is not installed by default when you install TensorFlow Datasets. This is so that users can decide whether to install the GPU-enabled TensorFlow package. To use TensorFlow Datasets, please install the most recent version of TensorFlow, by following instructions at https://tensorflow.org/install.
While I have TensorFlow installed. I searched the net but none of the solutions solved the problem. Any help is appreciated.

Try to create a separate environment and then install tensorflow and tensorflow_datasets using pip install tensorflow==2.0.0 and pip install tensorflow_datasets==2.1.0. Its works fine.

Related

difference between conda install and pip install in jupyter notebook

I'm a little confused with package install in anaconda environment.
I can install my python packagse in the following ways.
open anaconda prompt and do : conda install tensorflow
launch an jupyter notebook from anaconda prompt, choose the default python kernel, and do:
!pip install tensorflow
Can someone tell me what is the difference between these two cases? Where are the python packages installed? What happens when I pip install python packages in default kernel in jupyter notebook?
I was able to install tensorflow in jupyter notebook in default kernel (python3), but trying to import tensorflow give me module note found error. Does anyone know why that happened? What is happening under the hood? Very much appreciate any help to clarification.
pip is the default package manager that ships with python. Conda is also a package manager, but it is third party. Conda was made especially for data science libraries. Libraries installed with conda usually give much better performance than pip. In pip, the packages are stored in python/scripts and conda stores them at /anaconda/pkgs/. As for the module not found error. I would need more information about it, but you can check out this video. I learnt how to install TensorFlow here and would highly recommend it.

Could not find a version that satisfies the requierement for installing tensorflow via pip

C:\Users\Recep>py -m pip install tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
I looked up in the net learned that this error happens when your out of some packages thats important but when i looked up in the tensorflows website looks like i have all the packages thats needed.thank you in advance.

StopIteration: Could not import PIL.Image. The use of `array_to_img` requires PIL error

import keras
Using TensorFlow backend.
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
rescale=1./255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)
training_set = train_datagen.flow_from_directory(
'E:/Python/A-
Z/Convolutional_Neural_Networks/dataset/training_set',
target_size=(64, 64),
batch_size=32,
class_mode='binary')
test_set = test_datagen.flow_from_directory(
'E:/Python/A-
Z/Convolutional_Neural_Networks/dataset/test_set',
target_size=(64, 64),
batch_size=32,
class_mode='binary')
classifier.fit_generator(
training_set,
steps_per_epoch=8000,
epochs=25,
validation_data=test_set,
validation_steps=2000)
please help I am a beginner in this CNN I am using keras to program the task but I am getting the above error(given in the title)
I have tried installing and then uninstalling pillow
but nothing working it is showing the same error I have also tried some other StackOverflow answers but they are also not working
I came the same error as you.
this is my environment:
I create "tensorflow" env in anaconda, python 3.6 kernel,activate the env, then
pip install tensorflow
pip install keras
pip install pillow
and the error was fixed.
I had the same problem. If you are using Anaconda and the Jupyter notebook this is what worked for me.
Close your notebook and stop Jupyter.
Exit out of your environment
Restart the environment again and run:
pip install pillow
and then:
pip install jupyterlab
and start jupyter-notebook back up and then add or (re-run):
from PIL import Image
In your notebook and hopefully .fit_generator will no longer throw that error.
The following is applicable to Windows users working with Anaconda:
If you've installed 'tensorflow' with pip, or a pip variant (ie. pip3), then you will have to install tensorflow again, but this time with the command conda install tensorflow.

PyTorch doesn't import after installing Anaconda

I just installed PyTorch after installing Anaconda, and when I run iPython using Anaconda Python, it won't find PyTorch.
However I can verify PyTorch is in the pkgs directory of my anaconda folder.
What's going on?
While the framework name is Pytorch, it must be imported using the torch namespace like so import torch. If you look at the official documentation here, you will see any pytorch related module import like nn or autograd is done through the torch namespace. I admit it is a bit confusing but I guess it was done to instill a sense of familiarity for old torch7 users. Also, there is a very good introduction tutorial which you could probably use to familiarize yourself better with the ins and outs of pytorch found here. Hope this helps!
The Py Torch package might have installed to a different python environment that you might have on your system.
You can see the entire list of python packages installed in your current environment using
pip freeze
Ensure that the pip command being executed belongs to Anaconda distribution. The following command will provide the path of the pip executable.
which pip

installing python packages via pip issues

all I want is install pandas comfortably the package pandas via pip.
Inside python I get the following error message:
>>> pip install pandas
c:\python34\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly executed
Allright then I use the windows powershell
PS C:\Windows\system32> C:\Python34\python.exe -m pip install pandas
C:\Python34\python.exe: No module named pip
I had uninstalled and reinstalled python because I used at first the 32-Bit version but wanted 64-Bit, but had some issues so switched back to the 32-Bit version.
Before the reinstallation process I remember, that I could get pip to work but due to proxy issues didn't get very far. I am not a hundred percent positive but I might have gotten around the proxy issue at least.
Don't know what to do. Can somebody help.
thanks
Gerrit

Resources