[PYTHON] Tensorflow doesn't work!

Set up a machine learning environment on your new laptop from scratch Let's move! Sometimes it didn't work ...

When I looked it up, the settings were quite awkward. I don't think it's anything from an experienced person It was a very high hurdle for beginners, so I will leave it as a memo.

PC environment

OS:Windows10 home 64bit Environment: Anaconda Navigator    Jupiter Notebook GPU:Nvidia GTX1650

Initial setting

Install Anaconda Navigator normally There is a lot of information around here, so it wasn't too difficult.

We are also setting up CUDA and cuDNN for GPU, I will omit that. (Scheduled to write a memo separately)

Create virtual environment

Create a virtual environment, launch a command prompt from the created environment, and install the required amount Things you need to create a CNN, such as pip install tensorflow and pip install keras I set it up.

phenomenon

A program that I imitated myself Learning data by CNN An error occurred when I ran the library related to this guy.

cnn.ipynb


import keras
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.convolutional import MaxPooling2D
from keras.layers import Activation, Conv2D, Flatten, Dense,Dropout
from sklearn.model_selection import train_test_split
from keras.optimizers import SGD, Adadelta, Adagrad, Adam, Adamax, RMSprop, Nadam
from PIL import Image
import numpy as np
import glob
import matplotlib.pyplot as plt
import time
import os

As an error Using TensorFlow backend. ERROR:root:Internal Python error in the inspect module. Below is the traceback from this internal error.

It was quite well published in the literature, but it took time to understand what happened. As a reference, I struggled to see the error report on Github.

result

Visual Studio 2015, 2017 and 2019 redistributable programs distributed by Microsoft It seems that it could not work because it was not installed.

When you enter this world from Python, you will not be exposed to other languages I didn't know that I didn't have C ++.

From Microsoft Support I downloaded and installed a redistributable package and it worked.

Summary

There are many ways to do this in this world I think that it is the correct answer if it moves, but from the perspective of beginners, it is easy to ask which procedure is the correct answer. There are only trials and errors one by one, but even so, I think it's difficult to understand these days.

At the very least, don't get confused when you look back on the memo writing position you have left. I thought or didn't want to leave an easy-to-understand procedure ...

that's all.

Recommended Posts

Tensorflow doesn't work!
Intellisense doesn't work with tensorflow2.0 + VScode
When send_keys doesn't work
When dropbox-sdk-python doesn't work
Fcitx doesn't work on Flatpak
module install if pip install doesn't work
pygame doesn't work on macOS Mojave
When matplotlib doesn't work with python2.7
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1
Pip doesn't work with PyDev in Pleiades
Tensorflow Glossary
pyenv doesn't work with tcl-tk installed by homebrew.
What to do if rails s doesn't work
Putting Ansible in AmazonLinux via yum doesn't work
What to do if atom autocomplete-python doesn't work