0%

Install pandas on Kylin V10 for the SW64 Architecture

I recently did some adaptation work for domestic platforms, trying to make one of my systems run on a Sunway CPU.

Compared with ARM, the Sunway architecture is much more niche. In practice, support seems limited mainly to UOS and Kylin. The customer provided a SW64 build of Kylin V10, so this post records the issues I ran into while installing pandas in that environment.

Create a virtual environment

Kylin V10 comes with Python 3.7.4. Start by creating a venv:

1
2
python3 -m venv --copies knktc-env
source knktc-env/bin/activate

Install numpy

My first instinct was to install numpy directly with pip:

1
pip install numpy

That failed with an error like this:

error: #error Unknown CPU, please report this to numpy maintainers with information about your platform (OS, CPU and compiler)

So yes, the architecture was niche enough that numpy’s build logic did not recognize it.

After some searching, I found discussions on the UOS forums saying that building with pip did not work, and that the only practical route was using a prebuilt package from the OS vendor. Kylin indeed provides one:

1
yum search numpy

Example output:

1
python3-numpy.sw_64 : A fast multidimensional array facility for Python

So install that package first:

1
yum install python3-numpy

After installation, copy the vendor-provided numpy package from the system site-packages directory into the virtual environment manually:

1
cp -r /usr/lib/python3.7/site-packages/numpy* knktc-env/lib/python3.7/site-packages

Then check the version:

1
2
3
>>> import numpy
>>> numpy.__version__
'1.16.5'

That takes care of numpy.

Install pandas

For pandas, the remaining workable route was to build from source.

Install the dependencies first:

1
2
3
4
5
pip install setuptools --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install wheel --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install Cython --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pytz==2018.7 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install python-dateutil -i https://pypi.tuna.tsinghua.edu.cn/simple

Then download the source package from:

https://github.com/pandas-dev/pandas/releases

We were still using pandas 1.1.5, so I used:

https://github.com/pandas-dev/pandas/releases/download/v1.1.5/pandas-1.1.5.tar.gz

After extracting the source, install it the old-fashioned way:

1
2
cd pandas-1.1.5/
python setup.py install

This step takes a while, so it is a good idea to run it inside screen.

Thankfully, even though the build was slow, it finished without major errors.

Finally, verify the version:

1
2
3
>>> import pandas
>>> pandas.__version__
'1.1.5'

At that point, pandas was working.

如果我的文字帮到了您,那么可不可以请我喝罐可乐?