Enabling GPU with theano generates Exception - gpu

I have followed the steps from here to enable gpu with theano on an Ubuntu 16.04 machine. I installed cuda toolkit, cudnn, drivers but I am still not able to get it to work. And when I run:
from theano.sandbox import cuda
cuda.use("gpu0")
I get the following exception:
Exception: ('The following error happened while compiling the node', GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>), '\n', 'nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -arch=sm_50 -m64 -Xcompiler -fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker -rpath,/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -I/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -I/usr/include -I/home/...thon2.7/site-packages/numpy/core/include -I/home/.../python2.7 -I/home/.../python2.7/site-packages/theano/gof -I/home/.../python2.7/site-packages/theano/sandbox/cuda -L/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -L/home/... -o /home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/tmpYVhcOM/544270fe7a21a748315f83abfe0913cc.so mod.cu -lcudart -lcublas -lcuda_ndarray -lpython2.7', '[GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>)]')
How can I fix this error?
Here is the full error trace:
Python 2.7.13 |Anaconda 4.4.0 (64-bit)| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from theano.sandbox import cuda
>>> cuda.use("gpu0")
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10). Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29
/home/.../python2.7/site-packages/theano/sandbox/cuda/__init__.py:556: UserWarning: Theano flag device=gpu* (old gpu back-end) only support floatX=float32. You have floatX=float64. Use the new gpu back-end with device=cuda* for that value of floatX.
warnings.warn(msg)
WARNING (theano.gof.compilelock): Overriding existing lock by dead process '8175' (I am process '2320')
In file included from /home/.../python2.7/Python.h:8:0,
from mod.cu:1:
/home/.../python2.7/pyconfig.h:1190:0: warning: "_POSIX_C_SOURCE" redefined
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/host_config.h:161:0,
from /usr/include/cuda_runtime.h:76,
from <command-line>:0:
/usr/include/features.h:228:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /home/.../python2.7/Python.h:8:0,
from mod.cu:1:
/home/.../python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/host_config.h:161:0,
from /usr/include/cuda_runtime.h:76,
from <command-line>:0:
/usr/include/features.h:169:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
In file included from /home/.../python2.7/Python.h:8:0,
from mod.cu:1:
/home/.../python2.7/pyconfig.h:1190:0: warning: "_POSIX_C_SOURCE" redefined
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/host_config.h:161:0,
from /usr/include/cuda_runtime.h:76,
from <command-line>:0:
/usr/include/features.h:228:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /home/.../python2.7/Python.h:8:0,
from mod.cu:1:
/home/.../python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/host_config.h:161:0,
from /usr/include/cuda_runtime.h:76,
from <command-line>:0:
/usr/include/features.h:169:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
mod.cu: In member function ‘int _GLOBAL__N__38_tmpxft_00000948_00000000_9_mod_cpp1_ii_ae46f2fe::__struct_compiled_op_544270fe7a21a748315f83abfe0913cc::run()’:
mod.cu:388:172: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
['nvcc', '-shared', '-O3', '-arch=sm_50', '-m64', '-Xcompiler', '-fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden', '-Xlinker', '-rpath,/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray', '-I/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray', '-I/usr/include', '-I/home/...thon2.7/site-packages/numpy/core/include', '-I/home/.../python2.7', '-I/home/.../python2.7/site-packages/theano/gof', '-I/home/.../python2.7/site-packages/theano/sandbox/cuda', '-L/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray', '-L/home/...', '-o', '/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/tmpYVhcOM/544270fe7a21a748315f83abfe0913cc.so', 'mod.cu', '-lcudart', '-lcublas', '-lcuda_ndarray', '-lpython2.7']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/.../python2.7/site-packages/theano/sandbox/cuda/__init__.py", line 593, in use
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
File "/home/.../python2.7/site-packages/theano/sandbox/cuda/tests/test_driver.py", line 32, in test_nvidia_driver1
profile=False)
File "/home/.../python2.7/site-packages/theano/compile/function.py", line 326, in function
output_keys=output_keys)
File "/home/.../python2.7/site-packages/theano/compile/pfunc.py", line 486, in pfunc
output_keys=output_keys)
File "/home/.../python2.7/site-packages/theano/compile/function_module.py", line 1795, in orig_function
defaults)
File "/home/.../python2.7/site-packages/theano/compile/function_module.py", line 1661, in create
input_storage=input_storage_lists, storage_map=storage_map)
File "/home/.../python2.7/site-packages/theano/gof/link.py", line 699, in make_thunk
storage_map=storage_map)[:3]
File "/home/.../python2.7/site-packages/theano/gof/vm.py", line 1047, in make_all
impl=impl))
File "/home/.../python2.7/site-packages/theano/gof/op.py", line 935, in make_thunk
no_recycling)
File "/home/.../python2.7/site-packages/theano/gof/op.py", line 839, in make_c_thunk
output_storage=node_output_storage)
File "/home/.../python2.7/site-packages/theano/gof/cc.py", line 1190, in make_thunk
keep_lock=keep_lock)
File "/home/.../python2.7/site-packages/theano/gof/cc.py", line 1131, in __compile__
keep_lock=keep_lock)
File "/home/.../python2.7/site-packages/theano/gof/cc.py", line 1586, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "/home/.../python2.7/site-packages/theano/gof/cmodule.py", line 1159, in module_from_key
module = lnk.compile_cmodule(location)
File "/home/.../python2.7/site-packages/theano/gof/cc.py", line 1489, in compile_cmodule
preargs=preargs)
File "/home/.../python2.7/site-packages/theano/sandbox/cuda/nvcc_compiler.py", line 405, in compile_str
'for cmd', ' '.join(cmd))
Exception: ('The following error happened while compiling the node', GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>), '\n', 'nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -arch=sm_50 -m64 -Xcompiler -fno-math-errno,-Wno-unused-label,-Wno-unused-variable,-Wno-write-strings,-DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker -rpath,/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -I/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -I/usr/include -I/home/...thon2.7/site-packages/numpy/core/include -I/home/.../python2.7 -I/home/.../python2.7/site-packages/theano/gof -I/home/.../python2.7/site-packages/theano/sandbox/cuda -L/home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/cuda_ndarray -L/home/... -o /home/...ledir_Linux-4.10--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/tmpYVhcOM/544270fe7a21a748315f83abfe0913cc.so mod.cu -lcudart -lcublas -lcuda_ndarray -lpython2.7', '[GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>)]')

