Posted in Deep Learning, Python

TensorFlow 01: multiple versions of numpy

Started to write another paper, also I am reading the DL Textbook, but still have time to try new things….the TensorFlow. Everything is in the website, but you are not along cuz errors are always be with you 😀


Install:
– check python version (2.7 or 3.3+)
– install pip:

# Ubuntu/Linux 64-bit
$ sudo apt-get install python-pip python-dev
# Mac OS X $
sudo easy_install pip

tf1

– install TensorFlow:

(Linux is okay with GPU, Mac not.)

# Ubuntu/Linux 64-bit, CPU only:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl

# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl

tf2

Test TensorFlow:
Run python in the terminal, but the error is:

Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
RuntimeError: module compiled against API version a but this version of numpy is 6

I get another warning:

You are using pip version 7.1.2, however version 8.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Then please do the following:

sudo pip install —upgrade pip

“sudo” should be added.

But it seems fine. The main reason is the multiple versions of numpy.
Please note, for my Mac, there are two versions of numpy,1.6 and 1.10.(It could happen in your machine! ) I installed 1.10 by using pip command, but when I checked the version, it used another one.
Use the following to check your version:

>>> import numpy
>>> print numpy.__version__
1.6.2

Or, simply by typing:

python -c "import numpy; print numpy.version.version”

You need to know the path of numpy, then remove it manually:

 mac$ python -c 'import os,numpy;print(numpy.__file__)'
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py
 mac$ sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy

Then install new numpy again, have a try and it should work!

tf3

TBC…
More: I tried caffe few month ago, and it was really killing me…the installation was complex and I met a list of errors. I also want to play with Torch. But after their ads from NIPS, I was excited about the distribution part. Hopefully, I can grasp it easily. Great company create tools…that’s it. News come out that Baidu also released a new AI software WARP-CTC, which is involved with RNNs, contributing to DL community. For sure we are “rolling” in a great era.

 


[1] http://stackoverflow.com/questions/16391335/using-old-version-of-numpy-even-with-a-newer-version-installed
[2] https://www.tensorflow.org/versions/master/get_started/os_setup.html#test-the-tensorflow-installation

Author:

Keep calm and update blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s