[PYTHON] I set up TensowFlow and was addicted to it, so make a note

The beginning of that

When I installed TensowFlow using pip and tried to check the operation, the following error occurred. Thanks to this guy, I was able to confirm the operation of TensowFlow. You can already get it at the stage of importing tensorflow ...

  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow import contrib
  File "/Library/Python/2.7/site-packages/tensorflow/contrib/__init__.py", line 23, in <module>
    from tensorflow.contrib import layers
  File "/Library/Python/2.7/site-packages/tensorflow/contrib/layers/__init__.py", line 68, in <module>
    from tensorflow.contrib.layers.python.layers import *
  File "/Library/Python/2.7/site-packages/tensorflow/contrib/layers/python/layers/__init__.py", line 22, in <module>
    from tensorflow.contrib.layers.python.layers.initializers import *
  File "/Library/Python/2.7/site-packages/tensorflow/contrib/layers/python/layers/initializers.py", line 24, in <module>
    from tensorflow.python.ops import random_ops
  File "/Library/Python/2.7/site-packages/tensorflow/python/ops/random_ops.py", line 23, in <module>
    from tensorflow.python.framework import ops
  File "/Library/Python/2.7/site-packages/tensorflow/python/framework/ops.py", line 39, in <module>
    from tensorflow.python.framework import versions
  File "/Library/Python/2.7/site-packages/tensorflow/python/framework/versions.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import

To summarize the contents of this error, something like "The version of numpy I loaded did not work well due to duplication".

How did you solve it?

After investigating various things, the method is "Uninstall all numpy and reinstall it". First, see the following blog, move to the corresponding folder and uninstall. http://sechiro.hatenablog.com/entry/2016/04/02/Mac%E3%81%ABTensorFlow%E3%82%92%E5%85%A5%E3%82%8C%E3%82%88%E3%81%86%E3%81%A8%E3%81%97%E3%81%9F%E3%82%89%E3%80%81Numpy%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E5%87%BA%E3%81%9F%E3%81%AE%E3%81%A7

However, the content of the error message did not change, so I searched for information and found another candidate for the installation location of numpy. Delete + reinstall according to the following blog. http://d.hatena.ne.jp/aremokoremo/20140507/1399475248

Then I was able to import TensowFlow successfully, and I was able to start the programming life with TensowFlow.

If you get an error message similar to mine and get hooked ...

Check if there is numpy in the following two folders. Then delete all numpy from the following folders and then reinstall the new numpy.

Recommended Posts

I set up TensowFlow and was addicted to it, so make a note
Docker x visualization didn't work and I was addicted to it, so I summarized it!
[Fabric] I was addicted to using boolean as an argument, so make a note of the countermeasures.
Work memorandum (pymongo) Part 3. I don't want to look it up again, so make a note of it (aggregate)
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
[Python] I tried to implement stable sorting, so make a note
A note I was addicted to when making a beep on Linux
A note I was addicted to when creating a table with SQLAlchemy
I tried to find out the difference between A + = B and A = A + B in Python, so make a note
I tried to make a calculator with Tkinter so I will write it
A note I looked up to make a command line tool in Python
[Introduction to json] No, I was addicted to it. .. .. ♬
A note I was addicted to when running Python with Visual Studio Code
I stumbled upon using MoviePy, so make a note
A story that I was addicted to at np.where
I wanted to use the find module of Ansible2, but it took some time, so make a note
In IPython, when I tried to see the value, it was a generator, so I came up with it when I was frustrated.
A Python beginner made a chat bot, so I tried to summarize how to make it.
It is troublesome to change the settings between the intranet and business trip / at home, so I was a little happy when I set up a forward proxy locally with Apache2.
PyTorch's book was difficult to understand, so I supplemented it
Steps to set up Pipenv, create a CRUD app with Flask, and containerize it with Docker
There was a doppelganger, so I tried to distinguish it with artificial intelligence (laughs) (Part 1)
I was addicted to multiprocessing + psycopg2
A story that I was addicted to calling Lambda from AWS Lambda.
Note that I was addicted to sklearn's missing value interpolation (Imputer)
I tried to make a periodical process with Selenium and Python
I want to create a pipfile and reflect it in docker
I was addicted to confusing class variables and instance variables in Python
I was a little addicted to installing Python3.3 + mod_wsgi3.4 on Sakura VPS (CentOS), so a retrospective memo
When I tried to scrape using requests in python, I was addicted to SSLError, so a workaround memo
I wrote AWS Lambda, and I was a little addicted to the default value of Python arguments
Note that I was addicted to accessing the DB with Python's mysql.connector using a web application.
[Python] When I tried to make a decompression tool with a zip file I just knew, I was addicted to sys.exit ()
I touched "Orator" so I made a note
A story I was addicted to when inserting from Python to a PostgreSQL table
I was addicted to pip install mysqlclient
Set up a yum repository server on CentOS7 system and refer to it locally and from other servers.
I came up with a way to make a 3D model from a photo.
A story I was addicted to trying to get a video url with tweepy
Set up a Lambda function and let it work with S3 events!
GCP's Cloud Shell Editor was clogged up with the Python development environment, so I managed to rebuild it in a vacant lot.
Use Python from Java with Jython. I was also addicted to it.
I was addicted to Flask on dotCloud
I got stuck trying to install various things with Mac El captain pip, so make a note
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
It was dangerous to specify a relative path when generating a symbolic link
I set up TensowFlow and was addicted to it, so make a note
I was surprised to receive a nice review when I wrote Python to CheckIO and its explanation
How to make a container name a subdomain and make it accessible in Docker
[Hi Py (Part 1)] I want to make something for the time being, so first set a goal.
I tried to make a Web API
What I was addicted to Python autorun
I want to make a web application using React and Python flask
The tree.plot_tree of scikit-learn was very easy and convenient, so I tried to summarize how to use it easily.
I thought it was the same as python, and I was addicted to the problem that the ruby interpreter did not start.
Suddenly I needed to work on a project using Python and Pyramid, so a note of how I'm studying
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
What I was addicted to when creating a web application in a windows environment
When I tried to make a VPC with AWS CDK but couldn't make it
Somehow the code I wrote worked and I was impressed, so I will post it
I want to make a music player and file music at the same time
I want to write an element to a file with numpy and check it.
Three things I was addicted to when using Python and MySQL with Docker
I was able to mock AWS-Batch with python, moto, so I will leave it