Related

MSYS2 pip install numpy failed

I am new to MSYS2, so I tried to install numpy using pip (mingw-w64-x86_64-python3-pip-9.0.1-3), but the the installation is failed. Here is the output:
(...)
C compiler: x86_64-pc-msys-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
x86_64-pc-msys-gcc: _configtest.c
/usr/bin/bash: x86_64-pc-msys-gcc: command not found
/usr/bin/bash: x86_64-pc-msys-gcc: command not found
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-3d852664/numpy/setup.py", line 394, in <module>
setup_package()
File "/tmp/pip-build-3d852664/numpy/setup.py", line 386, in setup_package
setup(**metadata)
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/install.py", line 62, in run
r = self.setuptools_run()
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
return distutils_install.run(self)
File "/usr/lib/python3.6/distutils/command/install.py", line 551, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 314, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/build.py", line 47, in run
old_build.run(self)
File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.6/distutils/cmd.py", line 314, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/build_src.py", line 148, in run
self.build_sources()
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/build_src.py", line 159, in build_sources
self.build_library_sources(*libname_info)
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/build_src.py", line 294, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/tmp/pip-build-3d852664/numpy/numpy/distutils/command/build_src.py", line 377, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 675, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-3d852664/numpy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-4nnf7xbj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-3d852664/numpy/
I have already build tools installed: I used the tutorial on https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2 (I only 64-bit packages)
I looked for similar issues on the net but I found nothing relevant.
Any comment or suggestion is welcome
Thanks in advance
The proper gcc compiler has not been installed. For my installation, I used the msys2 shell (not mingw) and installed the msys/gcc package:
pacman -S msys/gcc
pacman -S mingw-w64-x86_64-python-scipy
pacman -S mingw-w64-i686-python-scipy

import tensorlfow failed with errors "undefined symbol: omp_get_num_threads"

Import tensorflow failed due to message "undefined symbol: omp_get_num_threads"
1. I configure tensorflow by "-O3 -DNDEBUG -fPIC -DEIGEN_USE_MKL_ALL -DMKL_ILP64 -fopenmp -m64 -v -I/opt/intel/mkl/include".
2. Build tensorflow by "bazel build --copt=-march="haswell" --config=opt -c opt //tensorflow/tools/pip_package:build_pip_package"
3. After finishing building, run "bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg"
4. Pip install /tmp/tensorflow_pkg/tensorflow-1.2.1-cp27-cp27mu-linux_x86_64.whl
5. Run command "python -c "import tensorflow; print(tensorflow.version)""
6. Get the error message "ImportError: /home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: omp_get_num_threads"
The whole statck is as belows:
[Traceback (most recent call last):
File "", line 1, in
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: /home/admin/anaconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: omp_get_num_threads]

xmlsec on el capitan

