Cython fails to run for a python3.6 installed in custom location. #1727

Open
gwk opened this Issue Jun 3, 2017 · 2 comments

Comments

Projects
None yet
2 participants

gwk commented Jun 3, 2017

I have built/installed python from source on OSX to a custom framework location. The exact configure command is:

CC=clang CXX=clang++ CFLAGS='-flto=thin -Wno-deprecated-declarations' MACOSX_DEPLOYMENT_TARGET=10.9 ../configure --cache-file=config.cache --prefix=/usr/local/py --enable-framework=/usr/local/py/Library/Frameworks --quiet --with-lto 

I then install cython using the corresponding pip:

/usr/local/py/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 install cython

The cython install succeeds, but the installation is broken:

 $ cython
Traceback (most recent call last):
  File "/usr/local/py/Library/Frameworks/Python.framework/Versions/3.6/bin/cython", line 7, in <module>
    from Cython.Compiler.Main import setuptools_main
  File     "/usr/local/py/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Cython/Compiler/Main.py",     line 30, in <module>
    from .Symtab import ModuleScope
  File     "/usr/local/py/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Cython/Compiler/Symtab.py",     line 18, in <module>
    from . import PyrexTypes
  File     "/usr/local/py/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Cython/Compiler/PyrexTypes.    py", line 17, in <module>
    from .Code import UtilityCode, LazyUtilityCode, TempitaUtilityCode
  File "Cython/Compiler/Code.py", line 39, in init Cython.Compiler.Code     (/private/var/folders/vy/rcv48w3j4w79llzf_x6qnvw40000gn/T/pip-uioc89se-build/Cython/Compiler/Code.c:80038)
    def runsource(self, source, filename="<input>", symbol="single"):
ModuleNotFoundError: No module named '__builtin__'

I believe this is a Cython bug, as I can successfully install many other packages using pip for custom python locations. If anyone has an idea of how to debug this issue please let me know; I realize that these setups can be time consuming to reproduce. Thanks!

gwk commented Jun 3, 2017

I am able to work around this bug by installing cython in developer mode: pip3 install -e . from the cython project root, master branch.

From there I was able to build pyzmq using pip3 install --no-binary=pyzmq pyzmq (it fails without the --no-binary option).

Contributor

scoder commented Jun 3, 2017 edited

The name "__builtin__" suggests that there is something going wrong at a Py2/Py3 compatibility level. It's supposed to use the name "builtins" in Py3 instead. Difficult to say how this could happen, but could you check in your install/build output if there is any hint of interference of a Python 2.x version? And could you make sure that the shebang lines in you Python installation all use the correct Python 3.6 runtime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment