Python issues using numpy and h5py

Hello to the list,
we just bought Trelis and have some issues with Python:

I want to use numpy and h5py (Linux)

According to sys.version Trelis comes with Python 2.7.3.
I tried to link numpy and h5py from my /usr/lib64/python2.7/site-packages to

import numpy

Fails with an multiarray issue which seems to be caused by incompatible versions.
My local python2 is Python 2.7.13

I asked someone who is using Trelis with numpy and h5py about his numpy installation.
When I copy it to

I get

[code]import numpy

from . import multiarray
ImportError: /opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/core/ undefined symbol: _PyUnicodeUCS4_IsWhitespace
The same error occured on another Linux system (Ubuntu, I use openSUSE)

What can I do?

I see the following options:

  • make Trelis to use my System Python 2.7
  • compile Python 2.7.3 manually and then build numpy manually. However this failed in the first attempt. And when I build Paraview 5.3 with Python I also have this Unicode issue.

So I prefer using System Python.

Thanks a lot,


Another idea could be to install numpy based on the python provided by Trelis. But I don’t know how to do this …

I put more work on the issue. I could life without h5py by adapting a python mesh exporter we already have, however it would be very annoying to have to life without numpy.

Numpy is build via python, so I assume I have to build numpy with a python 2.7.3 interpreter.

I really could not find a python interpreter binary in the Trelis distribution (Linux rpm) I could use manually.

I failed to build python 2.7.3 locally. build and install works but when I execute the binary I get
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Traceback (most recent call last):
File “/home/fwein/tmp/lib/python2.7/”, line 563, in
File “/home/fwein/tmp/lib/python2.7/”, line 545, in main
known_paths = addusersitepackages(known_paths)
File “/home/fwein/tmp/lib/python2.7/”, line 278, in addusersitepackages
user_site = getusersitepackages()
File “/home/fwein/tmp/lib/python2.7/”, line 253, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File “/home/fwein/tmp/lib/python2.7/”, line 243, in getuserbase
USER_BASE = get_config_var(‘userbase’)
File “/home/fwein/tmp/lib/python2.7/”, line 521, in get_config_var
return get_config_vars().get(name)
File “/home/fwein/tmp/lib/python2.7/”, line 420, in get_config_vars
File “/home/fwein/tmp/lib/python2.7/”, line 288, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /home/fwein/tmp/lib/python2.7/config/Makefile (No such file or directory)

But even building numpy with my local python failed for me.

Is there any change that Trelis simply extends its Python to numpy? That would really be the best! :))

Based on the error, I suspect that our version of Python and your version of Python were built using different versions of Unicode. Here is one way to check in Python 2.7 which version of Unicode it was built with: … 2-or-ucs-4

Also, from the Python docs ( it says “Note that UCS2 and UCS4 Python builds are not binary compatible”, which would explain why you can’t import numpy into our Python.

We are reviewing the license for numpy for possibly adding it to our package.

There are two issues: When I link /usr/lib64/python2.7/site-packages/numpy
for my Python 2.7.13 I get the error

import numpy
Traceback (most recent call last):
File “”, line 1, in
File “/opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/”, line 142, in
from . import add_newdocs
File “/opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/”, line 13, in
from numpy.lib import add_newdoc
File “/opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/lib/”, line 8, in
from .type_check import *
File “/opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/lib/”, line 11, in
import numpy.core.numeric as _nx
File “/opt/Trelis-16.3/bin/lib/python2.7/site-packages/numpy/core/”, line 24, in
raise ImportError(msg)
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you’re working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

As as I understand this is because Trelis’ Python is too old.
2.7.3 (default, Dec 6 2012, 13:01:46)
[GCC 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)]

But you are right, even with equal version I would have been bitten by the unicode (thanks for the link!)
Trelis: print(sys.maxunicode) -> 65535
my system: print(sys.maxunicode) -> 1114111
Whyever 2^16 is not enough and one wants more???

So adding numpy with Trelis would be really nice. BTW, Paraview adds numpy.

Here is something else you can try.

I did an experiment and removed python from my Trelis installation so that it would fall back to the system python. That is, I removed bin/libpython* and bin/lib/. With that change, Trelis starts up fine, which tells me that Trelis is not sensitive to the ucs2 vs. ucs4 difference.

I tried alternatives to force Trelis to use the system python, without modifying the Trelis installation, but ran into difficulty with that. I assume its because of something we do which sets PYTHONHOME and other things.

It looks like we will add numpy to Trelis. Thanks for your comments.

Thank you very much: For the outlook for adding numpy and for the idea how to force Trelis using system python.

Will you upgrade python and switch to 32bit unicode?

From what I understand, having no python by itself is the situation for the macOS version and it indeed works fine there (import numpy and import h5py without issues).