Related
I downloaded the latest release of H2O (3.18.0.1) and XGboost keeps failing. I am not sure whether to post to the JIRA issues or here.
h2o.init()
from h2o.estimators import H2OXGBoostEstimator
is_xgboost_available = H2OXGBoostEstimator.available()
train_path = 'https://s3.amazonaws.com/h2o-public-test-data/bigdata/laptop/higgs_train_imbalance_100k.csv'
test_path = 'https://s3.amazonaws.com/h2o-public-test-data/bigdata/laptop/higgs_test_imbalance_100k.csv'
df_train = h2o.import_file(train_path)
df_test = h2o.import_file(test_path)
# Transform first feature into categorical feature
df_train[0] = df_train[0].asfactor()
df_test[0] = df_test[0].asfactor()
param = {
"ntrees" : 500
}
model = H2OXGBoostEstimator(**param)
model.train(x = list(range(1, df_train.shape[1])), y = 0, training_frame = df_train)
I can run random forest, GBM without an issue but xgboost keeps failing.
I am running on Ubuntu 16.04. Java Version: java version "1.8.0_161"; Java(TM) SE Runtime Environment (build 1.8.0_161-b12); Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode). Anaconda Python 3.6
I reinstalled Anaconda and reinstalled JRE, but am still having the same issue.
It keeps giving me the following error:
xgboost Model Build progress: |████████████████████████████████████████
---------------------------------------------------------------------------
ConnectionResetError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
600 body=body, headers=headers,
--> 601 chunked=chunked)
602
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
386 # otherwise it looks like a programming error was the cause.
--> 387 six.raise_from(e, None)
388 except (SocketTimeout, BaseSSLError, SocketError) as e:
~/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
382 try:
--> 383 httplib_response = conn.getresponse()
384 except Exception as e:
~/anaconda3/lib/python3.6/http/client.py in getresponse(self)
1330 try:
-> 1331 response.begin()
1332 except ConnectionError:
~/anaconda3/lib/python3.6/http/client.py in begin(self)
296 while True:
--> 297 version, status, reason = self._read_status()
298 if status != CONTINUE:
~/anaconda3/lib/python3.6/http/client.py in _read_status(self)
257 def _read_status(self):
--> 258 line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
259 if len(line) > _MAXLINE:
~/anaconda3/lib/python3.6/socket.py in readinto(self, b)
585 try:
--> 586 return self._sock.recv_into(b)
587 except timeout:
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
ProtocolError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
439 retries=self.max_retries,
--> 440 timeout=timeout
441 )
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
638 retries = retries.increment(method, url, error=e, _pool=self,
--> 639 _stacktrace=sys.exc_info()[2])
640 retries.sleep()
~/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
356 if read is False or not self._is_method_retryable(method):
--> 357 raise six.reraise(type(error), error, _stacktrace)
358 elif read is not None:
~/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py in reraise(tp, value, tb)
684 if value.__traceback__ is not tb:
--> 685 raise value.with_traceback(tb)
686 raise value
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
600 body=body, headers=headers,
--> 601 chunked=chunked)
602
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
386 # otherwise it looks like a programming error was the cause.
--> 387 six.raise_from(e, None)
388 except (SocketTimeout, BaseSSLError, SocketError) as e:
~/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)
~/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
382 try:
--> 383 httplib_response = conn.getresponse()
384 except Exception as e:
~/anaconda3/lib/python3.6/http/client.py in getresponse(self)
1330 try:
-> 1331 response.begin()
1332 except ConnectionError:
~/anaconda3/lib/python3.6/http/client.py in begin(self)
296 while True:
--> 297 version, status, reason = self._read_status()
298 if status != CONTINUE:
~/anaconda3/lib/python3.6/http/client.py in _read_status(self)
257 def _read_status(self):
--> 258 line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
259 if len(line) > _MAXLINE:
~/anaconda3/lib/python3.6/socket.py in readinto(self, b)
585 try:
--> 586 return self._sock.recv_into(b)
587 except timeout:
ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/h2o/backend/connection.py in request(self, endpoint, data, json, filename, save_to)
399 headers=headers, timeout=self._timeout, stream=stream,
--> 400 auth=self._auth, verify=self._verify_ssl_cert, proxies=self._proxies)
401 self._log_end_transaction(start_time, resp)
~/anaconda3/lib/python3.6/site-packages/requests/api.py in request(method, url, **kwargs)
57 with sessions.Session() as session:
---> 58 return session.request(method=method, url=url, **kwargs)
59
~/anaconda3/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
507 send_kwargs.update(settings)
--> 508 resp = self.send(prep, **send_kwargs)
509
~/anaconda3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
617 # Send the request
--> 618 r = adapter.send(request, **kwargs)
619
~/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
489 except (ProtocolError, socket.error) as err:
--> 490 raise ConnectionError(err, request=request)
491
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
H2OConnectionError Traceback (most recent call last)
<ipython-input-22-37b26d4dfbfd> in <module>()
1 start = time.time()
----> 2 model.train(x = list(range(1, df_train.shape[1])), y = 0, training_frame = df_train)
3 end = time.time()
4 print(end - start)
~/anaconda3/lib/python3.6/site-packages/h2o/estimators/estimator_base.py in train(self, x, y, training_frame, offset_column, fold_column, weights_column, validation_frame, max_runtime_secs, ignored_columns, model_id, verbose)
229 return
230
--> 231 model.poll(verbose_model_scoring_history=verbose)
232 model_json = h2o.api("GET /%d/Models/%s" % (rest_ver, model.dest_key))["models"][0]
233 self._resolve_model(model.dest_key, model_json)
~/anaconda3/lib/python3.6/site-packages/h2o/job.py in poll(self, verbose_model_scoring_history)
56 pb.execute(self._refresh_job_status, print_verbose_info=lambda x: self._print_verbose_info() if int(x * 10) % 5 == 0 else " ")
57 else:
---> 58 pb.execute(self._refresh_job_status)
59 except StopIteration as e:
60 if str(e) == "cancelled":
~/anaconda3/lib/python3.6/site-packages/h2o/utils/progressbar.py in execute(self, progress_fn, print_verbose_info)
167 # Query the progress level, but only if it's time already
168 if self._next_poll_time <= now:
--> 169 res = progress_fn() # may raise StopIteration
170 assert_is_type(res, (numeric, numeric), numeric)
171 if not isinstance(res, tuple):
~/anaconda3/lib/python3.6/site-packages/h2o/job.py in _refresh_job_status(self)
91 def _refresh_job_status(self):
92 if self._poll_count <= 0: raise StopIteration("")
---> 93 jobs = h2o.api("GET /3/Jobs/%s" % self.job_key)
94 self.job = jobs["jobs"][0] if "jobs" in jobs else jobs["job"][0]
95 self.status = self.job["status"]
~/anaconda3/lib/python3.6/site-packages/h2o/h2o.py in api(endpoint, data, json, filename, save_to)
101 # type checks are performed in H2OConnection class
102 _check_connection()
--> 103 return h2oconn.request(endpoint, data=data, json=json, filename=filename, save_to=save_to)
104
105
~/anaconda3/lib/python3.6/site-packages/h2o/backend/connection.py in request(self, endpoint, data, json, filename, save_to)
408 else:
409 self._log_end_exception(e)
--> 410 raise H2OConnectionError("Unexpected HTTP error: %s" % e)
411 except requests.exceptions.Timeout as e:
412 self._log_end_exception(e)
H2OConnectionError: Unexpected HTTP error: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
I have been successfully visualizing dask objects for a few days now, but I just restarted my Jupyter notebook kernel and am running into a KeyError that I can't seem to debug.
Before I restarted the kernel, the following code worked fine:
def sigmoid(x):
'''Sigmoid function of x.'''
return 1/(1+da.exp(-x))
X = da.from_array(np.random.random((4,2)), chunks=2)
beta = np.ones((2,1))
##
p = (X.dot(beta)).map_blocks(sigmoid)
W = da.diag((p*(1-p))[:,0])
hessian = da.dot(X.T.dot(W),X)
hessian.visualize()
But now when I run, I get the following traceback:
KeyError Traceback (most recent call last)
<ipython-input-62-660a47cb4654> in <module>()
7 W = da.diag((p*(1-p))[:,0])
8 hessian = dot(X.T.dot(W),X)
----> 9 hessian.visualize()
.../anaconda3/anaconda/lib/python3.5/site-packages/dask/base.py in visualize(self, filename, format, optimize_graph, **kwargs)
59 """
60 return visualize(self, filename=filename, format=format,
---> 61 optimize_graph=optimize_graph, **kwargs)
62
63 def compute(self, **kwargs):
.../anaconda3/anaconda/lib/python3.5/site-packages/dask/base.py in visualize(*args, **kwargs)
234 dsk = merge(dsks)
235
--> 236 return dot_graph(dsk, filename=filename, **kwargs)
237
238
.../anaconda3/anaconda/lib/python3.5/site-packages/dask/dot.py in dot_graph(dsk, filename, format, **kwargs)
217 dask.dot.to_graphviz
218 """
--> 219 g = to_graphviz(dsk, **kwargs)
220
221 fmts = ['.png', '.pdf', '.dot', '.svg', '.jpeg', '.jpg']
.../anaconda3/anaconda/lib/python3.5/site-packages/dask/dot.py in to_graphviz(dsk, data_attributes, function_attributes, rankdir, graph_attr, node_attr, edge_attr, **kwargs)
130 if func_name not in seen:
131 seen.add(func_name)
--> 132 g.node(func_name, label=task_label(v), shape='circle',
133 **function_attributes.get(k, {}))
134 g.edge(func_name, k_name)
.../anaconda3/anaconda/lib/python3.5/site-packages/dask/dot.py in task_label(task)
29 if hasattr(func, 'funcs'):
30 if len(func.funcs) > 1:
---> 31 return '{0}(...)'.format(funcname(func.funcs[0]))
32 else:
33 head = funcname(func.funcs[0])
KeyError: 0
It appears there is some label missing for one of the tasks or something like that?
EDIT: Actually, to reproduce the error you need to modify the sigmoid function as follows:
from multipledispatch import dispatch
#dispatch(da.Array)
def sigmoid(x):
'''Sigmoid function of x.'''
return 1/(1+da.exp(-x))
#dispatch(np.ndarray)
def sigmoid(x):
'''Sigmoid function of x.'''
return 1/(1+np.exp(-x))
Thanks for the reproducible example.
Unfortunately, this runs fine for me:
In [1]: import numpy as np
In [2]: import dask.array as da
In [3]: from multipledispatch import dispatch
...:
...: #dispatch(da.Array)
...: def sigmoid(x):
...: '''Sigmoid function of x.'''
...: return 1/(1+da.exp(-x))
...:
...: #dispatch(np.ndarray)
...: def sigmoid(x):
...: '''Sigmoid function of x.'''
...: return 1/(1+np.exp(-x))
...:
In [4]: pdb
Automatic pdb calling has been turned ON
In [5]: def sigmoid(x):
...: '''Sigmoid function of x.'''
...: return 1/(1+da.exp(-x))
...:
...: X = da.from_array(np.random.random((4,2)), chunks=2)
...: beta = np.ones((2,1))
...:
...: ##
...: p = (X.dot(beta)).map_blocks(sigmoid)
...: W = da.diag((p*(1-p))[:,0])
...: hessian = da.dot(X.T.dot(W),X)
...: hessian.visualize()
...:
Out[5]: <IPython.core.display.Image object>
The fact that it worked until you restarted something is a bit odd. Perhaps something is up with your environment?
I'm trying to run some code in QuTiP, but when I run a function in parallel with parfor I am getting an error.
results= parfor(func2, range(len(delta)))
Error:
AssertionError
Traceback (most recent call last)
<ipython-input-206-6c2ffcb32b4f> in <module>()
----> 1 results= parfor(func2, range(len(delta)))
/usr/lib/python2.7/dist-packages/qutip/parallel.pyc in parfor(func, *args, **kwargs)
119 try:
120 map_args = ((func, v, os.getpid()) for v in var)
--> 121 par_return = list(pool.map(task_func, map_args))
122
123 pool.terminate()
/usr/lib/python2.7/multiprocessing/pool.py in map(self, func, iterable, chunksize)
249 '''
250 assert self._state == RUN
--> 251 return self.map_async(func, iterable, chunksize).get()
252
253 def imap(self, func, iterable, chunksize=1):
/usr/lib/python2.7/multiprocessing/pool.py in get(self, timeout)
556 return self._value
557 else:
--> 558 raise self._value
559
560 def _set(self, i, obj):
AssertionError: daemonic processes are not allowed to have children
Here is my code:
def func2(x):
def H1_coeff(t,args):
return exp(-((t-4)/2.0) ** 2)
H0 = np.pi*w * a.dag() *a
Hi= delta[x]*(a.dag())
H = [H0, [Hi,H1_coeff]]
result = mesolve(H, psi0, tlist, c_ops, [])
numer=expect(n,result.states)
print delta[x], "done"
return numer
Does anybody know what's wrong here?
I think you need to move the definition of H1_coeff outside of func2.
After a big battle I was finally able to get Theano to use the GPU in OSX.
But now, I've tried everything I can remember and Theano still can't use CuDNN.
I installed CUDA version 7 and CUDNN version 3.
I tried copying the libraries to /usr/local/cuda/lib and also to /usr/local/cuda/lib64, the include file was copied to /usr/local/cuda/include
My .theanorc is
[global]
floatX = float32
device = gpu
force_device = True
allow_gc = False
optimizer_including=cudnn
# warn_float64 = warn
# openmp = True
[nvcc]
fastmath = True
flags = -L/Users/morgado/anaconda/lib/
[cuda]
root = /usr/local/cuda
[gcc]
cxxflags = -L/usr/local/cuda/lib64
And my .profile has the relevant parts:
# CUDA
CUDA_ROOT=/usr/local/cuda
export PATH=$CUDA_ROOT/bin:$PATH
export DYLD_LIBRARY_PATH=$CUDA_ROOT/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_ROOT/lib:$CUDA_ROOT/lib64:$LD_LIBRARY_PATH
But still when I try to get Theano to use CUDNN the further I get (with the files in lib64) gives me the error:
Using gpu device 0: GeForce GT 750M
1 #include <Python.h>
2 #include <iostream>
3 #include "cudnn.h"
4 //////////////////////
5 //// Support Code
6 //////////////////////
7
8 #if PY_MAJOR_VERSION >= 3
9 #define PyInt_FromLong PyLong_FromLong
10 #endif
11
12
13 namespace {
14 struct __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715 {
15 PyObject* __ERROR;
16
17 PyObject* storage_V1;
18
19
20 __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715() {}
21 ~__struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715(void) {
22 cleanup();
23 }
24
25 int init(PyObject* __ERROR, PyObject* storage_V1) {
26 Py_XINCREF(storage_V1);
27 this->storage_V1 = storage_V1;
28
29
30
31 this->__ERROR = __ERROR;
32 return 0;
33 }
34 void cleanup(void) {
35 __label_1:
36
37 double __DUMMY_1;
38 __label_4:
39
40 double __DUMMY_4;
41
42 Py_XDECREF(this->storage_V1);
43 }
44 int run(void) {
45 int __failure = 0;
46
47 PyObject* py_V1;
48
49 PyObject* V1;
50
51 {
52
53 py_V1 = Py_None;
54 {Py_XINCREF(py_V1);}
55
56 V1 = NULL;
57
58 {
59 // Op class DnnVersion
60
61 #if defined(CUDNN_VERSION)
62 V1 = PyTuple_Pack(2, PyInt_FromLong(CUDNN_VERSION), PyInt_FromLong(cudnnGetVersion()));
63 #else
64 V1 = PyInt_FromLong(-1);
65 #endif
66 __label_3:
67
68 double __DUMMY_3;
69
70 }
71 __label_2:
72
73 if (!__failure) {
74
75 assert(py_V1->ob_refcnt > 1);
76 Py_DECREF(py_V1);
77 py_V1 = V1 ? V1 : Py_None;
78 Py_INCREF(py_V1);
79
80 PyObject* old = PyList_GET_ITEM(storage_V1, 0);
81 {Py_XINCREF(py_V1);}
82 PyList_SET_ITEM(storage_V1, 0, py_V1);
83 {Py_XDECREF(old);}
84 }
85
86 Py_XDECREF(V1);
87
88 {Py_XDECREF(py_V1);}
89
90 double __DUMMY_2;
91
92 }
93
94
95 if (__failure) {
96 // When there is a failure, this code puts the exception
97 // in __ERROR.
98 PyObject* err_type = NULL;
99 PyObject* err_msg = NULL;
100 PyObject* err_traceback = NULL;
101 PyErr_Fetch(&err_type, &err_msg, &err_traceback);
102 if (!err_type) {err_type = Py_None;Py_INCREF(Py_None);}
103 if (!err_msg) {err_msg = Py_None; Py_INCREF(Py_None);}
104 if (!err_traceback) {err_traceback = Py_None; Py_INCREF(Py_None);}
105 PyObject* old_err_type = PyList_GET_ITEM(__ERROR, 0);
106 PyObject* old_err_msg = PyList_GET_ITEM(__ERROR, 1);
107 PyObject* old_err_traceback = PyList_GET_ITEM(__ERROR, 2);
108 PyList_SET_ITEM(__ERROR, 0, err_type);
109 PyList_SET_ITEM(__ERROR, 1, err_msg);
110 PyList_SET_ITEM(__ERROR, 2, err_traceback);
111 {Py_XDECREF(old_err_type);}
112 {Py_XDECREF(old_err_msg);}
113 {Py_XDECREF(old_err_traceback);}
114 }
115 // The failure code is returned to index what code block failed.
116 return __failure;
117
118 }
119 };
120 }
121
122
123 static int __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715_executor(__struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715 *self) {
124 return self->run();
125 }
126
127 static void __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715_destructor(PyObject *capsule) {
128 __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715 *self = (__struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715 *)PyCapsule_GetContext(capsule);
129 delete self;
130 }
131
132 //////////////////////
133 //// Functions
134 //////////////////////
135 static PyObject * instantiate(PyObject * self, PyObject *argtuple) {
136 assert(PyTuple_Check(argtuple));
137 if (2 != PyTuple_Size(argtuple)){
138 PyErr_Format(PyExc_TypeError, "Wrong number of arguments, expected 2, got %i", (int)PyTuple_Size(argtuple));
139 return NULL;
140 }
141 __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715* struct_ptr = new __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715();
142 if (struct_ptr->init( PyTuple_GET_ITEM(argtuple, 0),PyTuple_GET_ITEM(argtuple, 1) ) != 0) {
143 delete struct_ptr;
144 return NULL;
145 }
146 PyObject* thunk = PyCapsule_New((void*)(&__struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715_executor), NULL, __struct_compiled_op_m086964a2c5561b842ea4c5d4a203a715_destructor);
147 if (thunk != NULL && PyCapsule_SetContext(thunk, struct_ptr) != 0) {
148 PyErr_Clear();
149 Py_DECREF(thunk);
150 thunk = NULL;
151 }
152
153 return thunk; }
154
155 //////////////////////
156 //// Module init
157 //////////////////////
158 static PyMethodDef MyMethods[] = {
159 {"instantiate", instantiate, METH_VARARGS, "undocumented"} ,
160 {NULL, NULL, 0, NULL}
161 };
162 static struct PyModuleDef moduledef = {
163 PyModuleDef_HEAD_INIT,
164 "m086964a2c5561b842ea4c5d4a203a715",
165 NULL,
166 -1,
167 MyMethods,
168 };
169
170 PyMODINIT_FUNC PyInit_m086964a2c5561b842ea4c5d4a203a715(void) {
171 PyObject *m = PyModule_Create(&moduledef);
172 return m;
173 }
174
===============================
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
clang: warning: argument unused during compilation: '-undefined dynamic_lookup'
ld: library not found for -lcudnn
clang: error: linker command failed with exit code 1 (use -v to see invocation)
['nvcc', '-shared', '-O3', '-L/Users/morgado/anaconda/lib/', '-use_fast_math', '-arch=sm_30', '-m64', '-Xcompiler', '-fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC', '-Xlinker', '-rpath,/Users/morgado/.theano/compiledir_Darwin-14.4.0-x86_64-i386-64bit-i386-3.4.3-64/cuda_ndarray', '-Xlinker', '-rpath,/usr/local/cuda/lib', '-I/Users/morgado/anaconda/lib/python3.4/site-packages/numpy/core/include', '-I/Users/morgado/anaconda/include/python3.4m', '-I/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda', '-o', '/Users/morgado/.theano/compiledir_Darwin-14.4.0-x86_64-i386-64bit-i386-3.4.3-64/tmp578d03tw/m086964a2c5561b842ea4c5d4a203a715.so', 'mod.cu', '-lcudnn', '-lcudart', '-Xcompiler', '-undefined,dynamic_lookup', '-Xlinker', '-pie']
ERROR (theano.gof.opt): SeqOptimizer apply <theano.sandbox.cuda.dnn.NoCuDNNRaise object at 0x10ebb14e0>
ERROR (theano.gof.opt): Traceback:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/opt.py", line 196, in apply
sub_prof = optimizer.optimize(fgraph)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/opt.py", line 82, in optimize
ret = self.apply(fgraph, *args, **kwargs)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda/dnn.py", line 1682, in apply
if not dnn_available():
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda/dnn.py", line 75, in dnn_available
v = version()
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda/dnn.py", line 206, in version
theano.Mode(optimizer=None))
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/compile/function.py", line 266, in function
profile=profile)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/compile/pfunc.py", line 511, in pfunc
on_unused_input=on_unused_input)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/compile/function_module.py", line 1466, in orig_function
defaults)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/compile/function_module.py", line 1324, in create
input_storage=input_storage_lists)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/link.py", line 519, in make_thunk
output_storage=output_storage)[:3]
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/vm.py", line 897, in make_all
no_recycling))
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda/__init__.py", line 259, in make_thunk
compute_map, no_recycling)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/op.py", line 739, in make_thunk
output_storage=node_output_storage)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/cc.py", line 1073, in make_thunk
keep_lock=keep_lock)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/cc.py", line 1015, in __compile__
keep_lock=keep_lock)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/cc.py", line 1442, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/cmodule.py", line 1076, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/gof/cc.py", line 1354, in compile_cmodule
preargs=preargs)
File "/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda/nvcc_compiler.py", line 423, in compile_str
'for cmd', ' '.join(cmd))
Exception: ('The following error happened while compiling the node', <theano.sandbox.cuda.dnn.DnnVersion object at 0x11549af98>(), '\n', 'nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -L/Users/morgado/anaconda/lib/ -use_fast_math -arch=sm_30 -m64 -Xcompiler -fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC -Xlinker -rpath,/Users/morgado/.theano/compiledir_Darwin-14.4.0-x86_64-i386-64bit-i386-3.4.3-64/cuda_ndarray -Xlinker -rpath,/usr/local/cuda/lib -I/Users/morgado/anaconda/lib/python3.4/site-packages/numpy/core/include -I/Users/morgado/anaconda/include/python3.4m -I/Users/morgado/anaconda/lib/python3.4/site-packages/theano/sandbox/cuda -o /Users/morgado/.theano/compiledir_Darwin-14.4.0-x86_64-i386-64bit-i386-3.4.3-64/tmp578d03tw/m086964a2c5561b842ea4c5d4a203a715.so mod.cu -lcudnn -lcudart -Xcompiler -undefined,dynamic_lookup -Xlinker -pie', '[<theano.sandbox.cuda.dnn.DnnVersion object at 0x11549af98>()]'
Seems like clang is not getting the cudnn library even when I specifically told it to check that path.
In your profile add:
export LIBRARY_PATH=$CUDA_ROOT/lib:$CUDA_ROOT/lib64:$LIBRARY_PATH
Including the lib on LIBRARY_PATH worked for me.
I had the same problem and could fix it by setting
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH
in my .bashrc and running
sudo update_dyld_shared_cache
afterwards.
I am trying to package a PyQt program for OSX using PyInstaller 2, where PyQt4 (4.10) has been built against Qt 5.0.2 (from Git). The following simple example doesn't work.
import sys
from PyQt4.QtGui import QApplication, QMessageBox
def main():
print "Hello"
a = QApplication(sys.argv)
m = QMessageBox(QMessageBox.Information, "Title", "Hello")
m.exec_()
if __name__=="__main__":
main()
Spec file generated using pyinstaller-2.0/utils/MakeSpec.py and modified to add the BUNDLE class.
a = Analysis(['hello.py'],
pathex=['/Users/glenn/rp/src/demo'],
hiddenimports=[],
hookspath=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build/pyi.darwin/hello', 'hello'),
debug=False,
strip=None,
upx=True,
console=False )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name=os.path.join('dist', 'hello'))
app = BUNDLE(coll,
name=os.path.join('dist', 'hello.app'),
appname="Hello",
version = '0.1'
)
Packaging command
> python pyinstaller.py --windowed hello.spec
Running the binary directly from the terminal gives this output before it crashes:
$ ./dist/hello.app/Contents/MacOS/hello
Hello
Failed to load platform plugin "cocoa". Available platforms are:
Abort trap: 6
and this is the stack trace:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x9a671a6a __pthread_kill + 10
1 libsystem_c.dylib 0x93163b2f pthread_kill + 101
2 libsystem_c.dylib 0x9319a4ec abort + 168
3 QtCore 0x03db156b qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) + 11
4 QtCore 0x03db19df QMessageLogger::fatal(char const*, ...) const + 63
5 QtGui 0x068abceb QGuiApplicationPrivate::createPlatformIntegration() + 3547
6 QtGui 0x068abd16 QGuiApplicationPrivate::createEventDispatcher() + 38
7 QtCore 0x03f4f2c4 QCoreApplication::init() + 100
8 QtCore 0x03f4f23b QCoreApplication::QCoreApplication(QCoreApplicationPrivate&) + 59
9 QtGui 0x068aa0d0 QGuiApplication::QGuiApplication(QGuiApplicationPrivate&) + 32
10 QtWidgets 0x06c695de QApplication::QApplication(int&, char**, int) + 238
11 PyQt4.QtGui.so 0x06394454 init_QApplication + 196
12 sip.so 0x007bc7d5 sipSimpleWrapper_init + 266
13 Python 0x0385c174 type_call + 340
14 Python 0x0380d401 PyObject_Call + 97
15 Python 0x0389c093 PyEval_EvalFrameEx + 10131
16 Python 0x038a0490 fast_function + 192
17 Python 0x0389beae PyEval_EvalFrameEx + 9646
18 Python 0x038998b2 PyEval_EvalCodeEx + 1922
19 Python 0x03899127 PyEval_EvalCode + 87
20 Python 0x038be06e PyRun_StringFlags + 126
21 Python 0x038bdfb1 PyRun_SimpleStringFlags + 81
22 Python 0x038bf619 PyRun_SimpleString + 25
23 hello 0x00003240 runScripts + 240
24 hello 0x0000280a main + 442
25 hello 0x00001eb9 _start + 224
26 hello 0x00001dd8 start + 40
The issue appears to be that it can't find the libqcocoa.dylib plugin. This is not surprising as it is not packaged. Is that the actual issue here and do I need to include this plugin? If so where does it need to go? I have tried putting it in demo.app/Contents/plugins but that doesn't help.
The right place to put libqcocoa.dylib is in Contents/MacOS/qt4_plugins/platforms:
extralibs = [("qt4_plugins/platforms/libqcocoa.dylib", "/path/to/libqcocoa.dylib", "BINARY")
]
coll = COLLECT(exe,
a.binaries + extralibs,
a.zipfiles,
a.datas,
strip=None,
upx=False,
name=os.path.join('dist', 'hello'))
The app now starts but the dialog window never appears. Edit: This is because PyInstaller (v 2.0) adds LSBackgroundOnly=true to the apps Info.plist. Removing this allows the window to show.
Try adding (but changed for PyQt):
from PySide import QtCore, QtGui
At least that works for me (PySide 1.1.1, Qt 4.8.1, latest dev Pyinstaller, OSX 10.7.5, with no changes to the spec file and --onefile --windowed arguments to pyinstaller.) And without this snippet, it also crashes for me.
I suppose that pulls in more dependencies.
Found this in another answer.