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

Segmentation fault when importing tensorflow before ortools #3230

Closed
youchangkim opened this issue Apr 7, 2022 · 9 comments
Closed

Segmentation fault when importing tensorflow before ortools #3230

youchangkim opened this issue Apr 7, 2022 · 9 comments
Assignees
Labels
Bug Help Needed Modeling/Usage problem Lang: Python Python wrapper issue OS: Mac MacOS
Milestone

Comments

@youchangkim
Copy link

What version of OR-Tools and what language are you using?
Version: v9.3
Language: Python

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CP-SAT

What operating system (Linux, Windows, ...) and version?
macOS BigSur x86-64

What did you do?

  1. Download https://github.com/google/or-tools/blob/stable/ortools/sat/samples/simple_sat_program.py
  2. Insert import tensorflow before from ortools.sat.python import cp_model

What did you expect to see

x = 1
y = 0
z = 0

What did you see instead?

Segmentation fault: 11

Anything else we should know about your project / environment

  1. any tensorflow versions between v2.2.0 and v2.8.0 (available for py38) can reproduce the issue.
  2. or-tools v9.2 works fine with any tensorflow versions.
  3. importing tensorflow after ortools works fine.
@lperron
Copy link
Collaborator

lperron commented Apr 8, 2022

It usually means that tf is linked with an older version of protobuf.

What happens if you import tf after or-tools ?

There is nothing we can do about it.

@lperron lperron closed this as completed Apr 8, 2022
@Mizux Mizux self-assigned this Apr 8, 2022
@Mizux Mizux added this to the v9.4 milestone Apr 8, 2022
@Mizux Mizux added Bug Help Needed Modeling/Usage problem Lang: Python Python wrapper issue labels Apr 8, 2022
@Mizux
Copy link
Collaborator

Mizux commented Apr 8, 2022

related to:

@youchangkim
Copy link
Author

Tensorflow uses protobuf even older than what ortools v9.2 uses, but ortools v9.2 works fine. Was there any change in a way of linking protobuf in v9.3?

@youchangkim
Copy link
Author

youchangkim commented Apr 11, 2022

@Mizux This is slightly different from:

because importing packages actually succeeded but segmentation fault happened during Solve.

Current thread 0x0000000118e9fdc0 (most recent call first):
  File "[REDACTED]/venv/lib/python3.7/site-packages/ortools/sat/python/cp_model.py", line 2168 in Solve

@youchangkim
Copy link
Author

youchangkim commented Apr 12, 2022

@lperron @Mizux Is it possible to do something similar to these?

@Mizux Mizux added the OS: Mac MacOS label Apr 12, 2022
@youchangkim
Copy link
Author

@Mizux Is there any plan to fix this in next release?

@Mizux Mizux modified the milestones: v9.4, v9.5 Jul 8, 2022
@Mizux
Copy link
Collaborator

Mizux commented Jul 8, 2022

For next release v9.4 no, I want to release it ASAP.
For v9.5 we can take a look and see if we can 1) easily reproduce the bug 2) fix it reusing the technique you suggest.

@Mizux Mizux reopened this Jul 8, 2022
@Mizux Mizux modified the milestones: v9.5, v9.6 Sep 29, 2022
@lperron
Copy link
Collaborator

lperron commented Oct 11, 2022 via email

@lperron
Copy link
Collaborator

lperron commented Aug 10, 2023

Works fine now.

@lperron lperron closed this as completed Aug 10, 2023
@Mizux Mizux modified the milestones: v10.0, v9.8 Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Help Needed Modeling/Usage problem Lang: Python Python wrapper issue OS: Mac MacOS
Projects
None yet
Development

No branches or pull requests

3 participants