GithubHelp home page GithubHelp logo

Comments (19)

dcolley avatar dcolley commented on May 30, 2024 1

Some more progress... (if you can call it that).

install clinfo

https://github.com/Oblomov/clinfo

 derek$ Sites/ml/clinfo/clinfo  | grep "Device Type"
  Device Type                                     CPU
  Device Type                                     GPU
 derek$ Sites/ml/clinfo/clinfo  | grep -i opencl
  Platform Version                                OpenCL 1.2 (Oct 14 2016 20:24:13)
  Device Version                                  OpenCL 1.2 
  Device OpenCL C Version                         OpenCL C 1.2 
    Run OpenCL kernels                            Yes
  Device Version                                  OpenCL 1.2 
  Device OpenCL C Version                         OpenCL C 1.2 
    Run OpenCL kernels                            Yes

install bazel

Note, install from source requires xcode 8.1 and matching cli tools (5GB download!). Instead, I installed the binary from here:
https://github.com/bazelbuild/bazel/releases
https://github.com/bazelbuild/bazel/releases/download/0.3.2/bazel-0.3.2-installer-darwin-x86_64.sh

install python3 via brew

I followed these instructions:
http://www.marinamele.com/2014/07/install-python3-on-mac-os-x-and-use-virtualenv-and-virtualenvwrapper.html
Note, install from brew requires xcode 8.1 (5GB download!)... so I had to go for the xcode download... :/
brew install python3

install llvm

brew install --with-python llvm # question, is the --with-python needed?

derek$ brew install --with-python llvm
==> Using the sandbox
==> Downloading http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--clang-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/clang-tools-extra-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--clang-extra-tools-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/openmp-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--openmp-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/libcxx-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--libcxx-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/libunwind-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--libunwind-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/lld-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--lld-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/polly-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--polly-3.9.0.tar.xz
==> Downloading http://llvm.org/releases/3.9.0/compiler-rt-3.9.0.src.tar.xz
Already downloaded: /Users/derek/Library/Caches/Homebrew/llvm--compiler-rt-3.9.0.tar.xz
==> cmake -G Unix Makefiles /private/tmp/llvm-20161101-27416-unqzud/llvm-3.9.0.src -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDE
==> make

--> this takes a LONG time to compile...
Note, install from source requires xcode 8.1 [and matching] cli tools (5GB download!).

LLVM executables are installed in /usr/local/opt/llvm/bin.
Extra tools are installed in /usr/local/opt/llvm/share/llvm.
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"

This formula is keg-only, which means it was not symlinked into /usr/local.

macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/llvm/lib
    CPPFLAGS: -I/usr/local/opt/llvm/include


If you need Python to find bindings for this keg-only formula, run:
  echo /usr/local/opt/llvm/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/llvm.pth
==> Summary
🍺  /usr/local/Cellar/llvm/3.9.0: 2,039 files, 705.7M, **built in 42 minutes 9 seconds**

compile cuda-on-cl

Edit tensorflow-cl/third_party/cuda-on-cl/Makefile

CLANG        := /usr/local/Cellar/llvm/3.9.0/bin/clang++
LLVM_CONFIG  := /usr/local/Cellar/llvm/3.9.0/bin/llvm-config
LLVM_INCLUDE := /usr/local/Cellar/llvm/3.9.0/include

try the compilation

derek$ pwd
/Users/derek/Sites/tensorflow-cl/third_party/cuda-on-cl

