Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Problem loading python package when building from sources with CUDA-9.1 #9340

Closed
dangulod opened this issue Jan 7, 2018 · 4 comments
Closed

Comments

@dangulod
Copy link

dangulod commented Jan 7, 2018

Description

I have built mxnet 1.0 from sources with CUDA-9.1. However, I can not load the python package, unlike in the R library I can load without problems

Environment info (Required)

----------Python Info----------
Version : 3.6.3
Compiler : GCC 7.2.0
Build : ('default', 'Oct 3 2017 21:45:48')
Arch : ('64bit', 'ELF')
------------Pip Info-----------
Version : 9.0.1
Directory : /usr/local/lib/python3.6/dist-packages/pip
----------MXNet Info-----------
Traceback (most recent call last):
File "diagnose.py", line 103, in check_mxnet
import mxnet
File "/usr/local/lib/python3.6/dist-packages/mxnet/init.py", line 25, in
from . import engine
File "/usr/local/lib/python3.6/dist-packages/mxnet/engine.py", line 23, in
from .base import _LIB, check_call
File "/usr/local/lib/python3.6/dist-packages/mxnet/base.py", line 111, in
_LIB = _load_lib()
File "/usr/local/lib/python3.6/dist-packages/mxnet/base.py", line 103, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "/usr/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/cuda/lib64/libcufft.so.9.0: version `libcufft.so.9.0' not found (required by /usr/local/lib/python3.6/dist-packages/mxnet/libmxnet.so)

----------System Info----------
Platform : Linux-4.13.0-21-generic-x86_64-with-Ubuntu-17.10-artful
system : Linux
node : *****
release : 4.13.0-21-generic
version : #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017
----------Hardware Info----------
machine : x86_64
processor : x86_64
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 2600.000
CPU max MHz: 3500,0000
CPU min MHz: 800,0000
BogoMIPS: 5184.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0194 sec, LOAD: 1.9861 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0381 sec, LOAD: 0.0573 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.1794 sec, LOAD: 0.8667 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0452 sec, LOAD: 0.8052 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0045 sec, LOAD: 0.0388 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0448 sec, LOAD: 0.1794 sec.

Package used (Python/R/Scala/Julia):
I'm using Python

For R user, please provide R sessionInfo():

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mxnet_1.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.14       pillar_1.0.1       compiler_3.4.3     RColorBrewer_1.1-2
 [5] influenceR_0.1.0   plyr_1.8.4         bindr_0.1          viridis_0.4.0     
 [9] tools_3.4.3        digest_0.6.13      jsonlite_1.5       viridisLite_0.2.0 
[13] tibble_1.4.1       gtable_0.2.0       rgexf_0.15.3       pkgconfig_2.0.1   
[17] rlang_0.1.6        igraph_1.1.2       rstudioapi_0.7     bindrcpp_0.2      
[21] gridExtra_2.3      downloader_0.4     DiagrammeR_0.9.2   dplyr_0.7.4       
[25] stringr_1.2.0      htmlwidgets_0.9    hms_0.4.0          grid_3.4.3        
[29] glue_1.2.0         R6_2.2.2           Rook_1.1-1         XML_3.98-1.9      
[33] readr_1.1.1        purrr_0.2.4        tidyr_0.7.2        ggplot2_2.2.1     
[37] magrittr_1.5       codetools_0.2-15   scales_0.5.0       htmltools_0.3.6   
[41] assertthat_0.2.0   colorspace_1.3-2   brew_1.0-6         stringi_1.1.6     
[45] visNetwork_2.0.2   lazyeval_0.2.1     munsell_0.4.3   

Build info (Required if built from source)

Compiler (gcc/clang/mingw/visual studio): gcc-6

MXNet commit hash:
df9f79a

Build config:
#---------------------
# choice of compiler
#--------------------

export CC = gcc-6
export CXX = g++-6
export NVCC = nvcc

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

# whether compile with profiler
USE_PROFILER =

# whether to turn on segfault signal handler to log the stack trace
USE_SIGNAL_HANDLER =

# the additional link flags you want to add
ADD_LDFLAGS =

# the additional compile flags you want to add
ADD_CFLAGS =

#---------------------------------------------
# matrix computation libraries for CPU/GPU
#---------------------------------------------

# whether use CUDA during compile
USE_CUDA = 1

# add the path to CUDA library to link and compile flag
# if you have already add them to environment variable, leave it as NONE
# USE_CUDA_PATH = /usr/local/cuda
USE_CUDA_PATH = /usr/local/cuda

# whether use CuDNN R3 library
USE_CUDNN = 1

#whether to use NCCL library
USE_NCCL = 0
#add the path to NCCL library
USE_NCCL_PATH = NONE

# whether use opencv during compilation
# you can disable it, however, you will not able to use
# imbin iterator
USE_OPENCV = 1

#whether use libjpeg-turbo for image decode without OpenCV wrapper
USE_LIBJPEG_TURBO = 0
#add the path to libjpeg-turbo library
USE_LIBJPEG_TURBO_PATH = NONE

# use openmp for parallelization
USE_OPENMP = 1

# MKL ML Library for Intel CPU/Xeon Phi
# Please refer to MKL_README.md for details

# MKL ML Library folder, need to be root for /usr/local
# Change to User Home directory for standard user
# For USE_BLAS!=mkl only
MKLML_ROOT=/usr/local

# whether use MKL2017 library
USE_MKL2017 = 0

# whether use MKL2017 experimental feature for high performance
# Prerequisite USE_MKL2017=1
USE_MKL2017_EXPERIMENTAL = 0

# whether use NNPACK library
USE_NNPACK = 0

