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 | python3 -m venv --copies knktc-env |
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 | import numpy |
That takes care of numpy.
Install pandas
For pandas, the remaining workable route was to build from source.
Install the dependencies first:
1 | pip install setuptools --upgrade -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 | cd pandas-1.1.5/ |
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 | import pandas |
At that point, pandas was working.