derek$ make
mkdir -p build
clang++ -I/usr/lib/llvm-3.8/include -fPIC -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -g -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -fcxx-exceptions -c -o build/mutations.o -g -I/usr/local/Cellar/llvm/3.9.0/include src/mutations.cpp
mkdir -p build
clang++ -I/usr/lib/llvm-3.8/include -fPIC -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -g -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -fcxx-exceptions -c -o build/readIR.o -g -I/usr/local/Cellar/llvm/3.9.0/include src/readIR.cpp
mkdir -p build
clang++ -I/usr/lib/llvm-3.8/include -fPIC -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -g -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -fcxx-exceptions -c -o build/struct_clone.o -g -I/usr/local/Cellar/llvm/3.9.0/include src/struct_clone.cpp
src/struct_clone.cpp:245:12: warning: 11 enumeration values not handled in switch: 'HalfTyID', 'X86_FP80TyID', 'FP128TyID'... [-Wswitch]
    switch(typeID) {
           ^
1 warning generated.
mkdir -p build
clang++ -I/usr/lib/llvm-3.8/include -fPIC -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -g -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -fcxx-exceptions -o build/ir-to-opencl -g -I. -Iinclude -I/usr/local/Cellar/llvm/3.9.0/include src/ir-to-opencl.cpp build/struct_clone.o build/readIR.o src/ir-to-opencl-common.cpp build/mutations.o `/usr/local/Cellar/llvm/3.9.0/bin/llvm-config --ldflags --system-libs --libs all`
mkdir -p build
clang++ -I/usr/lib/llvm-3.8/include -fPIC -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -g -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -fcxx-exceptions -o build/patch-hostside -g -I/usr/local/Cellar/llvm/3.9.0/include src/patch-hostside.cpp build/readIR.o build/mutations.o build/struct_clone.o src/ir-to-opencl-common.cpp `/usr/local/Cellar/llvm/3.9.0/bin/llvm-config --ldflags --system-libs --libs all`
clang++ -DUSE_CLEW -c -o build/hostside_opencl_funcs.o -std=c++11 -fPIC -g -O2 -I/Users/derek/Sites/tensorflow-cl/third_party/cuda-on-cl/include -I/Users/derek/Sites/tensorflow-cl/third_party/cuda-on-cl/src/EasyCL src/hostside_opencl_funcs.cpp \
        -I/Users/derek/Sites/tensorflow-cl/third_party/cuda-on-cl/src/EasyCL/thirdparty/clew/include
src/hostside_opencl_funcs.cpp:55:35: error: use of undeclared identifier 'PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP'
    pthread_mutex_t launchMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
                                  ^
1 error generated.
make: *** [build/hostside_opencl_funcs.o] Error 1

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

If you want, you can build from source... this link is broken on the README.md?
https://github.com/hughperkins/tensorflow-cl/blob/tensorflow-cl/doc/build-form-source.md

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

Hey! Awesome! :-) Ok, going through paragraph by paragraph...

The first paragraph, I hadnt actually realized that the new issue template from upstream is still activated. I'm cleaned that up now, in 1478e20 So, the new issue page shouldnt ask you about CUDA and stuff any more :-P

If you want, you can build from source... this link is broken on the README.md?

Good spot! Fixed in 959c947

install clinfo

Cool. Looks good. You have one GPU device available, with OpenCL 1.2, and the drivers for that appear to be installed, and working enough for clinfo to report informaion about it

Note, install from source requires xcode 8.1 and matching cli tools (5GB download!) Instead, I installed the binary from here

Ah, that sounds like a good plan. And what you're writing is the basis for a Mac installation doc actually. We could use your issue for that, or you could create a new file in the doc directory, or add a section to the building-from-source.md file, if you want

Note, install from brew requires xcode 8.1 (5GB download!)... so I had to go for the xcode download... :/

I think yo ucan get python3 like this: https://github.com/hughperkins/DeepCL/blob/master/.travis.yml#L27-L28 This at least gives you 3.4, and I guess there is some similar package for 3.5?

But, having xcode installed sounds useful, on the whole :-)

brew install --with-python llvm # question, is the --with-python needed?

dont think so. we're not going to use llvm from python. tensorflow runs using python, but the build process itself doesnt use python itself. we build modules for python, but we dont build using python

--> this takes a LONG time to compile...

brew again. Is there a download you can use instead? or it's better to use brew than download a binary?

