{"action":"created","issue":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2512","repository_url":"https://api.github.com/repos/pyinstaller/pyinstaller","labels_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2512/labels{/name}","comments_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2512/comments","events_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2512/events","html_url":"https://github.com/pyinstaller/pyinstaller/issues/2512","id":215040612,"number":2512,"title":"Failed to pack keras+theano script","user":{"login":"MaratZakirov","id":24436072,"avatar_url":"https://avatars2.githubusercontent.com/u/24436072?v=3","gravatar_id":"","url":"https://api.github.com/users/MaratZakirov","html_url":"https://github.com/MaratZakirov","followers_url":"https://api.github.com/users/MaratZakirov/followers","following_url":"https://api.github.com/users/MaratZakirov/following{/other_user}","gists_url":"https://api.github.com/users/MaratZakirov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaratZakirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaratZakirov/subscriptions","organizations_url":"https://api.github.com/users/MaratZakirov/orgs","repos_url":"https://api.github.com/users/MaratZakirov/repos","events_url":"https://api.github.com/users/MaratZakirov/events{/privacy}","received_events_url":"https://api.github.com/users/MaratZakirov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-17T15:39:46Z","updated_at":"2017-03-19T01:02:16Z","closed_at":null,"body":"Hello I am trying to make self-contained execution script of tiny keras+theano model.\r\n\r\n(This is kind of continue of https://github.com/pyinstaller/pyinstaller/issues/2114)\r\n\r\n```\r\nimport os\r\nos.environ['KERAS_BACKEND']='theano'\r\n\r\nimport keras\r\nimport theano.tensor.shared_randomstreams\r\n\r\nprint \"Hello keras\"\r\n\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Dense, Activation, LSTM, Input\r\nfrom keras.models import Model\r\nimport numpy\r\n\r\nx_data = numpy.array([[1, 3], [4, 5], [6, 7], [8, 9]]).astype('float32')\r\nl_data = numpy.array([0.3, 0.5, -0.7, 0.8]).astype('float32')\r\n\r\nmodel = Sequential([Dense(1, input_dim=2), Activation('linear')])\r\nmodel.compile(optimizer='sgd', loss='mse')\r\n\r\nmodel.fit(x = x_data, y=l_data)\r\n```\r\n\r\nAfter I compile it as pyinstaller --onefile it fails to start with message\r\n\r\n```\r\n===============================\r\nProblem occurred during compilation with the command line below:\r\n/usr/bin/g++ -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=corei7 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=12288 -mtune=corei7 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/tmp/_MEI4QhxrM/numpy/core/include -I/tmp/_MEI4QhxrM/include/python2.7 -I/tmp/_MEI4QhxrM/theano/gof -fvisibility=hidden -o /home/zakirov/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.12-64/tmpox46XN/c25c9ba4db584bf094983a608a1bfc89.so /home/zakirov/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.12-64/tmpox46XN/mod.cpp -L/home/zakirov/proj/Python-2.7.12/lib/lib -L/tmp/_MEI4QhxrM/lib -lpython2.7\r\n/home/zakirov/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.12-64/tmpox46XN/mod.cpp:1:20: fatal error: Python.h: No such file or directory\r\n #include <Python.h>\r\n                    ^\r\ncompilation terminated.\r\n\r\nTraceback (most recent call last):\r\n  File \"cool-exe-ltr.py\", line 20, in <module>\r\n    model.fit(x = x_data, y=l_data)\r\n  File \"site-packages/keras/models.py\", line 845, in fit\r\n  File \"site-packages/keras/engine/training.py\", line 1457, in fit\r\n  File \"site-packages/keras/engine/training.py\", line 1007, in _make_train_function\r\n  File \"site-packages/keras/backend/theano_backend.py\", line 1081, in function\r\n  File \"site-packages/keras/backend/theano_backend.py\", line 1067, in __init__\r\n  File \"site-packages/theano/compile/function.py\", line 320, in function\r\n  File \"site-packages/theano/compile/pfunc.py\", line 479, in pfunc\r\n  File \"site-packages/theano/compile/function_module.py\", line 1777, in orig_function\r\n  File \"site-packages/theano/compile/function_module.py\", line 1641, in create\r\n  File \"site-packages/theano/gof/link.py\", line 690, in make_thunk\r\n  File \"site-packages/theano/gof/vm.py\", line 1003, in make_all\r\n  File \"site-packages/theano/gof/op.py\", line 970, in make_thunk\r\n  File \"site-packages/theano/gof/op.py\", line 879, in make_c_thunk\r\n  File \"site-packages/theano/gof/cc.py\", line 1200, in make_thunk\r\n  File \"site-packages/theano/gof/cc.py\", line 1143, in __compile__\r\n  File \"site-packages/theano/gof/cc.py\", line 1595, in cthunk_factory\r\n  File \"site-packages/theano/gof/cmodule.py\", line 1142, in module_from_key\r\n  File \"site-packages/theano/gof/cc.py\", line 1506, in compile_cmodule\r\n  File \"site-packages/theano/gof/cmodule.py\", line 2204, in compile_str\r\nException: ('The following error happened while compiling the node', Elemwise{mul,no_inplace}(InplaceDimShuffle{x,x}.0, InplaceDimShuffle{x,x}.0, InplaceDimShuffle{x,x}.0), '\\n', 'Compilation failed (return status=1): /home/zakirov/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.12-64/tmpox46XN/mod.cpp:1:20: fatal error: Python.h: No such file or directory.  #include <Python.h>.                     ^. compilation terminated.. ', '[Elemwise{mul,no_inplace}(<TensorType(float32, (True, True))>, <TensorType(float32, (True, True))>, <TensorType(float32, (True, True))>)]')\r\nFailed to execute script cool-exe-ltr\r\n```\r\nMaybe I need to take Python.h (and plenty other) in same package? Any suggestions?"},"comment":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/comments/287586453","html_url":"https://github.com/pyinstaller/pyinstaller/issues/2512#issuecomment-287586453","issue_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2512","id":287586453,"user":{"login":"xoviat","id":15351036,"avatar_url":"https://avatars2.githubusercontent.com/u/15351036?v=3","gravatar_id":"","url":"https://api.github.com/users/xoviat","html_url":"https://github.com/xoviat","followers_url":"https://api.github.com/users/xoviat/followers","following_url":"https://api.github.com/users/xoviat/following{/other_user}","gists_url":"https://api.github.com/users/xoviat/gists{/gist_id}","starred_url":"https://api.github.com/users/xoviat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xoviat/subscriptions","organizations_url":"https://api.github.com/users/xoviat/orgs","repos_url":"https://api.github.com/users/xoviat/repos","events_url":"https://api.github.com/users/xoviat/events{/privacy}","received_events_url":"https://api.github.com/users/xoviat/received_events","type":"User","site_admin":false},"created_at":"2017-03-19T01:02:16Z","updated_at":"2017-03-19T01:02:16Z","body":"Duplicate #2114"}}
{"actor":{"display_login":"xoviat"}}