pythran
pythran copied to clipboard
import pythran leads to configparser.NoSectionError: No section: 'compiler'
An error from fluidsim CI that I don't understand (https://travis-ci.org/fluiddyn/fluidsim/jobs/484692528):
File "/home/travis/build/fluiddyn/fluidsim/.tox/py-pythran/.venv/lib/python3.6/site-packages/transonic/util.py", line 63, in <module>
import pythran
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/__init__.py", line 40, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/toolchain.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/backend.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/analyses/__init__.py", line 12, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/analyses/aliases.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/syntax.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/tables.py", line 4496, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/omp/__init__.py", line 16, in <module>
File "/tmp/pip-install-77fofvtn/fluidfft/.eggs/pythran-0.9.1-py3.6.egg/pythran/config.py", line 193, in compiler
File "/opt/python/3.6.7/lib/python3.6/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/opt/python/3.6.7/lib/python3.6/configparser.py", line 1141, in _unify_values
raise NoSectionError(section)
configparser.NoSectionError: No section: 'compiler'
Any ideas why we get this?
We create a short .pythranrc file with
echo '[pythran]\ncomplex_hook = True' > $HOME/.pythranrc
I was not able to reproduce at home.
Of course, we could add the compiler section but it should work without it...
Strange, we get the error even with:
echo '[pythran]\ncomplex_hook = True\n[compiler]\nCXX = g++-6\nCC = gcc-6\n' > $HOME/.pythranrc
Could it be related to the fact that Pythran is installed in this case as an egg by setuptools?
Perhaps. I suspect the pythranrc files (sys and platform specific ones) were not ready, maybe because of a race condition?
And it seems that the error is raised form https://github.com/serge-sans-paille/pythran/blob/master/pythran/config.py#L193
What we can do in pythran>=0.9.1 is to lint the pythranrc... so can you add a pythran-config -vv
, which will show warnings if anything is off with the config.
Without the egg it works fine.
As suggested by @ashwinvis it looks like an error in the loading, or maybe bootstrap, of the configuration files. The error happens because a section is empty, which probably means a configuration has not been properly copied during installation process?
Pythran is installed as an egg by setuptools when one installs a project with setup_requires
containing "pythran"
in an environment without Pythran.
There could be a problem with this setup (which is reasonable) and with installation of Pythran as an egg.
We don't usually have "pythran"
in setup_requires
because we want to support installation without Pythran compilation, so it is not a big deal for us.
I'll try to investigate a little bit more when I have time so I don't close the issue.