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

Install issue with "make python" #3493

Closed
Robot-1x opened this issue Oct 14, 2022 · 7 comments
Closed

Install issue with "make python" #3493

Robot-1x opened this issue Oct 14, 2022 · 7 comments
Assignees
Labels
Bug Lang: Python Python wrapper issue OS: Mac MacOS
Milestone

Comments

@Robot-1x
Copy link
Contributor

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

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

What operating system (Linux, Windows, ...) and version?
macOS Big Sur 11.6.5
cmake version 3.22.3

What did you do?
Installing OR-Tools Python from Source on MacOS

  1. USE_CPLEX=ON make third_party, works well no errors
  2. make python: Console just log:
[ 96%] Built target linear_sum_assignment_pybind11
[ 96%] Linking CXX shared module ../../../lib/max_flow.so
.....
......
cd /Users/robo/or-tools/build_make/ortools/graph/python && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -x /Users/robo/or-tools/build_make/lib/max_flow.so
[ 96%] Built target max_flow_pybind11
make[1]: *** [all] Error 2
make: *** [python] Error 2

Besides, I have installed or-tools java from sources use the same machine.

@Mizux Mizux self-assigned this Oct 14, 2022
@Mizux Mizux added this to the v9.6 milestone Oct 14, 2022
@Mizux Mizux added Bug OS: Mac MacOS Lang: Python Python wrapper issue labels Oct 14, 2022
@Mizux
Copy link
Collaborator

Mizux commented Oct 14, 2022

Do you have more details ?

Are you on Apple M1 ? does your python interpreter is using rosetta2 ?

@lperron
Copy link
Collaborator

lperron commented Oct 15, 2022

there should be an error in the ... you cut

@Robot-1x
Copy link
Contributor Author

Robot-1x commented Nov 21, 2022

Sry, I tried again and the console gives no more detail error information. The whole process done is as follow:

  1. Clone source code: git clone -b main https://github.com/google/or-tools
  2. Modify file(Makefile.cpp.mk) from USE_CPLEX ?= OFF to USE_CPLEX ?= ON
  3. Type make third_party, works well as normal.
  4. Then type make python, then console showed process from [0%]...[95%] and interrupted at this location.
[ 95%] Linking CXX shared library lib/libortools_flatzinc.dylib
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/flatzinc.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -mmacosx-version-min=10.15 -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 9.0.0 -current_version 9.5.0 -o lib/libortools_flatzinc.9.5.dylib -install_name @rpath/libortools_flatzinc.9.dylib CMakeFiles/flatzinc.dir/ortools/flatzinc/checker.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/cp_model_fz_solver.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/model.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/parser.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/parser.tab.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/parser.yy.cc.o CMakeFiles/flatzinc.dir/ortools/flatzinc/presolve.cc.o  -Wl,-rpath,@loader_path lib/libortools.9.5.dylib lib/libabsl_flags_parse.a lib/libabsl_flags_usage.a lib/libabsl_flags_usage_internal.a lib/libabsl_flags.a lib/libabsl_flags_internal.a lib/libabsl_flags_marshalling.a lib/libabsl_flags_reflection.a lib/libabsl_flags_config.a lib/libabsl_flags_private_handle_accessor.a lib/libabsl_flags_commandlineflag.a lib/libabsl_flags_commandlineflag_internal.a lib/libabsl_flags_program_name.a lib/libabsl_random_distributions.a lib/libabsl_random_seed_sequences.a lib/libabsl_random_internal_pool_urbg.a lib/libabsl_random_internal_randen.a lib/libabsl_random_internal_randen_hwaes.a lib/libabsl_random_internal_randen_hwaes_impl.a lib/libabsl_random_internal_randen_slow.a lib/libabsl_random_internal_platform.a lib/libabsl_random_internal_seed_material.a lib/libabsl_random_seed_gen_exception.a lib/libabsl_raw_hash_set.a lib/libabsl_hashtablez_sampler.a lib/libabsl_hash.a lib/libabsl_city.a lib/libabsl_low_level_hash.a lib/libabsl_leak_check.a lib/libabsl_statusor.a lib/libabsl_status.a lib/libabsl_cord.a lib/libabsl_cordz_info.a lib/libabsl_cord_internal.a lib/libabsl_cordz_functions.a lib/libabsl_exponential_biased.a lib/libabsl_cordz_handle.a lib/libabsl_bad_optional_access.a lib/libabsl_strerror.a lib/libabsl_bad_variant_access.a lib/libabsl_str_format_internal.a lib/libabsl_synchronization.a lib/libabsl_stacktrace.a lib/libabsl_symbolize.a lib/libabsl_debugging_internal.a lib/libabsl_demangle_internal.a lib/libabsl_graphcycles_internal.a lib/libabsl_malloc_internal.a lib/libabsl_time.a lib/libabsl_strings.a lib/libabsl_strings_internal.a lib/libabsl_base.a lib/libabsl_spinlock_wait.a lib/libabsl_throw_delegate.a lib/libabsl_int128.a lib/libabsl_civil_time.a lib/libabsl_time_zone.a -framework CoreFoundation lib/libabsl_bad_any_cast_impl.a lib/libabsl_raw_logging_internal.a lib/libabsl_log_severity.a lib/libprotobuf.a lib/libre2.a lib/libCbcSolver.a lib/libOsiCbc.a lib/libCbc.a lib/libCgl.a lib/libClpSolver.a lib/libOsiClp.a lib/libClp.a lib/libOsi.a lib/libCoinUtils.a /Applications/CPLEX_Studio221//cplex/lib/x86-64_osx/static_pic/libcplex.a _deps/scip-build/lib/libscip.a lib/libz.a 
/Applications/CMake.app/Contents/bin/cmake -E cmake_symlink_library lib/libortools_flatzinc.9.5.dylib lib/libortools_flatzinc.9.dylib lib/libortools_flatzinc.dylib
[ 95%] Built target flatzinc
make[1]: *** [all] Error 2
make: *** [python] Error 2
(base) robo@GuodeMacBook-Pro or-tools % 

@Mizux
Copy link
Collaborator

Mizux commented Nov 21, 2022

  1. why not using USE_CPLEX=ON make third_party ?
    i.e. you define a temporary env variable and since insinde the Makefile we are using ?= your value should override the default one (OFF)
  2. against the error must lie above this trace...

note: you can try to rerun compile in monothread using

cmake --build build_make --config Release --target python_package -v

ref:

python:
$(MAKE) third_party BUILD_PYTHON=ON BUILD_VENV=ON
cmake --build $(BUILD_DIR) --target install --config $(BUILD_TYPE) -j $(JOBS) -v

@lperron
Copy link
Collaborator

lperron commented Nov 22, 2022

Regrouped into #3558

Please follow up there

@lperron lperron closed this as completed Nov 22, 2022
@Robot-1x
Copy link
Contributor Author

Rerun compile in terminal using

cmake --build build_make --config Release --target python_package -v

Error information is as follows:

[ 95%] Generate Python 3 protocol buffer for ortools/bop/bop_parameters.proto
bin/protoc --proto_path=/Users/robo/or-tools --proto_path=/Users/robo/or-tools/build_make/_deps/protobuf-src/src --python_out=/Users/robo/or-tools/build_make/python --mypy_out=/Users/robo/or-tools/build_make/python ortools/bop/bop_parameters.proto
protoc-gen-mypy: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--mypy_out: protoc-gen-mypy: Plugin failed with status code 1.
make[3]: *** [python/ortools/bop/bop_parameters_pb2.py] Error 1
make[2]: *** [CMakeFiles/Pyortools_proto.dir/all] Error 2
make[1]: *** [CMakeFiles/python_package.dir/rule] Error 2
make: *** [python_package] Error 2

@Mizux
Copy link
Collaborator

Mizux commented Nov 23, 2022

protoc-gen-mypy: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable

you must install mypy-protobuf and have the shipped binary in your PATH...

e.g. on linux:

# Check if already installed
python3 -m pip show mypy-protobuf
# install it in user space
python3 -m pip install --user mypy-protobuf
# Check protoc-gen-mypy is in my PATH
command -v protoc-gen-mypy

note: For windows you can look at our release script (I've installed python 3.11 in C:\python311-64 etc...)
so you can adapt to your setup...

for %%v in (6 7 8 9 10 11) do (
title Build Python 3.%%v
:: Check Python
which.exe C:\python3%%v-64\python.exe || exit 1
echo C:\python3%%v-64\python.exe: FOUND | tee.exe -a build.log
C:\python3%%v-64\python.exe -m pip install --upgrade --user absl-py mypy-protobuf
set PATH+=;%userprofile%\appdata\roaming\python\python3%%v\Scripts"
set PATH+=;C:\python3%%v-64\Scripts"

@Mizux Mizux modified the milestones: v9.6, v9.5 Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Lang: Python Python wrapper issue OS: Mac MacOS
Projects
None yet
Development

No branches or pull requests

3 participants