Some problems encountered during the installation of Python Caffe and corresponding solutions

Source: Internet
Author: User

About the system environment:

    • Ubuntu 16.04 LTS
    • Cuda 8.0
    • CUDNN 6.5
    • Anaconda3

Configuration file required before compiling Pycaffe Makefile.config

1# # Refer to http://caffe.berkeleyvision.org/installation.html2# Contributions simplifying and improving our build system is welcome!3 4 # CuDNN Acceleration switch (uncomment to build with CuDNN).5USE_CUDNN: =16 7# cpu-Only switch (uncomment to build without GPU support).8# cpu_only: =19 Ten # Uncomment to disable IO dependencies and corresponding data layers One# Use_opencv: =0 A# Use_leveldb: =0 -# Use_lmdb: =0 -  the# Uncomment to allow Mdb_nolock when reading LMDB files (onlyifnecessary) -# You should not set this flagifYou'll be reading Lmdbs with any -# Possibility of simultaneous read andWrite -# Allow_lmdb_nolock: =1 +  -# UncommentifYou're using OpenCV 3 +# opencv_version: =3 A  at # To customize your choice of compiler, uncomment and set the following. -# n.b. The default forLinux is g++ and the default forOSX is clang++ -# Custom_cxx: = g++ -  -# CUDA directory contains Bin/and lib/directories that we need. -Cuda_dir: =/usr/local/Cuda in# on Ubuntu14.04,ifCuda Tools is installed via -#"sudo apt-get install Nvidia-cuda-toolkit"  ThenUse this instead: to# Cuda_dir: =/usr +  - # CUDA Architecture setting:going with all of them. the# for CUDA <6.0, comment The *_50 through *_61 lines forcompatibility. *# for CUDA <8.0, comment The *_60 and *_61 lines forcompatibility. $Cuda_arch: =-gencode arch=compute_20,code=sm_20Panax Notoginseng-gencode arch=compute_20,code=sm_21 --gencode arch=compute_30,code=sm_30 the-gencode arch=compute_35,code=sm_35 +-gencode arch=compute_50,code=sm_50 A-gencode arch=compute_52,code=sm_52 the-gencode arch=compute_60,code=sm_60 +-gencode arch=compute_61,code=sm_61 --gencode arch=compute_61,code=compute_61 $  $ # BLAS Choice: -# Atlas forATLAS (default) -# MKL forMKL the# Open forOpenblas -BLAS: =AtlasWuyi# Custom (mkl/atlas/Openblas) include and Lib directories. the# Leave commented to accept the defaults foryour choice of BLAS -# (whichshould work)! Wu# Blas_include: =/path/to/your/Blas -# Blas_lib: =/path/to/your/Blas About  $# Homebrew puts Openblasincha directory that's not on the standard search path -# Blas_include: = $ (Shell brew--prefix openblas)/include -# Blas_lib: = $ (Shell brew--prefix openblas)/Lib -  A# Required onlyifYou'll compile the Matlab interface. +# MATLAB directory should contain the MEX binaryinch/bin. the# Matlab_dir: =/usr/Local -# Matlab_dir: =/applications/Matlab_r2012b.app $  the# Note:this isRequiredOnlyifYou'll compile the Python interface. the# We need to being able toFindPython.h and numpy/arrayobject.h. the# Python_include: =/usr/include/python2.7  the#/usr/lib/python2.7/dist-packages/numpy/core/include - # Anaconda Python distribution is quite popular. Include Path: in# Verify Anaconda location, sometimes it's in root. theAnaconda_home: =/home/ipc/Anaconda3 the# Python_include: = $ (anaconda_home)/include About# $ (anaconda_home)/include/python3.6m the# $ (anaconda_home)/lib/python3.6/site-packages/numpy/core/include the # key point 1: Set the path of anaconda according to your own situation
the# Uncomment to use Python3(Default is Python2) +Python_libraries: =Boost_python3 python3.6m -Python_include: = $ (anaconda_home)/include $ (anaconda_home)/include/python3.6m $ (anaconda_home)/lib/python3.6/site-packages/numpy/core/include the # key point 2: Note that the version number, the original file is 3.5, but my anaconda is 3.6, so if the direct uncomment, there will be problems, you need to set up according to their own situation
Bayi# We need to being able toFindlibpythonx.x.so or. dylib. the# Python_lib: =/usr/Lib thePython_lib: = $ (anaconda_home)/Lib - -# Homebrew Installs NumPyincha non standard path (keg only) the# Python_include + = $ (dir$ (Shell python-c'import numpy.core; print (numpy.core.__file__)'))/include the# Python_lib + = $ (Shell brew--prefix numpy)/Lib the the# Uncomment to support layers writteninchpython (would link against Python libs) -With_python_layer: =1 the the# WhateverElseYouFindYou need goes. theInclude_dirs: = $ (python_include)/usr/local/include/usr/lib/x86_64-linux-gnu/hdf5/serial/include/usr/local/cuda/include94Library_dirs: = $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/hdf5/serial/usr/local/cuda/lib64 the the# If Homebrew is installed at a non ( forExample your home directory) and use it forGeneral Dependencies the# Include_dirs + = $ (Shell brew--prefix)/include98# Library_dirs + = $ (Shell brew--prefix)/Lib About - # NCCL Acceleration switch (uncomment to build with NCCL)101# https://GITHUB.COM/NVIDIA/NCCL (last tested version:v1.2.3-1+cuda8.0)102# USE_NCCL: =1103 104# Uncomment to use 'Pkg-config' to specify OpenCV library paths. the# (usually not necessary--OpenCV libraries is normally installedinchOne of the above $LIBRARY _dirs.)106# Use_pkg_config: =1107 108# n.b. Both build and distribute dirs is cleared on ' MakeClean '109Build_dir: =Build theDistribute_dir: =Distribute111 the# Uncomment forDebugging. Does not work on OS X due to https://github.com/bvlc/caffe/issues/171113# DEBUG: =1 the the# The ID of the GPU that'Make runtest'Would use the to Run unit tests. theTest_gpuid: =0117 118 # Enable pretty build (comment to see full commands)119Q? = @

    1. Configure file Makefile.config (path problem) as above
      • Avoid problems with Python.h and numpy/arrayobject.h files that cannot be found
    2. Cannot find-lboost_python3 issues (version issue) (refer to http://blog.csdn.net/u012675539/article/details/51351553)
      • Check to see if a file exists:ls /usr/lib/x86_64-linux-gnu/libboost_python-py35.so
      • To create a soft link:sudo ln -s libboost_python-py35.so libboost_python3.so
    3. Libstdc++.so.6:version ' glibcxx_3.4.20 ' not found issues (version issue)
      • Conda Install LIBGCC
    4. No module named ' Google ' issues (version issue)
      • Conda Install Protobuf

These are the pits that have been trampled during the installation of Pycaffe!

Some of the problems encountered during the installation of Python Caffe and the corresponding solution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.