(after searching) Seems like there is a download of 3.8.0 for Mac at http://llvm.org/releases/download.html ? Can we use that one? (I'm using 3.8.0, so the version matches)

pthread_mutex_t launchMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;

Ok, that build is looking fairly good. For this bit... we need to find something for pthreads, to initialize recursive mutexes. From googling a bit, I found https://stackoverflow.com/questions/7037481/c-how-do-you-declare-a-recursive-mutex-with-posix-threads/7934058#7934058 which suggests we should put on Mac:

pthread_mutex_t launchMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;

Do you want to try modifying this, in src/hostside_opencl_funcs.cpp, and see if that helps? Unfortunately this change doesnt work in linux, but we can use #ifdef around this, to choose which code we'll use, depending on whether we are compiling on Mac or on linux. But we cna think about #ifdef later, once we've checked that removing the _NP bit does or doesnt fix this particular build issue, on Mac.

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

That edit has worked!
During make there is only 1 warning

/usr/local/Cellar/llvm/3.9.0/bin/clang++ -std=c++11 -fPIC -c -O2 -Isrc/EasyCL/thirdparty/clew/include -o build/clew-clew.o src/EasyCL/thirdparty/clew/src/clew.c
clang-3.9: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

Full output here
http://pastebin.com/CRHcafJt

However:

derek$ make -j 4
mkdir -p build/clblast
cd build/clblast && cmake ../../src/CLBlast -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-rpath,\${ORIGIN} -Wl,-rpath,\${ORIGIN}/.." -DBUILD_SHARED=ON \
        -DOPENCL_INCLUDE_DIRS=/Users/derek/Sites/ml/cuda-on-cl/src/EasyCL/thirdparty/clew/include/proxy-opencl/ \
        -DOPENCL_LIBRARIES=/Users/derek/Sites/ml/cuda-on-cl/build/libclew.so \
        -DCMAKE_CXX_FLAGS=-I/Users/derek/Sites/ml/cuda-on-cl/src/EasyCL/thirdparty/clew/include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/derek/Sites/ml/cuda-on-cl/build/clblast
cd build/clblast && make -j 4
make[1]: warning: -jN forced in submake: disabling jobserver mode.
[100%] Built target clblast

The warning doesn't seem fatal - I'll let you decide - so I'm moving on...

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

Building using the "pushd third_party/cuda-on-cl" instructions was not so clean:

DC-MBP01:tensorflow-cl derek$ pwd
/Users/derek/Sites/ml/tensorflow-cl
DC-MBP01:tensorflow-cl derek$ pushd third_party/cuda-on-cl
~/Sites/ml/tensorflow-cl/third_party/cuda-on-cl ~/Sites/ml/tensorflow-cl ~/Sites/tensorflow-cl
DC-MBP01:cuda-on-cl derek$ make -j 4
/usr/local/Cellar/llvm/3.9.0/bin/clang++ -DUSE_CLEW -c -o build/hostside_opencl_funcs.o -std=c++11 -fPIC -g -O2 -I/Users/derek/Sites/ml/tensorflow-cl/third_party/cuda-on-cl/include -I/Users/derek/Sites/ml/tensorflow-cl/third_party/cuda-on-cl/src/EasyCL src/hostside_opencl_funcs.cpp \
        -I/Users/derek/Sites/ml/tensorflow-cl/third_party/cuda-on-cl/src/EasyCL/thirdparty/clew/include

...