I'm trying to install xmlsec on El Capitan and i'm not able to do so.
I'm following instructions on this page:
https://github.com/concordusapps/python-xmlsec
when I do pip install xmlsec I get:
Downloading xmlsec-0.3.1.tar.gz
Complete output from command python setup.py egg_info:
no previously-included directories found matching 'doc/.build'
Installed /private/tmp/easy_install-kotwF5/pkgconfig-1.1.0/.eggs/nose-1.3.7-py2.7.egg
zip_safe flag not set; analyzing archive contents...
Installed /private/tmp/pip-build-my91LX/xmlsec/.eggs/pkgconfig-1.1.0-py2.7.egg
Searching for setuptools-cython
Reading https://pypi.python.org/simple/setuptools_cython/
Best match: setuptools-cython 0.2.1
Downloading https://pypi.python.org/packages/source/s/setuptools_cython/setuptools_cython-0.2.1.tar.gz#md5=c29fc5bf2894e69cbd98e3800cef4707
Processing setuptools_cython-0.2.1.tar.gz
Writing /tmp/easy_install-xnAHIU/setuptools_cython-0.2.1/setup.cfg
Running setuptools_cython-0.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-xnAHIU/setuptools_cython-0.2.1/egg-dist-tmp-zk1125
zip_safe flag not set; analyzing archive contents...
Copying setuptools_cython-0.2.1-py2.7.egg to /private/tmp/pip-build-my91LX/xmlsec/.eggs
Installed /private/tmp/pip-build-my91LX/xmlsec/.eggs/setuptools_cython-0.2.1-py2.7.egg
Searching for Cython
Reading https://pypi.python.org/simple/Cython/
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/tmp/pip-build-my91LX/xmlsec/setup.py", line 121, in <module>
make_extension('xmlsec.template'),
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 836, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1081, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1093, in obtain
return installer(requirement)
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 626, in easy_install
not self.always_copy, self.local_index
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 590, in fetch_distribution
self.find_packages(requirement)
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 427, in find_packages
self.scan_url(self.index_url + requirement.unsafe_name+'/')
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 761, in scan_url
self.process_url(url, True)
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 304, in process_url
f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 700, in open_url
return open_with_auth(url, self.opener)
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 894, in _socket_timeout
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 1007, in open_with_auth
fp = opener(request)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 469, in error
result = self._call_chain(*args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 656, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 469, in error
result = self._call_chain(*args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 656, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1200, in do_open
r = h.getresponse(buffering=True)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1132, in getresponse
response.begin()
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 480, in readline
data = self._sock.recv(self._rbufsize)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 734, in recv
return self.read(buflen)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 621, in read
v = self._sslobj.read(len or 1024)
ssl.SSLError: ('The read operation timed out',)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-my91LX/xmlsec
and when I download the source and do it manually I get:
Processing /Users/myuser/python-xmlsec
Requirement already satisfied (use --upgrade to upgrade): lxml>=3.0 in /usr/local/lib/python2.7/site-packages (from xmlsec==0.1.2)
Installing collected packages: xmlsec
Running setup.py install for xmlsec
Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-ad8Fqh-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-X7VjyO-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/xmlsec
copying src/xmlsec/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/xmlsec
copying src/xmlsec/meta.py -> build/lib.macosx-10.11-x86_64-2.7/xmlsec
running build_ext
cythoning src/xmlsec/constants.pyx to src/xmlsec/constants.c
building 'xmlsec.constants' extension
creating build/temp.macosx-10.11-x86_64-2.7
creating build/temp.macosx-10.11-x86_64-2.7/src
creating build/temp.macosx-10.11-x86_64-2.7/src/xmlsec
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/lib/python2.7/site-packages/lxml -I/usr/local/lib/python2.7/site-packages/lxml/includes -Isrc -I/usr/local/Cellar/libxml2/2.9.2/include/libxml2 -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/xmlsec/constants.c -o build/temp.macosx-10.11-x86_64-2.7/src/xmlsec/constants.o
In file included from src/xmlsec/constants.c:256:
src/xmlsec.h:1:10: fatal error: 'xmlsec/crypto.h' file not found
#include <xmlsec/crypto.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-ad8Fqh-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-X7VjyO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-ad8Fqh-build
Is there something i'm missing?
This finally worked:
brew install -v libxmlsec1
Obviously this is using homebrew on macOS.
Installing (or reinstalling) limbxmlsec1 didn't work for me on OSX 10.14. Here's what I had to do:
There are some SDK headers that come with xcode. Copy them to the desktop:
cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop
Install the package by double-clicking it, or by running this command:
sudo installer -pkg ~/Desktop/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Try installing again:
pip install xmlsec

What dependencies do I need for USB programing in python with pyUSB?

I am trying to get the usb.find command to work properly in a python script I'm writing on Angstrom for the Beagleboard.
Here is my code:
#!/usr/bin/env python
import usb.core
import usb.util
import usb.backend.libusb01 as libusb
PYUSB_DEBUG_LEVEL = 'debug'
# find our device
# Bus 002 Device 006: ID 1208:0815
# idVendor 0x1208
# idProduct 0x0815
# dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# iManufacturer 1 TOROBOT.com
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815,
backend=libusb.get_backend() )
I don't know what's missing, but here is what I do know.
When I don't specify the backend, no backend is found. When I do specify the backend usb.backend.libusb01 I get the following error:
root#beagleboard:~/servo# ./pyServo.py
Traceback (most recent call last):
File "./pyServo.py", line 17, in <module>
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815, backend=libusb.get_backend() )
File "/usr/lib/python2.6/site-packages/usb/core.py", line 854, in find
return _interop._next(device_iter(k, v))
File "/usr/lib/python2.6/site-packages/usb/_interop.py", line 60, in _next
return next(iter)
File "/usr/lib/python2.6/site-packages/usb/core.py", line 821, in device_iter
for dev in backend.enumerate_devices():
File "/usr/lib/python2.6/site-packages/usb/backend/libusb01.py", line 390, in enumerate_devices
_check(_lib.usb_find_busses())
File "/usr/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: usb_find_busses
What am I missing so that this will work properly?
Try installing python-pyusb through opkg, that should install the native dependencies.

installing numpy using python3.2 Mac OSX Lion

Trying to build numpy on OSX Lion.
I followed the instructions from this post, using a replacing 10.6 with 10.7 for LDSHARED. However when I run setup.py it seems like it is still using 10.6??
how do i fix this?
eric#system-process-2 /Users/Eric/Desktop/numpy-1.7.0b2$ export CC=clang
eric#system-process-2 /Users/Eric/Desktop/numpy-1.7.0b2$ export CXX=clang
eric#system-process-2 /Users/Eric/Desktop/numpy-1.7.0b2$ export FFLAGS=-ff2c
eric#system-process-2 /Users/Eric/Desktop/numpy-1.7.0b2$ export LDSHARED='clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -g'
eric#system-process-2 /Users/Eric/Desktop/numpy-1.7.0b2$ python3.2 setup.py build
Converting to Python3 via 2to3...
Running from numpy source directory.
non-existing path in 'numpy/distutils': 'site.cfg'
F2PY Version 2
blas_opt_info:
FOUND:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3)]
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
non-existing path in 'numpy/lib': 'benchmarks'
lapack_opt_info:
FOUND:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3)]
extra_compile_args = ['-msse3']
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building library "npymath" sources
customize Gnu95FCompiler
Found executable /usr/local/bin/gfortran
Could not locate executable clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -g
customize Gnu95FCompiler
customize Gnu95FCompiler using config
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c'
clang: _configtest.c
clang _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c'
clang: _configtest.c
_configtest.c:1:5: warning: incompatible redeclaration of library function 'exp'
int exp (void);
^
_configtest.c:1:5: note: 'exp' is a builtin with type 'double (double)'
1 warning generated.
_configtest.c:1:5: warning: incompatible redeclaration of library function 'exp'
int exp (void);
^
_configtest.c:1:5: note: 'exp' is a builtin with type 'double (double)'
1 warning generated.
clang _configtest.o -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
building library "npysort" sources
building extension "numpy.core._dummy" sources
Generating build/src.macosx-10.6-intel-3.2/numpy/core/include/numpy/config.h
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk
compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c'
clang: _configtest.c
In file included from _configtest.c:1:
/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
In file included from _configtest.c:1:
/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "setup.py", line 214, in <module>
setup_package()
File "setup.py", line 207, in setup_package
configuration=configuration )
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/core.py", line 186, in setup
return old_setup(**new_attr)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/command/build.py", line 37, in run
old_build.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/command/build.py", line 126, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/command/build_src.py", line 152, in run
self.build_sources()
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/command/build_src.py", line 169, in build_sources
self.build_extension_sources(ext)
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/command/build_src.py", line 328, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/Users/eric/Desktop/numpy-1.7.0b2/build/py3k/numpy/distutils/command/build_src.py", line 385, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 410, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 41, in check_types
out = check_types(*a, **kw)
File "numpy/core/setup.py", line 271, in check_types
"Cannot compile 'Python.h'. Perhaps you need to "\
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
Met similar problem, and the following command worked for me:
export CFLAGS="-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" tox