2015-11-19 43 views
2

試圖在Heroku上安裝tensorflow,到底it fails有:未定義的符號:PyUnicodeUCS4_FromStringAndSize與tensorflow在Heroku

pywrap_tensorflow.so: undefined symbol: PyUnicodeUCS4_FromStringAndSize 

requirements.txt:

numpy 
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl 

安裝:

git push heroku master 

Counting objects: 5, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (3/3), done. 
Writing objects: 100% (3/3), 327 bytes, done. 
Total 3 (delta 1), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Using set buildpack heroku/python 
remote: -----> Python app detected 
remote: -----> Installing dependencies with pip 
remote:  Collecting numpy (from -r requirements.txt (line 1)) 
remote:   Downloading numpy-1.10.1.tar.gz (4.0MB) 
remote:  Collecting tensorflow==0.5.0 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl (from -r requirements.txt (line 2)) 
remote:   Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl (10.9MB) 
remote:  Installing collected packages: numpy, tensorflow 
remote:   Running setup.py install for numpy 
remote:  Successfully installed numpy-1.10.1 tensorflow-0.5.0 
remote: 
remote: 
remote: -----> Discovering process types 
remote:  Procfile declares types -> web 
remote: 
remote: -----> Compressing... done, 54.8MB 
remote: -----> Launching... done, v7 
remote:  https://jalapenocandy.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy... done. 
To [email protected]:jalapenocandy.git 
    9a2cc96..231788d master -> master 

看起來不錯!不幸的是,當我嘗試:

heroku run bash 

$python 
python 
Python 2.7.10 (default, May 27 2015, 20:38:41) 
[GCC 4.8.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
>>> import tensorflow as tf 
import tensorflow as tf 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/__init__.py", 
line 4, in <module> 
    from tensorflow.python import * 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/__init 
__.py", line 22, in <module> 
    from tensorflow.python.client.client_lib import * 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/client 
/client_lib.py", line 35, in <module> 
    from tensorflow.python.client.session import InteractiveSession 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/client 
/session.py", line 11, in <module> 
    from tensorflow.python import pywrap_tensorflow as tf_session 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/pywrap 
_tensorflow.py", line 28, in <module> 
    _pywrap_tensorflow = swig_import_helper() 
    File "/app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/pywrap 
_tensorflow.py", line 24, in swig_import_helper 
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) 
ImportError: /app/.heroku/python/lib/python2.7/site-packages/tensorflow/python/_ 
pywrap_tensorflow.so: undefined symbol: PyUnicodeUCS4_FromStringAndSize 

我能做些什麼嗎?

+0

用tensorflow解決-0.6.0 – berak

回答

5

此問題是由您的Python二進制文件與TensorFlow二進制文件(UCS4)假定的Unicode二進制文件不兼容的Unicode定義(UCS2)引起的。

目前最好的解決方案是構建TensorFlow from source。最新版本在本機擴展中不使用Unicode字符串,因此不應出現此問題。當更新的二進制文件可用時,它們將包含此修復程序。

如果你不能從目標機器上源(例如,使用Heroku的時候),一個選擇是build your own PIP package不同的機器上(具有相同的架構)構建,並添加到您的requirements.txt代替。

+0

感謝您的快速回復,不幸的是我不能從該框上的src構建(我不是root,沒有apt-get等)。任何更新的二進制文件的eta? – berak

+1

我添加了一個建議:你可以在另一個盒子上建立自己的PIP包,並將其添加到你的'requirements.txt'中。我們目前正在編譯將會進入下一個版本的補丁程序,因此應該儘快準備好,但我沒有ETA。 – mrry

+0

@ mrry,這是否有過補丁?在Heroku上有0.11.0這個相同的問題 –