ParaView Python on Linux needs 4 Unicode width


(Bane Sullivan (PVGeo)) #1

Reposting an issue from the superbuild to see if anyone has some advice:

The issue

Currently, it appears the ParaView’s Python (Linux only) is built with 2 Unicode width which is incompatible with just about every Linux python distribution I have encountered. I noticed this when trying to import pandas installed via pip under the PYTHONPATH and received an error:

>>> import pandas
...
ImportError: C extension ..../pandas/_libs/tslib.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8 not built. ...

It appears to me that this could be fixed by building pvpython with 4 Unicode widths, so I am curious if there is any reason why ParaView is width 2 on Linux (Windows and Mac are width 4)?

What do I do?

I’m curious if anyone is aware of any way to address this issue. Any help would be much appreciated!


(Ben Boeckel) #2

Trying out a fix in this MR.


(Daan Van Vugt) #3

I typically build a different python with ucs2 support (though I agree UCS4 would be nicer)

# Install python2 with ucs2 https://stackoverflow.com/questions/38928942/build-python-as-ucs-4-via-pyenv
export PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2
pyenv install -v 2.7.11
pyenv local 2.7.11

# Install pip
wget https://bootstrap.pypa.io/get-pip.py && ~/.pyenv/shims/python get-pip.py

# Install the same numpy paraview uses (as of writing)
~/.pyenv/versions/2.7.11/bin/pip install --user numpy==1.8.1

(Bane Sullivan (PVGeo)) #4

Thanks, @Daan_van_Vugt, that’s a neat fix! I haven’t had any luck building PV from source against a Python env, but I think this would work if I set up the PYTHONPATH that PV sees to this environment! I’ll have to give this a try and also see if I can find a way for anaconda to do this in a similar manner.


(Bane Sullivan (PVGeo)) #5

@ben.boeckel, any further progress on the PV-superbuild and common-superbuild merge requests? Thanks for getting those up!


(Ben Boeckel) #6

Tests came back successfully. Waiting for a +1 (though I’ll probably just merge it if I don’t hear back by the end of the day).