[ 89%] Building CXX object CMakeFiles/clblast.dir/src/routines/level3/xherk.cpp.o
[ 91%] Building CXX object CMakeFiles/clblast.dir/src/routines/level3/xsyr2k.cpp.o
[ 93%] Building CXX object CMakeFiles/clblast.dir/src/routines/level3/xher2k.cpp.o
[ 95%] Building CXX object CMakeFiles/clblast.dir/src/routines/level3/xtrmm.cpp.o
[ 97%] Building CXX object CMakeFiles/clblast.dir/src/routines/levelx/xomatcopy.cpp.o
[100%] Linking CXX shared library libclblast.dylib
[100%] Built target clblast
g++ -o build/libcocl.so -Wl,-rpath,\${ORIGIN} -shared build/hostside_opencl_funcs.o build/cocl_events.o build/cocl_blas.o build/cocl_device.o build/cocl_error.o build/cocl_memory.o build/cocl_properties.o build/cocl_streams.o build/cocl_clsources.o build/cocl_context.o -Lbuild -Lbuild/clblast -lclblast -leasycl -lclew
DC-MBP01:cuda-on-cl derek$ sudo make install
Password:
install -m 0755 build/ir-to-opencl /usr/local/bin
install -m 0755 build/patch-hostside /usr/local/bin
install -m 0644 build/libcocl.so /usr/local/lib
install -m 0644 build/libclew.so /usr/local/lib
install -m 0644 build/libeasycl.so /usr/local/lib
install -m 0644 build/clblast/libclblast.so /usr/local/lib
install: build/clblast/libclblast.so: No such file or directory
make: *** [install] Error 71
DC-MBP01:cuda-on-cl derek$ ll build/clblast/libclblast.so
ls: build/clblast/libclblast.so: No such file or directory
DC-MBP01:cuda-on-cl derek$ ll build/clblast/
total 5728
-rw-r--r--   1 derek  staff    14480  2 Nov 11:38 CMakeCache.txt
drwxr-xr-x  16 derek  staff      544  2 Nov 11:39 CMakeFiles
-rw-r--r--   1 derek  staff    55516  2 Nov 11:38 Makefile
-rw-r--r--   1 derek  staff     4176  2 Nov 11:38 cmake_install.cmake
-rwxr-xr-x   1 derek  staff  2846904  2 Nov 11:39 libclblast.dylib

http://pastebin.com/0z3b8v6C

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

Ah, becuase its a dylib. We can fix this in the Makefile: at the bottom, in the sections install, uninstall and install-dev, change libclblast.so to libclblast.dylib. Seems like the other files are all still .sos is that right? You can check by doing:

ls build/*.so
ls build/*.dylib

If the results all end in .so, then they are consistent with the linux version. If they end in .dylib we might need to change some things.

For now, let's not consider how to if() the changes out, we can think about that later.

You probably need to do a global search and replace inside Makefile for libclblast.so, replace with libclblast.dylib.

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

Changing the .so to .dylib has worked.
Please note, there are many other items that are .so...?

derek$ cd cuda-on-cl/
DC-MBP01:cuda-on-cl derek$ ll
total 80
-rw-r--r--   1 derek  staff  11357  1 Nov 11:53 LICENSE
-rw-r--r--   1 derek  staff  13180  1 Nov 15:42 Makefile
-rw-r--r--   1 derek  staff   4981  1 Nov 11:53 README.md
drwxr-xr-x   3 derek  staff    102  1 Nov 11:53 bin
drwxr-xr-x  32 derek  staff   1088  2 Nov 10:39 build
drwxr-xr-x   9 derek  staff    306  1 Nov 11:53 doc
drwxr-xr-x   3 derek  staff    102  1 Nov 11:53 include
-rw-r--r--   1 derek  staff    114  1 Nov 11:53 pytest.ini
drwxr-xr-x   3 derek  staff    102  1 Nov 11:53 share
drwxr-xr-x  24 derek  staff    816  1 Nov 11:53 src
drwxr-xr-x  28 derek  staff    952  1 Nov 11:53 test
DC-MBP01:cuda-on-cl derek$ cd third_party/
-bash: cd: third_party/: No such file or directory
DC-MBP01:cuda-on-cl derek$ ls build/*.so
build/libclew.so    build/libcocl.so    build/libeasycl.so
DC-MBP01:cuda-on-cl derek$ ls build/*.dylib
ls: build/*.dylib: No such file or directory
DC-MBP01:cuda-on-cl derek$ grep libclblast.so *
Makefile:all: include/cocl/local_config.h build/ir-to-opencl build/patch-hostside build/libcocl.so build/clblast/libclblast.so build/libclew.so
Makefile:build/clblast/libclblast.so: build/libclew.so
Makefile:build/libcocl.so: $(COCL_OBJS) build/libeasycl.so build/clblast/libclblast.so
Makefile:   install -m 0644 build/clblast/libclblast.so $(PREFIX)/lib
Makefile:   rm $(PREFIX)/lib/libclblast.so
Makefile:   ln -sf `pwd`/build/clblast/libclblast.so $(PREFIX)/lib/libclblast.so

http://pastebin.com/8ch48iU3

And here is the diff of Makefile

http://pastebin.com/eNUges1T

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

... moving on

derek$ source ~/env3/bin/activate
-bash: /Users/derek/env3/bin/activate: No such file or directory
DC-MBP01:tensorflow-cl derek$ sudo find / -name activate -print
Password:
find: /dev/fd/tensorflow-cl: No such file or directory
find: /dev/fd/tensorflow-cl: No such file or directory
/opt/hue/build/env/bin/activate
/Users/derek/tensorflow/bin/activate
/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/venv/scripts/posix/activate
DC-MBP01:tensorflow-cl derek$ pwd
/Users/derek/Sites/ml/tensorflow-cl

I just guessed at taking the one from tensoflow... :/

DC-MBP01:tensorflow-cl derek$ source /Users/derek/tensorflow/bin/activate
(tensorflow) DC-MBP01:tensorflow-cl derek$ bazel run --verbose_failures --logging 6 //tensorflow/tools/pip_package:build_pip_package
................
ERROR: /Users/derek/Sites/ml/tensorflow-cl/tensorflow/core/BUILD:1064:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by /Users/derek/Sites/ml/tensorflow-cl/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /Users/derek/Sites/ml/tensorflow-cl/tensorflow/core/BUILD:1064:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by /Users/derek/Sites/ml/tensorflow-cl/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /Users/derek/Sites/ml/tensorflow-cl/tensorflow/core/BUILD:1064:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by /Users/derek/Sites/ml/tensorflow-cl/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 236.216s
ERROR: Build failed. Not running target.
(tensorflow) DC-MBP01:tensorflow-cl derek$ 

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

Hey! I'm massively overhauling/refactorizing cuda-on-cl hughperkins/coriander@master...runtime-compile Let's take a look once that is merged in? (probably another ~few days to a week or so).

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

(Just to keep you in the loop, I've set up a Travis build of cuda-on-cl, and I'm gradually working through a bunch of the Mac build issues https://travis-ci.org/hughperkins/cuda-on-cl/builds I've fixed the mutex issue hughperkins/coriander@2c2b41c , added CLANG_HOME to CMakeLists.txt hughperkins/coriander@a65688f , and a few other changes. This is all in a branch called runtime-compile for now https://github.com/hughperkins/cuda-on-cl/commits/runtime-compile , and not yet enabled in tensorflow-cl, but it should be on its way soonish :-) )

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

Note: created a travis build for tensorflow-cl now, https://travis-ci.org/hughperkins/tensorflow-cl and https://github.com/hughperkins/tensorflow-cl/blob/dev/.travis.yml Very up for work to gradually tweak this travis script, and get it building successfully :-)

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

Draft Mac wheel here: https://s3.amazonaws.com/hughperkinstravis/cache/tensorflow-cl/travis/tensorflowpkg.tar.gz I havent tried running it yet. I imagine it might not quite run yet....

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

I didn't get very far...

DC-MBP01:ml derek$ tar -ztf tensorflowpkg.tar.gz 
tensorflow-0.11.0rc0-py3-none-any.whl
DC-MBP01:ml derek$ pip install tensorflow-0.11.0rc0-py3-none-any.whl
tensorflow-0.11.0rc0-py3-none-any.whl is not a supported wheel on this platform.
DC-MBP01:ml derek$ 

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

from tf-coriander.

yarrseni avatar yarrseni commented on May 30, 2024

Also, make sure your pip is not referring to your system-wide Python2's pip.
pip3 ... is safer way of installing the mentioned package, which was built for Py3, I believe, judging by its name.

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

from tf-coriander.

dcolley avatar dcolley commented on May 30, 2024

Here is the output for python3 and python:

derek$ python3
Python 3.5.2 (default, Oct 11 2016, 04:59:56) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.uname()
uname_result(system='Darwin', node='DC-MBP01-3.local', release='16.1.0', version='Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64', machine='x86_64', processor='i386')
>>> 

DC-MBP01:ml derek$ python
Python 2.7.12 (default, Oct 24 2016, 16:45:09) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.uname()
('Darwin', 'DC-MBP01-3.local', '16.1.0', 'Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64', 'x86_64', 'i386')
>>> 

weird, I deleted tensorflow with pip3

derek$ sudo pip3 uninstall tensorflow
Password:
Uninstalling tensorflow-0.11.0rc0:
  /usr/local/bin/tensorboard
  /usr/local/lib/python3.5/site-packages/external/__init__.py
  /usr/local/lib/python3.5/site-packages/external/__pycache__/__init__.cpython-35.pyc
  /usr/local/lib/python3.5/site-packages/external/d3/d3.js
  /usr/local/lib/python3.5/site-packages/external/d3/d3.min.js
...

  /usr/local/lib/python3.5/site-packages/tensorflow/tools/pip_package/__pycache__/simple_console.cpython-35.pyc
  /usr/local/lib/python3.5/site-packages/tensorflow/tools/pip_package/setup.py
  /usr/local/lib/python3.5/site-packages/tensorflow/tools/pip_package/simple_console.py
Proceed (y/n)? y
  Successfully uninstalled tensorflow-0.11.0rc0
DC-MBP01:ml derek$ sudo pip3 install tensorflow-0.11.0rc0-py3-none-any.whl
Processing ./tensorflow-0.11.0rc0-py3-none-any.whl
Requirement already satisfied: protobuf==3.1.0 in /usr/local/lib/python3.5/site-packages (from tensorflow==0.11.0rc0)
Requirement already satisfied: numpy>=1.11.0 in /usr/local/lib/python3.5/site-packages (from tensorflow==0.11.0rc0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.5/site-packages (from tensorflow==0.11.0rc0)
Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.5/site-packages (from tensorflow==0.11.0rc0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.5/site-packages (from protobuf==3.1.0->tensorflow==0.11.0rc0)
Installing collected packages: tensorflow
Successfully installed tensorflow-0.11.0rc0

but then, python3 can't see tf? yet python[2.x] can

derek$ python tf/test.py
Hello, TensorFlow!
42


derek$ python3 tf/test.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: dlopen(/usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: /Users/travis/build/hughperkins/tensorflow-cl/third_party/cuda-on-cl/build/libclew.dylib
  Referenced from: /usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 69, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tf/test.py", line 1, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.5/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 92, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: dlopen(/usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: /Users/travis/build/hughperkins/tensorflow-cl/third_party/cuda-on-cl/build/libclew.dylib
  Referenced from: /usr/local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 69, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/usr/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'


Error importing tensorflow.  Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

Full http://pastebin.com/UwRGQCiP

from tf-coriander.

edmondja avatar edmondja commented on May 30, 2024

I have the same error with my mbp retina 13" early 2015 on python 3.5 (if that helps..)

from tf-coriander.

hughperkins avatar hughperkins commented on May 30, 2024

I have a Mac :-) . Working on the build. Closing this for now, and we can create specific issues as we go.

from tf-coriander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.