Can't get Theano to link against CUDNN on OSX - macos
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.
Related
Get C function name by keyword
As below C sample, Is any shell command could get/parsing founction name based on insided keyword. such as below C, then $ foo netif_carrier_on then output mii_check_link 484 void mii_check_link (struct mii_if_info *mii) 485 { 486 int cur_link = mii_link_ok(mii); 487 int prev_link = netif_carrier_ok(mii->dev); 488 489 if (cur_link && !prev_link) 490 netif_carrier_on(mii->dev); 491 else if (prev_link && !cur_link) 492 netif_carrier_off(mii->dev); 493 }
Why Encode a string in Base64 (based on the Microsoft Crypto API) using PowerBuilder produce a result differ than Convert.ToBase64String() in .Net?
I have a text contains a hexadecimal bytes as follows: 01 1b 42 61 6b 68 73 68 5f 48 6f 73 70 69 74 61 6c 5f 41 6c 2d 53 68 61 72 61 66 69 61 02 0f 33 30 30 31 37 34 37 36 39 35 31 30 30 30 33 03 10 30 32 2f 30 31 2f 31 37 5f 30 35 3a 31 32 5f 50 04 05 31 34 2e 30 30 05 01 30 , when I am encrypting it to BASE64 using the of_encode64() function in powerbuilder winsock user object, I got the below result: MDExQjQyNjE2QjY4NzM2ODVGNDg2RjczNzA2OTc0NjE2QzVGNDE2QzJENTM2ODYx NzI2MTY2Njk2MTAyMEYzMzMwMzAzMTM3MzQzNzM2MzkzNTMxMzAzMDMwMzMwMzEw MzAzMjJGMzAzMTJGMzEzNzVGMzAzNTNBMzEzMjVGNTAwNDA1MzEzNDJFMzAzMDA1 MDEzMA== , but when my friend encodes it using the Convert.ToBase64String() in Dot Net, he got a totally different result as below: ARtCYWtoc2hfSG9zcGl0YWxfQWwtU2hhcmFmaWECDzMwMDE3NDc2OTUxMDAwMwMQMDIvMDEvMTdfMDU6MTJfUAQFMTQuMDAFATA= , I played with all possible parameters: CRYPT_STRING_BASE64HEADER, CRYPT_STRING_BASE64REQUESTHEADER, CRYPT_STRING_BASE64X509CRLHEADER but not help! The of_encode64() function code as below: [local function declaration] Function boolean CryptBinaryToString ( & Blob pbBinary, & ulong cbBinary, & ulong dwFlags, & Ref string pszString, & Ref ulong pcchString & ) Library "crypt32.dll" Alias For "CryptBinaryToStringW" [instance variables] // Base64, with certificate beginning and ending headers CONSTANT Ulong CRYPT_STRING_BASE64HEADER = 0 // Base64, without headers CONSTANT Ulong CRYPT_STRING_BASE64 = 1 // Base64, with request beginning and ending headers CONSTANT Ulong CRYPT_STRING_BASE64REQUESTHEADER = 3 // Base64, with X.509 CRL beginning and ending headers CONSTANT Ulong CRYPT_STRING_BASE64X509CRLHEADER = 9 Encode a String to Base64: // ----------------------------------------------------------------------------- // SCRIPT: n_winsock.of_Encode64 // // PURPOSE: This function converts binary data to a Base64 encoded string. // // Note: Requires Windows XP or Server 2003 // // ARGUMENTS: ablob_data - Blob containing data // // RETURN: String containing encoded data // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 08/20/2010 RolandS Initial coding // 09/27/2010 RolandS Changed to remove trailing CRLF characters // 03/17/2012 RolandS Changed argument to read-only // ----------------------------------------------------------------------------- String ls_encoded ULong lul_len, lul_buflen Boolean lb_rtn lul_len = Len(ablob_data) lul_buflen = lul_len * 3 //lul_buflen = lul_len * 2 ls_encoded = Space(lul_buflen) lb_rtn = CryptBinaryToString(ablob_data, lul_len, & CRYPT_STRING_BASE64, ls_encoded, lul_buflen) If lb_rtn Then ls_encoded = Left(ls_encoded, lul_buflen - 2) Else SetNull(ls_encoded) End If Return ls_encoded I am calling it using this code: Where as_data is the Hexadecimal Bytes String above Return of_Encode64(Blob(as_data, EncodingAnsi!)) The full code for Encode/decode a string in Base64 in PowerBuilder using the winsock user object in this below URL: https://www.rgagnon.com/pbdetails/pb-0258.html Thank you in advance. Keep Safe.
"go build -buildmode=c-shared" compiled dll, how to hide the exported goruntime function?
Use dumpbin view export functions, I found a lot of goruntime functions export, hoping to hide them. example: // file hello.go package main // //Needed for build import "C" import ( "fmt" ) //export SayHello func SayHello(name string) { fmt.Printf("func in Golang SayHello says: Hello, %s!\n", name) } //export SayHelloByte func SayHelloByte(name []byte) { fmt.Printf("func in Golang SayHelloByte says: Hello, %s!\n", string(name)) } //export SayBye func SayBye() { fmt.Println("func in Golang SayBye says: Bye!") } func main() { // We need the main function to make possible // CGO compiler to compile the package as C shared library } >go build -buildmode=c-shared -o libhello.dll hello.go >dumpbin -exports libhello.dll Microsoft (R) COFF/PE Dumper Version 14.00.24215.1 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file libhello.dll File Type: DLL Section contains the following exports for libhello.dll 00000000 characteristics 5C7FB64A time date stamp Wed Mar 6 20:00:10 2019 0.00 version 1 ordinal base 3320 number of functions 3320 number of names ordinal hint RVA name 1 0 00092F50 SayBye 2 1 00092EA0 SayHello 3 2 00092EF0 SayHelloByte 4 3 00093240 _cgo_get_context_function 5 4 000A1A68 _cgo_init 6 5 000930E0 _cgo_is_runtime_initialized 7 6 00093020 _cgo_maybe_run_preinit 8 7 000A1A70 _cgo_notify_runtime_init_done 9 8 00058970 _cgo_panic 10 9 00092FC0 _cgo_preinit_init 11 A 00092F90 _cgo_release_context 12 B 000A1A78 _cgo_sys_thread_create 13 C 00093330 _cgo_sys_thread_start 14 D 000A1A80 _cgo_thread_start 15 E 00052090 _cgo_topofstack 16 F 00093110 _cgo_wait_runtime_init_done 17 10 0016E070 _cgo_yield 18 11 00092D20 _cgoexp_fd8bec644a00_SayBye 19 12 00092AA0 _cgoexp_fd8bec644a00_SayHello 20 13 00092BD0 _cgoexp_fd8bec644a00_SayHelloByte 21 14 000538A0 _rt0_amd64_windows_lib 22 15 000A1A40 _rt0_amd64_windows_lib.ptr 23 16 00053900 _rt0_amd64_windows_lib_go 24 17 000589C0 crosscall2 25 18 00093380 crosscall_amd64 26 19 0005B450 errors.(*errorString).Error 27 1A 0005B3C0 errors.New 28 1B 0008A230 fmt.(*buffer).WriteRune 29 1C 000884A0 fmt.(*fmt).fmtBoolean 30 1D 00089030 fmt.(*fmt).fmtBs 31 1E 00089870 fmt.(*fmt).fmtC 32 1F 00089A40 fmt.(*fmt).fmtFloat 33 20 000888B0 fmt.(*fmt).fmtInteger 34 21 00089660 fmt.(*fmt).fmtQ 35 22 00089930 fmt.(*fmt).fmtQc 36 23 00088FB0 fmt.(*fmt).fmtS 37 24 000890C0 fmt.(*fmt).fmtSbx 38 25 00088530 fmt.(*fmt).fmtUnicode 39 26 00087DF0 fmt.(*fmt).pad 40 27 00088150 fmt.(*fmt).padString 41 28 00088E70 fmt.(*fmt).truncate 42 29 00088D80 fmt.(*fmt).truncateString 43 2A 00087C60 fmt.(*fmt).writePadding 44 2B 0008A620 fmt.(*pp).Flag 45 2C 0008A600 fmt.(*pp).Precision 46 2D 0008A5E0 fmt.(*pp).Width 47 2E 0008A6B0 fmt.(*pp).Write 48 2F 00091000 fmt.(*pp).argNumber 49 30 00091120 fmt.(*pp).badArgNum 50 31 0008AEF0 fmt.(*pp).badVerb 51 32 0008CDB0 fmt.(*pp).catchPanic 52 33 00091440 fmt.(*pp).doPrintf 53 34 000925A0 fmt.(*pp).doPrintln ... I want to export only the SayHello, SayHelloByte, SayBye functions instead of exporting the goruntime function. What should I do? I searched for a few hours and didn't find a way to get golang. thank you very much.
This issue was fixed in Go 1.16 and backported to Go 1.15.
What does $INSIDE_EMACS do for bash
I saw here that bash 4.4 looks for the variable $INSIDE_EMACS to determine if it is running in a comint mode buffer. However I can't seem to find what this changes about bash behavior. What changes does $INSIDE_EMACS make?
According to emacs doc: Emacs sets the environment variable INSIDE_EMACS in the subshell to version,comint, where version is the Emacs version (e.g., 24.1). Programs can check this variable to determine whether they are running inside an Emacs subshell. Took a look at bash's source code and there's no much magic: 575 /* 576 * M-x term -> TERM=eterm-color INSIDE_EMACS='251,term:0.96' (eterm) 577 * M-x shell -> TERM='dumb' INSIDE_EMACS='25.1,comint' (no line editing) 578 * 579 * Older versions of Emacs may set EMACS to 't' or to something like 580 * '22.1 (term:0.96)' instead of (or in addition to) setting INSIDE_EMACS. 581 * They may set TERM to 'eterm' instead of 'eterm-color'. They may have 582 * a now-obsolete command that sets neither EMACS nor INSIDE_EMACS: 583 * M-x terminal -> TERM='emacs-em7955' (line editing) 584 */ 585 if (interactive_shell) 586 { 587 char *term, *emacs, *inside_emacs;; 588 int emacs_term, in_emacs; 589 590 term = get_string_value ("TERM"); 591 emacs = get_string_value ("EMACS"); 592 inside_emacs = get_string_value ("INSIDE_EMACS"); 593 594 if (inside_emacs) 595 { 596 emacs_term = strstr (inside_emacs, ",term:") != 0; 597 in_emacs = 1; 598 } 599 else if (emacs) 600 { 601 /* Infer whether we are in an older Emacs. */ 602 emacs_term = strstr (emacs, " (term:") != 0; 603 in_emacs = emacs_term || STREQ (emacs, "t"); 604 } 605 else 606 in_emacs = emacs_term = 0; 607 608 /* Not sure any emacs terminal emulator sets TERM=emacs any more */ 609 no_line_editing |= STREQ (term, "emacs"); 610 no_line_editing |= in_emacs && STREQ (term, "dumb"); 611 612 /* running_under_emacs == 2 for `eterm' */ 613 running_under_emacs = in_emacs || STREQN (term, "emacs", 5); 614 running_under_emacs += emacs_term && STREQN (term, "eterm", 5); 615 616 if (running_under_emacs) 617 gnu_error_format = 1; 618 } UPDATE: Just found the original request (in bug-bash mailing list) for bash to deal with INSIDE_EMACS: Bash should look at INSIDE_EMACS not just EMACS
At the very least, it causes bash to disable line editing, since presumably you will be using emacs's own editing facilities to edit a command line.
Jupyter notebook Conda error running MoviePy code
On my macOS v 10.11.6, I got an error running moviepy on jupyter notebook Python v 3.5.2 Conda v 4.3.8 Jupyter 4.2.1 I'm importing and running a simple cell: from moviepy.editor import VideoFileClip from IPython.display import HTML new_clip_output = 'test_output.mp4' test_clip = VideoFileClip("test.mp4") new_clip = test_clip.fl_image(lambda x: cv2.cvtColor(x, cv2.COLOR_RGB2YUV)) #NOTE: this function expects color images!! %time new_clip.write_videofile(new_clip_output, audio=False) The error is: TypeError Traceback (most recent call last) <ipython-input-8-27aee53c99d8> in <module>() 1 new_clip_output = 'test_output.mp4' --> 2 test_clip = VideoFileClip("test.mp4") 3 new_clip = test_clip.fl_image(lambda x: cv2.cvtColor(x, cv2.COLOR_RGB2YUV)) #NOTE: this function expects color images!! 4 get_ipython().magic('time new_clip.write_videofile(new_clip_output, audio=False)') /Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/video/io/VideoFileClip.py in __init__(self, filename, has_mask, audio, audio_buffersize, audio_fps, audio_nbytes, verbose) 80 buffersize= audio_buffersize, 81 fps = audio_fps, --> 82 nbytes = audio_nbytes) 83 84 def __del__(self): /Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/AudioFileClip.py in __init__(self, filename, buffersize, nbytes, fps) 61 self.filename = filename 62 reader = FFMPEG_AudioReader(filename,fps=fps,nbytes=nbytes, --> 63 buffersize=buffersize) 64 65 self.reader = reader /Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in __init__(self, filename, buffersize, print_infos, fps, nbytes, nchannels) 68 self.buffer_startframe = 1 69 self.initialize() --> 70 self.buffer_around(1) 71 72 /Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in buffer_around(self, framenumber) 232 else: 233 self.seek(new_bufferstart) --> 234 self.buffer = self.read_chunk(self.buffersize) 235 236 self.buffer_startframe = new_bufferstart /Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in read_chunk(self, chunksize) 121 result = (1.0*result / 2**(8*self.nbytes-1)).\ 122 reshape((len(result)/self.nchannels, --> 123 self.nchannels)) 124 #self.proc.stdout.flush() 125 self.pos = self.pos+chunksize TypeError: 'float' object cannot be interpreted as an integer Is it because of some conflict in versions of various libraries?