Reference URL: http://www.cnblogs.com/empty16/p/4828476.html
Solemn statement:
When using command-line operations under Linux, be sure to know what the command line means and then execute it, or enter a command if you don't know what happens next, and Linux is likely to collapse.
Because under Linux, when you use sudo and root privileges, you can manipulate any file, even the system files that are in use.
Caffe the following problems appear in the installation process some of the steps did not follow the official website instructions, if according to the official website instructions Step-by-step installation, generally will pass at once.
Caffe compilation Problem and solution summary:
When compiling the Caffe code, the previous errors will appear, and there will be a variety of problems:
Question 1:
. build_release/lib/libcaffe.so:undefined reference Tocv::imencode (cv::string const&, Cv::_inputarray const& , std::vector >&, std::vector > const&) '
Cause: There is no build folder in the Caffe code and you need to create a new build folder before compiling:
CD caffe-master #打开caffe所在文件夹cp Makefile.config.example makefile.config #change setting in Makefile.configmake all -j8 #在build文件夹下进行编译
Make Runtest-j8 #使用CPU多核同时进行编译
Question 2:
CMake Error at cuda_compile_generated_lrn_layer.cu.o.cmake:206 (message)
After the successful installation of CUDA, the following error is resolved due to path setup issues, or path conflicts:
1. Under the Caffe folder, view the configuration path by following this command:
sudo find/-name NVCC
2. Use the following command to see if the Cuda path conflict:
$PATH
If the display results have two CUDA environment variables, you need to remove the old path and update the path.
3. Re-set the CUDA environment variable
Adding CUDA environment variables in/etc/profile
Path=/usr/local/cuda/bin: $PATH Export PATH
Then log off or restart (because path is re-read from the ~/.bash_profile file after logging off or restarting)
Problem 3:pycaffe Problems in the compilation process
Error message: Touch python/caffe/proto/__init__.py
Cxx/ld-o python/caffe/_caffe.so Python/caffe/_caffe.cpp
Protoc (python) Src/caffe/proto/caffe.proto
Python/caffe/_caffe.cpp:1:52:fatal error:python.h:no such file or directory
#include <Python.h>//Nolint (Build/include_alpha)
Compilation terminated.
Make: * * * [python/caffe/_caffe.so] Error 1
Because my Python environment installs the Spyder, not the anaconda, so the path needs to be set in the Makefile.config
# Anaconda Python distribution is quite popular. Include path:# Verify Anaconda location, sometimes it's in root.# anaconda_home: = $ (HOME)/anaconda# python_include: = $ (A Naconda_home)/include # $ (anaconda_home)/include/python2.7 # $ (anaconda_home)/lib/python2.7/ Site-packages/numpy/core/include # We need to is able to find libpythonx.x.so or. dylib. Python_lib: =/usr/lib# Python_lib: = $ (anaconda_home)/lib
Python.h
Can running sudo find / -name ‘Python.h‘ to find the path
.
Original address
Some common commands for Linux are documented and explained:
1. Program Installation
Local Installation command format
sudo dpkg-i softname.deb
Where dpkg is the abbreviation for the Debian package, dpkg commonly used commands are:-I installation;-R Uninstall
The DPKG command is a low-level installation tool, and APT is the dpkg upper-level tool for getting packages from remote and handling the relationships between complex packages.
Common usage of APT, install and uninstall software after apt-get or remove
Apt-get Install <package>
2. Set the system root password
If you use the CD-ROM to install Ubuntu, follow the Setup Wizard for account, partition and other settings, and in this installation Wizard program is not prompted to root password settings, so after the installation of Ubuntu need to manually set the root password. If you skip the Setup Wizard and click the Install icon on your desktop, you will be prompted to set the root password during the installation process. Of course, if you need to change the root password you can also use the following methods: Open terminal, enter the command in terminal:
sudo passwd root
Next, follow the prompts to set the root password of the system.
Enter a new UNIX password:
Re-enter the new UNIX password:
passwd: Password has been successfully updated
Password:
3. Deleting folders and files
In Ubuntu, some folders can not be deleted by right-clicking, this time you need to use the command to delete.
To delete a file:
CD/USR/LOCAL/SRC #打开文件所在位置sudo rm./file-name #删除文件
To delete a folder:
Cd/usr/local/srcsudo rm-r./folder-name
3. Change the file or folder name with a command
sudo mv old filename new file name
4. Using the Display kernel version
Uname A
5.Ubuntu Bulk Copy Delete File command
Bulk Copy File command
sudo cp-r/srcfolder/* /dstfolder
Bulk Delete Files Command:
sudo rm-rf/usr/share/stardict/dic/*
Some problems and solutions in the use of Ubuntu14.04:
1. Workaround when the kernel is having problems
This problem bothers me for a long time, because dpkg when the program installs the command, this command problem causes the new software to be unable to install, very annoying, looked up a lot of information, finally found the solution.
error message: dpkg: Error occurred while processing: linux-image-extra-3.19.0-28-generic
Linux-image-3.19.0-28-generic
Workaround: The original address (point me) directly 12 floor
Workaround: Back up the information in the DPKG package and update the kernel with the new info information copied to the folder
sudo mv/var/lib/dpkg/info/var/lib/dpkg/info_old //The Info folder is now renamed sudo mkdir/var/lib/dpkg/info //New A new Info folder sudo apt-get update//update source sudo apt-get-f install sudo mv/var/lib/dpkg/ info/*/var/lib/dpkg/info_old //move all files in info to Info_old folder sudo rm-rf/var/lib/dpkg/info//Add yourself to the new info file Clip Remove sudo mv/var/lib/dpkg/info_old/var/lib/dpkg/info//Change the previous Info folder back to the name
The above command resolves the kernel removal failure and updates the issue.
2.ubuntu14.04 unable to identify hard disk EXFAT partition
Why use the exFAT format? There are two main reasons for this:
1. The three major major operating systems (Linux, MAC, Windows) support the EXFAT format.
2. exFAT supports files larger than 4G.
Under Ubuntu, due to copyright reasons (said), the default does not support the EXFAT format of the U disk, but it is convenient to add support for exFAT:
1, for Ubuntu 14.04 version, directly run the following command can be:
sudo apt-get install exfat-utils
The restart takes effect after the installation is complete. (Restart if not restarted)
3. Set Python path method
Export Pythonpath=/home/username/caffe/python
View Path
Echo $PYTHONPATH
4.Ubuntu cannot write files to exFAT and NTFS-formatted disks
Problem Description: The disk for the XX was not a ready yet or not present
ACPI PCC probe failed
How to resolve:
sudo su #获取root权限mount-o remount,rw/dpkg--configure-a
5.caffe Python Interface configuration issues
After using the make PYCAFFE-J8 command to complete the Caffe Python interface generation, you will also need to set the path of the Python interface.
Path settings generally have two ways (specific method Baidu), for ease of use, here is set as a permanent path.
Using commands
Gedit ~/.BASHRC
To set the path, add the path to the last line of the file:
Export pythonpath=/home/startag/caffe/python/:/home/startag/caffe/python/caffe/
Log off or restart, the path takes effect.
Error message when import Caffe
1. Error message: Importerror:no module named Skimage.io
Workaround:
Use Terminal installation directly:
Pip Install-u scikit-image
If the prompt does not recognize the PIP command, under Ubuntu14.04 (64bit), use the following command to install the PIP package management software, or you can search for the "scikit-image" installation using the new Rieter package.
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificatesudo python get-pip.py
Problem:
Importerror:no module named Google.protobuf.internal
Hint error can be used to search for "python-protobuf" installation using the new Rieter package.
Then use import Caffe to test whether the interface was successfully debugged.
Problem:
From google.protobuf import symbol_database as _symbol_databaseimporterror:cannot import name Symbol_database
Workaround:
sudo pip install--upgrade protobuf
6. Caffe Python interface and MATLAB interface Configuration and FAQ Summary:
After we have configured the Caffe environment, we need to use the interfaces in the Caffe. The Caffe interface is divided into 3 types, CMD interface, MATLAB interface and Python interface.
The CMD interface has been generated during the use of make All-j8 and is located in tools. The Matlab interface, especially the Python interface needs to be configured, you will encounter a variety of problems.
When compiling Caffe's MATLAB and Python interfaces, you may encounter a g++ version problem, Workaround: Caffe use: Install gcc4.7 and g++4.7.
After making Pycaffe, you need to use make dist to organize the generated Python files and set the Caffe path.
To add a path to the ~/.BASHRC file: (Problem: ImportError: libcaffe.so: cannot open shared object file: No such file or directory
workaround)
#多个路径使用: Split Open
Export Ld_library_path=/opt/intel/mkl/lib/intel64:/usr/local/cuda/lib64:/home/startag/caffe/distribute/lib Export Ld_preload=/usr/lib/x86_64-linux-gnu/libstdc++.so.6export pythonpath=/home/startag/caffe/distribute/ Python: $PYTHONPATH
Python interface Configuration According to Caffe official website interface steps, in ~/.BASHRC file written Pythonpath path, see the official website.
Solution to the problem encountered: Method 1
* * Recommendation: When using Caffe, determine a version and then write the path to the ~/.BASHRC file. Of course, you can use more than one version, but you need to add each version of the path to the ~/.BASHRC file, it is more troublesome, if you need to use Caffe, use the soft connection method to establish a soft connection with Caffe.
Method:
Ln-s Caffe-root Destination Folder
Tips for building fast-rcnn:opencv-cannot Find module Cv2
Workaround
&. To draw the network structure method using draw_net.py:
Error message when you use draw_net.py to draw the network structure:
Workaround: Leave the file with system permissions
chmod u+x./python/draw_net.py
The following error indicates that the system has been severely damaged and is not guaranteed to be fully repaired
1. When the Cuda-driver package is damaged, the solution will be removed after the Cuda is uninstalled:
Install using aptitude (this test is not good, so the installation may be unofficial driver)
Install Aptitude
sudo apt-get install aptitude
Install Main Package
sudo aptitude install Cuda
2. Caffe installation build-essential
Prompt Package corruption resolution method
sudo apt-get updatesudo apt-get upgradesudo apt-get Install Build-essential-f
When an error occurs due to a problem with the installation version, if you should install cuda7.0 on the Ubuntu14.04, but the error is installed on the Ubuntu15.04 (should install the corresponding 7.5), when prompted by the error:
Dpkg:error Processing archive (--install): cuda-repo-ubuntu1504_7.5-18_amd64.debtrying to overwrite '/etc/apt/ Sources.list.d/cuda.list ', which is also in the package Cuda-repo-ubuntu1404_7.0-18_amd64.deb
Solution:
sudo dpkg-i--force-overwrite cuda-repo-ubuntu1504_7.5-18_amd64.deb
When you encounter this problem:
Importerror:/usr/lib/liblapack.so.3:undefined SYMBOL:ATL_CHEMV
Workaround:
Http://stackoverflow.com/questions/8917977/installing-lapack-for-numpy
Go Caffe build: Frequently asked questions solutions and problems with Ubuntu (continuous update)