# choose the version of blas you want to use
# can be: mkl, blas, atlas, openblas
# in default use atlas for linux while apple for osx
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
USE_BLAS = apple
else
USE_BLAS = atlas
endif

# whether use lapack during compilation
# only effective when compiled with blas versions openblas/apple/atlas/mkl
USE_LAPACK = 1

# path to lapack library in case of a non-standard installation
USE_LAPACK_PATH =

# by default, disable lapack when using MKL
# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML)
ifeq ($(USE_BLAS), mkl)
USE_LAPACK = 0
endif

# add path to intel library, you may need it for MKL, if you did not add the path
# to environment variable
USE_INTEL_PATH = NONE

# If use MKL only for BLAS, choose static link automatically to allow python wrapper
ifeq ($(USE_MKL2017), 0)
ifeq ($(USE_BLAS), mkl)
USE_STATIC_MKL = 1
endif
else
USE_STATIC_MKL = NONE
endif

#----------------------------
# Settings for power and arm arch
#----------------------------
ARCH := $(shell uname -a)
ifneq (,$(filter $(ARCH), armv6l armv7l powerpc64le ppc64le aarch64))
	USE_SSE=0
else
	USE_SSE=1
endif

#----------------------------
# distributed computing
#----------------------------

# whether or not to enable multi-machine supporting
USE_DIST_KVSTORE = 0

# whether or not allow to read and write HDFS directly. If yes, then hadoop is
# required
USE_HDFS = 0

# path to libjvm.so. required if USE_HDFS=1
LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server

# whether or not allow to read and write AWS S3 directly. If yes, then
# libcurl4-openssl-dev is required, it can be installed on Ubuntu by
# sudo apt-get install -y libcurl4-openssl-dev
USE_S3 = 0

#----------------------------
# performance settings
#----------------------------
# Use operator tuning
USE_OPERATOR_TUNING = 1

# Use gperftools if found
USE_GPERFTOOLS = 1

# Use JEMalloc if found, and not using gperftools
USE_JEMALLOC = 1

#----------------------------
# additional operators
#----------------------------

# path to folders containing projects specific operators that you don't want to put in src/operators
EXTRA_OPERATORS =

#----------------------------
# other features
#----------------------------

# Create C++ interface package
USE_CPP_PACKAGE = 1

#----------------------------
# plugins
#----------------------------

# whether to use caffe integration. This requires installing caffe.
# You also need to add CAFFE_PATH/build/lib to your LD_LIBRARY_PATH
# CAFFE_PATH = $(HOME)/caffe
# MXNET_PLUGINS += plugin/caffe/caffe.mk

# WARPCTC_PATH = $(HOME)/warp-ctc
# MXNET_PLUGINS += plugin/warpctc/warpctc.mk

# whether to use sframe integration. This requires build sframe
# [email protected]:dato-code/SFrame.git
# SFRAME_PATH = $(HOME)/SFrame
# MXNET_PLUGINS += plugin/sframe/plugin.mk

Command to compile:
make -j8

Error Message:

OSError: /usr/local/cuda/lib64/libcufft.so.9.0: version `libcufft.so.9.0' not found (required by /usr/local/lib/python3.6/dist-packages/mxnet/libmxnet.so)

Minimum reproducible example

import mxnet as mx

Steps to reproduce

import mxnet as mx

What have you tried to solve it?

I have created several symlinks to reference 9.0 libraries to newest ones

ls -l /usr/local/cuda/lib64/libcuff*
lrwxrwxrwx 1 root root 15 dic 2 00:47 /usr/local/cuda/lib64/libcufft.so -> libcufft.so.9.1
lrwxrwxrwx 1 root root 40 ene 5 17:01 /usr/local/cuda/lib64/libcufft.so.9.0 -> /usr/local/cuda/lib64/libcufft.so.9.1.85
lrwxrwxrwx 1 root root 18 dic 2 00:47 /usr/local/cuda/lib64/libcufft.so.9.1 -> libcufft.so.9.1.85
-rw-r--r-- 1 root root 120205696 dic 2 00:44 /usr/local/cuda/lib64/libcufft.so.9.1.85
-rw-r--r-- 1 root root 124274840 dic 2 00:44 /usr/local/cuda/lib64/libcufft_static.a
lrwxrwxrwx 1 root root 16 dic 2 00:47 /usr/local/cuda/lib64/libcufftw.so -> libcufftw.so.9.1
lrwxrwxrwx 1 root root 19 ene 7 20:01 /usr/local/cuda/lib64/libcufftw.so.9.0 -> libcufftw.so.9.1.85
lrwxrwxrwx 1 root root 19 dic 2 00:47 /usr/local/cuda/lib64/libcufftw.so.9.1 -> libcufftw.so.9.1.85
-rw-r--r-- 1 root root 509072 dic 2 00:44 /usr/local/cuda/lib64/libcufftw.so.9.1.85
-rw-r--r-- 1 root root 41174 dic 2 00:45 /usr/local/cuda/lib64/libcufftw_static.a

@dangulod dangulod changed the title Problem when load python package when building from sources with CUDA-9.1 Problem loading python package when building from sources with CUDA-9.1 Jan 7, 2018
@dangulod
Copy link
Author

dangulod commented Jan 8, 2018

Well, You can close the issue, I forgot to compile the python package, now it works

@universewill
Copy link

The build from source tutorial doesn't give solution to build python package. How do you do that? @dangulod

@sxjscience
Copy link
Member

Close issue as the problem has been solved.

@dangulod
Copy link
Author

dangulod commented Jan 17, 2018

@universewill The library compilation is made through python setup.py build inside the Python folder, and the installation: python setup.py install

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants