Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to compile the cython library. #382

Closed
Schiboni opened this issue Jan 16, 2018 · 7 comments
Closed

Not able to compile the cython library. #382

Schiboni opened this issue Jan 16, 2018 · 7 comments

Comments

@Schiboni
Copy link

Hi, hope you can help me, I am really desperate. I need to make some modification to the forward algorithm and compile my custom version of pomegranate. When i run setup.py with the command "python3 setup.py build_ext --inplace". I receive the following error:

/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.5/pomegranateplus/utils.o -o build/lib.macosx-10.6-intel-3.5/POWERSPOTTING/codes/pomegranateplus/utils.cpython-35m-darwin.so
copying build/lib.macosx-10.6-intel-3.5/POWERSPOTTING/codes/pomegranateplus/BayesClassifier.cpython-35m-darwin.so -> POWERSPOTTING/codes/pomegranateplus
error: could not create 'POWERSPOTTING/codes/pomegranateplus/BayesClassifier.cpython-35m-darwin.so': No such file or directory

Do you have any suggestions what to do? My machine is a Mac with Sierra 10.12.6 and python 3.

Thanks in advance

@jmschrei
Copy link
Owner

Can you try removing all of the files that are not .py, .pyx, or .pxd from the library and recompile? Also, potentially try running python3 setup.py install instead.

@jmschrei
Copy link
Owner

Did this work out?

@vpicouet
Copy link

It seems that deleting init.py works!

@enjoysmath
Copy link

Well, how do you build a cython package that requires an init.py if you have to delete it!!! This is driving me nuts.

@timonviola
Copy link

timonviola commented Aug 1, 2022

it also doesn't compile if __init__.py is present

@zwei-beiner
Copy link

zwei-beiner commented Aug 9, 2022

@enjoysmath @timonviola
A fix that worked for me is described here:
https://stackoverflow.com/questions/71983019/why-does-adding-an-init-py-change-cython-build-ext-inplace-behavior

Essentially, you can keep the __init__.py file and the setup file has to be

from setuptools import Extension, setup
from Cython.Build import cythonize

extensions = [Extension("hello", ["hello.pyx"])]

setup(
    ext_modules=cythonize(extensions),
)

instead of

# WRONG!!
from setuptools import setup
from Cython.Build import cythonize

setup(
    ext_modules=cythonize("hello.pyx"),
)

@jmschrei
Copy link
Owner

jmschrei commented Aug 9, 2022

Thanks for the comments. I'm currently in the process of rewriting pomegranate using a PyTorch backend so hopefully that will resolve all these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants