Python compilation and installation parameters
./configure --prefix=/usr/local/python3 --enable-loadable-sqlite-extensions \ --enable-optimizations \ --enable-option-checking=fatal \ --enable-shared \ --with-system-expat
In Python's ./configure script
Commonly used –enable parameters and their meanings
as follows:
- –enable-ipv6: Enable IPv6 support.
- –enable-unicode=ucs4: Enable Unicode support for UCS-4 encoding.
- –enable-shared: Enable the build of shared libraries.
- –enable-optimizations: Enable optimizations, do some optimizations to Python to improve performance.
- –enable-openssl: Enable OpenSSL support.
- –enable-threads: Enable multithreading support.
- –enable-ssl-default-suites: Enable the default SSL cipher suite.
These parameters can be configured according to your needs to build Python based on specific functional or performance requirements.
In Python's ./configure script
Commonly used – with parameters and their meanings
as follows:
- –with-threads: Specifies the type of thread library, such as –with-threads=pthread.
- –with-dbmliborder: Specifies the priority order of database access to the library, for example –with-dbmliborder=gdbm:ndbm.
- –with-computed-gotos: Enable computed goto optimization.
- –with-ensurepip: Specify the installation method of the ensurepip module, such as –with-ensurepip=upgrade.
- –with-system-expat: Use the system-installed expat library.
- --with-openssl: Specifies the path to the OpenSSL library, for example --with-openssl=/usr/local/ssl.
These parameters can be configured according to your needs to build Python based on specific functional or performance requirements.
MXNet compile and install under python encountered problems
First, let me talk about why I compile and install it
Illegal instruction (core dumped) installation via pip install mxnet
After searching, it turned out that it was because the server CPU instruction set SSE does not support it. The encoding set supported by mxnet pip installation is AVX.
View command:
cat /proc/cpuinfo
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology pni cx16 x2apic hypervisor lahf_lm kaiser
Finally, I made up my mind to compile and install.
Since the compilation and installation were not as smooth as I thought, I summarized the problems I encountered to help students who encountered such problems like me.
Summary of problems encountered when compiling and installing mxnet 1.5.1
【Problem Description】
/bin/sh: 1: cmake: not found
:48: recipe for target '/home/***/mxnet/3rdparty/mkldnn/build/install/lib/' failed
make: *** [/home/***/mxnet/3rdparty/mkldnn/build/install/lib/] Error 127
make: *** Waiting for unfinished jobs....
make[1]: Entering directory '/home/***/mxnet/3rdparty/dmlc-core'
make[1]: '' is up to date.
make[1]: Leaving directory '/home/***/mxnet/3rdparty/dmlc-core'
I found that cmake was not installed.
sudo apt-get install cmake
【Problem Description】
/build/install/lib/ /home/***/mxnet/3rdparty/dmlc-core/ /home/***/mxnet/3rdparty/tvm/nnvm/lib/ -pthread -ldl -lm -lcblas -fopenmp -lrt -lopencv_highgui -lopencv_imgproc -lopencv_core -llapack
a - build/src/executor/eliminate_common_expr_pass.o
a - build/src/executor/graph_executor.o
a - build/src/executor/infer_graph_attr_pass.o
a - build/src/executor/attach_op_execs_pass.o
a - build/src/executor/attach_op_resource_pass.o
a - build/src/kvstore/gradient_compression.o
a - build/src/kvstore/kvstore_utils.o
a - build/src/kvstore/
a - build/src/
a - build/src/
a - build/src/
a - build/src/
/tmp/: In function `main':
:(.+0x2994): undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
collect2: error: ld returned 1 exit status
Makefile:643: recipe for target 'bin/im2rec' failed
make: *** [bin/im2rec] Error 1
After inspection, it was found:
The imencode method in tool/ passes four parameters, while the imencode interface in libopencv-dev passes five parameters, and then checked that the versions of g++ and gcc are 4.9, so I upgraded the version to 5 and it was successfully compiled.
【Problem Description】
creating 'dist/mxnet-1.5.1-py2.' and adding 'build/-x86_64/egg' to it
removing 'build/-x86_64/egg' (and everything under it)
Processing mxnet-1.5.1-py2.
creating /usr/local/lib/pythonpy2.7/dist-packages/mxnet-1.6.0-pypy2.
Extracting mxnet-1.5.1-pypy2. to /usr/local/lib/pythonpy2.7/dist-packages
Adding mxnet 1.5.1 to file
I found that the installed mxnet is a version of python2.7, how can this work?
So I thought it must be compiled by python that comes with the operating system. Anyway, other environments have been compiled, but when python install, the version of python is wrong. So, cut the environment to python3.6.4, find mxnet/python/ to execute
python install
The formal compilation has been passed, and it can be considered as a perfect compilation and installation of mxnet.
There is also how to configure the installation parameters of mxnet-mkl and mxnet-cuXX version. We need to study and study again. Time is limited. I will share my installation experience next time I have time.
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.