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

setup.py tries to install Symengine even if it was not built #325

Open
arbor-arthur opened this issue May 3, 2023 · 7 comments
Open

setup.py tries to install Symengine even if it was not built #325

arbor-arthur opened this issue May 3, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@arbor-arthur
Copy link

Describe the bug
Even when option SYMFORCE_BUILD_SYMENGINE is set to OFF, setup.py still attempts to install Symengine, which will now fail.

To Reproduce
git clone symforce v0.8.0
Set SYMFORCE_BUILD_SYMENGINE to OFF

python3 -m pip install .
...
error: can't copy 'build/temp.macosx-10.9-universal2-cpython-39/symengine_install/lib/python3.9/site-packages/symengine/lib/symengine_wrapper.cpython-39-darwin.so': doesn't exist or not a regular file

I worked around this by commenting out the install code in setup.py:

        self.copy_file(
            build_dir
            / "symengine_install"
            / "lib"
            / f"python{sys.version_info.major}.{sys.version_info.minor}"
            / "site-packages"
            / "symengine"
            / "lib"
            / build_ext_obj.get_ext_filename("symengine_wrapper"),
            Path.cwd()
            / self.install_platlib  # type: ignore[attr-defined]
            / "symengine"
            / "lib"
            / build_ext_obj.get_ext_filename("symengine_wrapper"),
        )

Expected behavior
Should not try to install Symengine when SYMFORCE_BUILD_SYMENGINE is OFF.

Environment (please complete the following information):

  • OS and version: MacOS Ventura 13.3.1
  • Python version: Python 3.9.13
  • SymForce Version: 0.8.0

Additional context
cmake version 3.26.3

@arbor-arthur arbor-arthur added the bug Something isn't working label May 3, 2023
@chao-qu-skydio
Copy link
Contributor

Could you elaborate on why you want to set SYMFORCE_BUILD_SYMENGINE=OFF?
Asking because the original reason for providing this flag is to only build the gen and opt packages.

@arbor-arthur
Copy link
Author

I had difficulty building symengine due to some complex cython compilation problem. Since I had no need for symengine, I decided to just not build it! I am only using the gen, opt, and slam packages.

@aaron-skydio
Copy link
Member

Ah, so you aren't using any python code at all? Usually we'd recommend installing with cmake and not pip in that case

@arbor-arthur
Copy link
Author

I am using python code for codegen. And even without symengine, I run the codegen infrequently enough that waiting a couple seconds is plenty fast for me!

Would this problem be different if I were invoking cmake directly instead of through pip?

Regardless, I am installing like this because of the readme saying:

If you want to compile against C++ SymForce types (like sym::Optimizer), you currently need to build from source.

If you just want to build and install SymForce without repeatedly modifying the source, the recommended way to do this is with pip.

@aaron-skydio
Copy link
Member

Would this problem be different if I were invoking cmake directly instead of through pip?

Yeah invoking cmake directly, you wouldn't run into this

Regardless, I am installing like this because of the readme saying:

If you want to compile against C++ SymForce types (like sym::Optimizer), you currently need to build from source.

If you just want to build and install SymForce without repeatedly modifying the source, the recommended way to do this is with pip.

Ah, good point, we do say that. Curious if you have more info about what was going wrong with Cython? We should really get the packaged install to include everything you need to build against it, but it might also make sense to enable building SymForce from source, but pulling an already-built copy of our modified SymEngine from somewhere instead of needing to build that too, since even most people building SymForce from source aren't modifying SymEngine

@arbor-arthur
Copy link
Author

The error I'm getting building Symengine with Cython is "Your Cython version is too old. Please upgrade Cython."

I ran python3 -m pip install --upgrade Cython and the newest I get is 0.29.35, which still produces this "too old" error.

@aaron-skydio
Copy link
Member

It's pretty likely the issue you're seeing is this: #161

Which is resolved by cleaning your build directory as mentioned there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants