[PYTHON] 63rd day I installed tensorflow.

I installed tensorflow to grab a bit of machine learning. I thought I could do it quickly with pip install tensorflow, but I got an error here and there, and the time required exceeded 2 hours. I had to install PyHamcrest and wrapt in advance.

The following is a memorandum.

First pip install tensorflow

$ pip install tensorflow
Collecting tensorflow
(Kettle and download)
ERROR: twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: wrapt, astor, setuptools, markdown, cachetools, rsa, google-auth, requests, oauthlib, requests-oauthlib, google-auth-oauthlib, tensorboard, tensorflow
  Found existing installation: wrapt 1.10.11
ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

PyHamcrest? Pie ham crest? It's a delicious name. Looking at pip3 list, it is not installed.

You can do it with pip install PyHamcrest. What is a matcher object? ?? ?? A framework that seems to be important. https://pypi.org/project/PyHamcrest/

$ pip install PyHamcrest
Collecting PyHamcrest
  Downloading https://files.pythonhosted.org/packages/9a/d5/d37fd731b7d0e91afcc84577edeccf4638b4f9b82f5ffe2f8b62e2ddc609/PyHamcrest-1.9.0-py2.py3-none-any.whl (52kB)
     |████████████████████████████████| 61kB 1.3MB/s 
Requirement already satisfied: six in /anaconda3/lib/python3.7/site-packages (from PyHamcrest) (1.11.0)
Requirement already satisfied: setuptools in /anaconda3/lib/python3.7/site-packages (from PyHamcrest) (40.2.0)
Installing collected packages: PyHamcrest
Successfully installed PyHamcrest-1.9.0

Second pip install tensorflow

$ pip install tensorflow
Collecting tensorflow
  Using cached https://files.pythonhosted.org/packages/2c/72/6b3264aa2889b7dde7663464b99587d95cd6a5f3b9b30181f14d78a63e64/tensorflow-2.0.0-cp37-cp37m-macosx_10_11_x86_64.whl
Requirement already satisfied:
(Because it is the second time, installation will proceed steadily without being downloaded)
ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Py Hamcrest is clear. But there are still errors.

ERROR: Cannot uninstall 'wrapt’. What the hell is this? ?? ??

What is wrapt?

"Wrapt is a library that helps Graham Dumpleton (the author of mod_wsgi) write wrappers." https://qiita.com/yoichi22/items/df42d1f038ff2423e37b

What are distutils?

The distutils package helps you build modules to add to your currently installed Python, and actually install them. https://docs.python.org/ja/3/library/distutils.html

Does it mean that these packages aren't working? ?? ??

What is conda?

The conda command is installed in Anaconda, and you can install packages and create / switch the execution environment. https://www.python.jp/install/anaconda/conda.html

Try searching again with the error message.

ERROR: Cannot uninstall 'wrapt'. during upgrade  https://github.com/tensorflow/tensorflow/issues/30191

A similar problem and a solution.

・ Update conda ・ Updated ‘wrapt’ of conda · Update, remove, ignore wrapt with pip

It looks like I should do something about wrapt!

conda install wrapt

$ conda install wrapt
Solving environment: done

## Package Plan ##

  environment location: /anaconda3

  added / updated specs: 
    - wrapt

The following packages will be downloaded:
I'll download this together with you → A lot of them! So many! ??

The following NEW packages will be INSTALLED:
This package will be installed → Zuzuzura. It seems that everything related to Python will be new. Is it fine? ?? ??

Proceed ([y]/n)? y
Is it OK?
→ I'm scared, so take a backup and come here again.
15 minutes to download and install various items.
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) $ 
Is this OK? ?? ??

Third time

$ pip install tensorflow
Collecting tensorflow
(Omitted)
Installing collected packages: oauthlib, requests-oauthlib, rsa, cachetools, google-auth, google-auth-oauthlib, markdown, numpy, absl-py, protobuf, grpcio, tensorboard, opt-einsum, h5py, keras-applications, gast, tensorflow-estimator, keras-preprocessing, termcolor, google-pasta, astor, tensorflow
Successfully installed absl-py-0.8.1 astor-0.8.0 cachetools-3.1.1 gast-0.2.2 google-auth-1.7.2 google-auth-oauthlib-0.4.1 google-pasta-0.1.8 grpcio-1.25.0 h5py-2.10.0 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.1.1 numpy-1.17.4 oauthlib-3.1.0 opt-einsum-3.1.0 protobuf-3.11.1 requests-oauthlib-1.3.0 rsa-4.0 tensorboard-2.0.2 tensorflow-2.0.0 tensorflow-estimator-2.0.1 termcolor-1.1.0
$

pip install tensorflow` It looks like it's done. I'll give it a try.

$ python3

>>> import tensorflow as tf
>>> hello = tf.constant("Hello")
>>> tf.print(hello)
Hello
>>> 
>>> exit()

Hmm, it moved.

(Time required 2 hours)

Recommended Posts

63rd day I installed tensorflow.
I tried the TensorFlow tutorial MNIST 3rd
I installed TensorFlow (GPU version) on Ubuntu
[Streamlit] I installed it
I tried running TensorFlow
I installed ROS on Ubuntu 18.04
Learning record No. 19 (23rd day)
Learning record No. 29 (33rd day)
I tried using magenta / TensorFlow
I touched Tensorflow and keras
Day 65 I installed matplotlib to draw graphs on my Jupyter notebook.
TensorFlow 2.2 can't be installed with Python 3.8!
I tried the TensorFlow tutorial 1st
I installed the IoT platform "Rimotte"
I tried the TensorFlow tutorial 2nd
[Linux] I installed CentOS on VirtualBox
I installed Linux on my Mac