Issue 1:
python 3.5.3 (default, Jan 19 2017, 14:11:04)

[GCC 6.3.0 20170118] on linux

Type "help", "copyright", "credits" or "license" for more information.

import cv2

import torch

*** Error in `python3': free(): invalid pointer: 0x00007f15aad8cb80 ***

======= Backtrace: =========

/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7f15bcbf008b]

/lib/x86_64-linux-gnu/libc.so.6(+0x82c3a)[0x7f15bcbf9c3a]

/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f15bcbfdd2c]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt6locale5_Impl16_M_install_facetEPKNS_2idEPKNS_5facetE+0x142)[0x7f15aab26802]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt6locale5_ImplC2Em+0x1e3)[0x7f15aab28953]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt6locale18_S_initialize_onceEv+0x15)[0x7f15aab298c5]

/lib/x86_64-linux-gnu/libpthread.so.0(+0xec59)[0x7f15bcf4cc59]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt6locale13_S_initializeEv+0x21)[0x7f15aab29911]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt6localeC1Ev+0x13)[0x7f15aab29953]

/usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so(_ZNSt8ios_base4InitC1Ev+0xb4)[0x7f15aaafb1b4]

/usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18(+0x2a5a14)[0x7f15876d6a14]

/usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18(+0x2a6aa3)[0x7f15876d7aa3]

/usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18(+0x335026)[0x7f1587766026]

======= Memory map: ========

5568f000f000-5568f03fd000 r-xp 00000000 08:02 13894926 /usr/bin/python3.5

5568f05fc000-5568f05ff000 r--p 003ed000 08:02 13894926 /usr/bin/python3.5

5568f05ff000-5568f0695000 rw-p 003f0000 08:02 13894926 /usr/bin/python3.5

5568f0695000-5568f06c6000 rw-p 00000000 00:00 0

5568f0f39000-5568f156f000 rw-p 00000000 00:00 0 [heap]

7f1580000000-7f1580021000 rw-p 00000000 00:00 0

7f1580021000-7f1584000000 ---p 00000000 00:00 0

7f1587431000-7f1589736000 r-xp 00000000 08:02 1314120 /usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18

7f1589736000-7f1589935000 ---p 02305000 08:02 1314120 /usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18

7f1589935000-7f158994d000 rw-p 02304000 08:02 1314120 /usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18

7f158994d000-7f158995c000 rw-p 00000000 00:00 0

7f158995c000-7f1589960000 rw-p 0231d000 08:02 1314120 /usr/local/lib/python3.5/dist-packages/torch/lib/libcusparse-652fe42d.so.7.5.18

7f1589960000-7f158b6ed000 r-xp 00000000 08:02 1314115 /usr/local/lib/python3.5/dist-packages/torch/lib/libcurand-5c46e900.so.7.5.18

7f158b6ed000-7f158b8ed000 ---p 01d8d000 08:02 1314115 /usr/local/lib/python3.5/dist-packages/torch/lib/libcurand-5c46e900.so.7.5.18

7f158b8ed000-7f158ccbe000 rw-p 01d8d000 08:02 1314115 /usr/local/lib/python3.5/dist-packages/torch/lib/libcurand-5c46e900.so.7.5.18

7f158ccbe000-7f158d1c8000 rw-p 00000000 00:00 0

7f158d1c8000-7f158d1c9000 rw-p 0315f000 08:02 1314115 /usr/local/lib/python3.5/dist-packages/torch/lib/libcurand-5c46e900.so.7.5.18

7f158d1c9000-7f158e892000 r-xp 00000000 08:02 1314125 /usr/local/lib/python3.5/dist-packages/torch/lib/libcublas-74156a04.so.7.5.18

7f158e892000-7f158ea91000 ---p 016c9000 08:02 1314125 /usr/local/lib/python3.5/dist-packages/torch/lib/libcublas-74156a04.so.7.5.18

7f158ea91000-7f158ea9d000 rw-p 016c8000 08:02 1314125 /usr/local/lib/python3.5/dist-packages/torch/lib/libcublas-74156a04.so.7.5.18

7f158ea9d000-7f158eaa8000 rw-p 00000000 00:00 0

7f158eaa8000-7f158eaab000 rw-p 016d5000 08:02 1314125 /usr/local/lib/python3.5/dist-packages/torch/lib/libcublas-74156a04.so.7.5.18

7f158eaab000-7f158eac0000 r-xp 00000000 08:02 1314123 /usr/local/lib/python3.5/dist-packages/torch/lib/libgomp-ae56ecdc.so.1.0.0

7f158eac0000-7f158ecbf000 ---p 00015000 08:02 1314123 /usr/local/lib/python3.5/dist-packages/torch/lib/libgomp-ae56ecdc.so.1.0.0

7f158ecbf000-7f158ecc2000 rw-p 00014000 08:02 1314123 /usr/local/lib/python3.5/dist-packages/torch/lib/libgomp-ae56ecdc.so.1.0.0

7f158ecc2000-7f15915ae000 r-xp 00000000 08:02 1314122 /usr/local/lib/python3.5/dist-packages/torch/lib/libnccl.so.1

7f15915ae000-7f15917ae000 ---p 028ec000 08:02 1314122 /usr/local/lib/python3.5/dist-packages/torch/lib/libnccl.so.1

7f15917ae000-7f15917af000 rw-p 028ec000 08:02 1314122 /usr/local/lib/python3.5/dist-packages/torch/lib/libnccl.so.1

7f15917af000-7f15917b1000 rw-p 028f8000 08:02 1314122 /usr/local/lib/python3.5/dist-packages/torch/lib/libnccl.so.1

7f15917b1000-7f159456b000 r-xp 00000000 08:02 1314114 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCUNN.so.1

7f159456b000-7f159476b000 ---p 02dba000 08:02 1314114 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCUNN.so.1

7f159476b000-7f159477a000 rw-p 02dba000 08:02 1314114 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCUNN.so.1

7f159477a000-7f159479a000 rw-p 00000000 00:00 0

7f159479a000-7f1594a65000 rw-p 03078000 08:02 1314114 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCUNN.so.1

7f1594a65000-7f1594bc4000 r-xp 00000000 08:02 1314110 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCS.so.1

7f1594bc4000-7f1594dc4000 ---p 0015f000 08:02 1314110 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCS.so.1

7f1594dc4000-7f1594dc6000 rw-p 0015f000 08:02 1314110 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCS.so.1

7f1594dc6000-7f1594dc7000 rw-p 00000000 00:00 0

7f1594dc7000-7f1594e13000 rw-p 0018d000 08:02 1314110 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHCS.so.1

7f1594e13000-7f159f454000 r-xp 00000000 08:02 1314127 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHC.so.1

7f159f454000-7f159f654000 ---p 0a641000 08:02 1314127 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHC.so.1

7f159f654000-7f159f6af000 rw-p 0a641000 08:02 1314127 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHC.so.1

7f159f6af000-7f159f717000 rw-p 00000000 00:00 0

7f159f717000-7f15a10c7000 rw-p 0b2c7000 08:02 1314127 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHC.so.1

7f15a10c7000-7f15a1313000 r-xp 00000000 08:02 1314118 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHD.so.1

7f15a1313000-7f15a1513000 ---p 0024c000 08:02 1314118 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHD.so.1

7f15a1513000-7f15a151d000 rw-p 0024c000 08:02 1314118 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHD.so.1

7f15a151d000-7f15a155e000 rw-p 002bf000 08:02 1314118 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHD.so.1

7f15a155e000-7f15a1aab000 r-xp 00000000 08:02 1314119 /usr/local/lib/python3.5/dist-packages/torch/lib/libATen.so.1

7f15a1aab000-7f15a1cab000 ---p 0054d000 08:02 1314119 /usr/local/lib/python3.5/dist-packages/torch/lib/libATen.so.1

7f15a1cab000-7f15a1ce9000 rw-p 0054d000 08:02 1314119 /usr/local/lib/python3.5/dist-packages/torch/lib/libATen.so.1

7f15a1ce9000-7f15a1e12000 rw-p 00681000 08:02 1314119 /usr/local/lib/python3.5/dist-packages/torch/lib/libATen.so.1

7f15a1e12000-7f15a1f29000 r-xp 00000000 08:02 1314121 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHNN.so.1

7f15a1f29000-7f15a2129000 ---p 00117000 08:02 1314121 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHNN.so.1

7f15a2129000-7f15a212a000 rw-p 00117000 08:02 1314121 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHNN.so.1

7f15a212a000-7f15a2136000 rw-p 00127000 08:02 1314121 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHNN.so.1

7f15a2136000-7f15a2398000 r-xp 00000000 08:02 1314116 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHPP.so.1

7f15a2398000-7f15a2598000 ---p 00262000 08:02 1314116 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHPP.so.1

7f15a2598000-7f15a25ac000 rw-p 00262000 08:02 1314116 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHPP.so.1

7f15a25ac000-7f15a265c000 rw-p 00306000 08:02 1314116 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHPP.so.1

7f15a265c000-7f15a268a000 r-xp 00000000 08:02 1314108 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHS.so.1

7f15a268a000-7f15a288a000 ---p 0002e000 08:02 1314108 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHS.so.1

7f15a288a000-7f15a288b000 rw-p 0002e000 08:02 1314108 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHS.so.1

7f15a288b000-7f15a288f000 rw-p 00037000 08:02 1314108 /usr/local/lib/python3.5/dist-packages/torch/lib/libTHS.so.1

7f15a288f000-7f15a4c8d000 r-xp 00000000 08:02 1314126 /usr/local/lib/python3.5/dist-packages/torch/lib/libTH.so.1

7f15a4c8d000-7f15a4e8d000 ---p 023fe000 08:02 1314126 /usr/local/lib/python3.5/dist-packages/torch/lib/libTH.so.1

7f15a4e8d000-7f15a4eb4000 rw-p 023fe000 08:02 1314126 /usr/local/lib/python3.5/dist-packages/torch/lib/libTH.so.1

7f15a4eb4000-7f15a4efc000 rw-p 00000000 00:00 0

7f15a4efc000-7f15a4f2b000 rw-p 02504000 08:02 1314126 /usr/local/lib/python3.5/dist-packages/torch/lib/libTH.so.1

7f15a4f2b000-7f15aa3f5000 r-xp 00000000 08:02 1314107 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudnn-9c0f9a11.so.6.0.21

7f15aa3f5000-7f15aa5f4000 ---p 054ca000 08:02 1314107 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudnn-9c0f9a11.so.6.0.21

7f15aa5f4000-7f15aa611000 rw-p 054c9000 08:02 1314107 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudnn-9c0f9a11.so.6.0.21

7f15aa611000-7f15aa643000 rw-p 00000000 00:00 0

7f15aa643000-7f15aa645000 rw-p 054e7000 08:02 1314107 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudnn-9c0f9a11.so.6.0.21

7f15aa645000-7f15aa64e000 r-xp 00000000 08:02 1314113 /usr/local/lib/python3.5/dist-packages/torch/lib/libnvToolsExt-b81aded0.so.1.0.0

7f15aa64e000-7f15aa84d000 ---p 00009000 08:02 1314113 /usr/local/lib/python3.5/dist-packages/torch/lib/libnvToolsExt-b81aded0.so.1.0.0

7f15aa84d000-7f15aa84e000 rw-p 00008000 08:02 1314113 /usr/local/lib/python3.5/dist-packages/torch/lib/libnvToolsExt-b81aded0.so.1.0.0

7f15aa84e000-7f15aa84f000 rw-p 0000a000 08:02 1314113 /usr/local/lib/python3.5/dist-packages/torch/lib/libnvToolsExt-b81aded0.so.1.0.0

7f15aa84f000-7f15aa8aa000 r-xp 00000000 08:02 1314111 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudart-e0aa9238.so.7.5.18

7f15aa8aa000-7f15aaaa9000 ---p 0005b000 08:02 1314111 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudart-e0aa9238.so.7.5.18

7f15aaaa9000-7f15aaaaf000 rw-p 0005a000 08:02 1314111 /usr/local/lib/python3.5/dist-packages/torch/lib/libcudart-e0aa9238.so.7.5.18

7f15aaaaf000-7f15aab71000 r-xp 00000000 08:02 1314109 /usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so

7f15aab71000-7f15aad71000 ---p 000c2000 08:02 1314109 /usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so

7f15aad71000-7f15aad79000 rw-p 000c2000 08:02 1314109 /usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so

7f15aad79000-7f15aad8d000 rw-p 00000000 00:00 0

7f15aad8d000-7f15aadad000 rw-p 000fe000 08:02 1314109 /usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so

7f15aadad000-7f15abe38000 r-xp 00000000 08:02 1050863 /usr/local/lib/python3.5/dist-packages/torch/_C.cpython-35m-x86_64-linux-gnu.so

7f15abe38000-7f15ac038000 ---p 0108b000 08:02 1050863 /usr/local/lib/python3.5/dist-packages/torch/_C.cpython-35m-x86_64-linux-gnu.so

7f15ac038000-7f15ac082000 rw-p 0108b000 08:02 1050863 /usr/local/lib/python3.5/dist-packages/torch/_C.cpython-35m-x86_64-linux-gnu.so

7f15ac082000-7f15ac085000 rw-p 00000000 00:00 0

7f15ac085000-7f15ac370000 rw-p 067ab000 08:02 1050863 /usr/local/lib/python3.5/dist-packages/torch/_C.cpython-35m-x86_64-linux-gnu.so

7f15ac370000-7f15ac430000 rw-p 00000000 00:00 0

7f15ac430000-7f15ac4e9000 r-xp 00000000 08:02 3932516 /home/pierre/.local/lib/python3.5/site-packages/numpy/random/mtrand.cpython-35m-x86_64-linux-gnu.so

7f15ac4e9000-7f15ac6e9000 ---p 000b9000 08:02 3932516 /home/pierre/.local/lib/python3.5/site-packages/numpy/random/mtrand.cpython-35m-x86_64-linux-gnu.so

7f15ac6e9000-7f15ac70e000 rw-p 000b9000 08:02 3932516 /home/pierre/.local/lib/python3.5/site-packages/numpy/random/mtrand.cpython-35m-x86_64-linux-gnu.so

7f15ac70e000-7f15ac750000 rw-p 00000000 00:00 0

7f15ac750000-7f15ac759000 r-xp 00000000 08:02 3932567 /home/pierre/.local/lib/python3.5/site-packages/numpy/fft/fftpack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ac759000-7f15ac958000 ---p 00009000 08:02 3932567 /home/pierre/.local/lib/python3.5/site-packages/numpy/fft/fftpack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ac958000-7f15ac959000 rw-p 00008000 08:02 3932567 /home/pierre/.local/lib/python3.5/site-packages/numpy/fft/fftpack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ac959000-7f15aca1a000 rw-p 00000000 00:00 0

7f15aca1a000-7f15aca43000 r-xp 00000000 08:02 3932454 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/_umath_linalg.cpython-35m-x86_64-linux-gnu.so

7f15aca43000-7f15acc42000 ---p 00029000 08:02 3932454 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/_umath_linalg.cpython-35m-x86_64-linux-gnu.so

7f15acc42000-7f15acc44000 rw-p 00028000 08:02 3932454 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/_umath_linalg.cpython-35m-x86_64-linux-gnu.so

7f15acc44000-7f15acc47000 rw-p 000c6000 08:02 3932454 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/_umath_linalg.cpython-35m-x86_64-linux-gnu.so

7f15acc47000-7f15acc4b000 r-xp 00000000 08:02 3932456 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so

7f15acc4b000-7f15ace4b000 ---p 00004000 08:02 3932456 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ace4b000-7f15ace4c000 rw-p 00004000 08:02 3932456 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ace4c000-7f15ace4e000 rw-p 00019000 08:02 3932456 /home/pierre/.local/lib/python3.5/site-packages/numpy/linalg/lapack_lite.cpython-35m-x86_64-linux-gnu.so

7f15ace4e000-7f15acf0e000 rw-p 00000000 00:00 0

7f15acf0e000-7f15ad127000 r-xp 00000000 08:02 13504901 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

7f15ad127000-7f15ad327000 ---p 00219000 08:02 13504901 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

7f15ad327000-7f15ad343000 r--p 00219000 08:02 13504901 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

7f15ad343000-7f15ad34f000 rw-p 00235000 08:02 13504901 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

7f15ad34f000-7f15ad352000 rw-p 00000000 00:00 0

7f15ad352000-7f15ad358000 r-xp 00000000 08:02 14159039 /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so

7f15ad358000-7f15ad557000 ---p 00006000 08:02 14159039 /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so

7f15ad557000-7f15ad558000 r--p 00005000 08:02 14159039 /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so

7f15ad558000-7f15ad559000 rw-p 00006000 08:02 14159039 /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so

7f15ad559000-7f15ad57d000 r-xp 00000000 08:02 13505049 /lib/x86_64-linux-gnu/liblzma.so.5.2.2

7f15ad57d000-7f15ad77d000 ---p 00024000 08:02 13505049 /lib/x86_64-linux-gnu/liblzma.so.5.2.2

7f15ad77d000-7f15ad77e000 r--p 00024000 08:02 13505049 /lib/x86_64-linux-gnu/liblzma.so.5.2.2

7f15ad77e000-7f15ad77f000 rw-p 00025000 08:02 13505049 /lib/x86_64-linux-gnu/liblzma.so.5.2.2

7f15ad77f000-7f15ad786000 r-xp 00000000 08:02 14159042 /usr/lib/python3.5/lib-dynload/_lzma.cpython-35m-x86_64-linux-gnu.so

7f15ad786000-7f15ad985000 ---p 00007000 08:02 14159042 /usr/lib/python3.5/lib-dynload/_lzma.cpython-35m-x86_64-linux-gnu.so

7f15ad985000-7f15ad986000 r--p 00006000 08:02 14159042 /usr/lib/python3.5/lib-dynload/_lzma.cpython-35m-x86_64-linux-gnu.so

7f15ad986000-7f15ad988000 rw-p 00007000 08:02 14159042 /usr/lib/python3.5/lib-dynload/_lzma.cpython-35m-x86_64-linux-gnu.so

7f15ad988000-7f15ad997000 r-xp 00000000 08:02 13504983 /lib/x86_64-linux-gnu/libbz2.so.1.0.4

7f15ad997000-7f15adb96000 ---p 0000f000 08:02 13504983 /lib/x86_64-linux-gnu/libbz2.so.1.0.4

7f15adb96000-7f15adb97000 r--p 0000e000 08:02 13504983 /lib/x86_64-linux-gnu/libbz2.so.1.0.4Abandon (core dumped)

However importing cv2 after torch don't cause any bug.

Issue 2:
see the commit comment: 1d9b10d#commitcomment-23678756

To reproduce install ros-kinetic-tf 1.11.8-0xenial-20170613-200340-0800 package

from the deb http://packages.ros.org/ros/ubuntu xenial main repository.

my system is:

lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 16.04.1 LTS

Release: 16.04

Codename: xenial

cuda version is 8.0