s2geometry icon indicating copy to clipboard operation
s2geometry copied to clipboard

Installing python - Missing CMakeList.txt

Open acm-234 opened this issue 5 years ago • 9 comments

I was able to install s2gemoetry, however, when I tried importing it into python I received a module not found error. When I went to the python directory s2geometry/build/python it appears there is no CMakeList.txt file to do a install of the python library. I have swig installed, any recommendations? I apologize if I missed something obvious.

acm-234 avatar Nov 07 '19 15:11 acm-234

There's src/python/CMakeLists.txt.

I'm guessing either SWIG or Python wasn't found when configuring. https://github.com/google/s2geometry/blob/master/CMakeLists.txt#L534

Look at the entire output of cmake, or paste it here for help debugging.

jmr avatar Nov 08 '19 09:11 jmr

Interesting. I reran the cmake and make commends and below are the output that seem relevant to SWIG. It looks like it found a version of swig (2) but maybe gave some warnings. I have swig 3 installed as well, is there a way in cmake I can specify swig 3/ could that be the issue? Thanks for helping me out!

================== cmake3 output

-- Found SWIG: /bin/swig (found version "2.0.10") -- Found PythonInterp: /bin/python (found version "2.7.5") -- Found PythonLibs: /usr/lib64 (found version "2.7.5") GTEST_ROOT: /home/tr/temp/googletest-release-1.8.0/googletest CMake Warning (dev) at /usr/share/cmake3/Modules/UseSWIG.cmake:600 (message): Policy CMP0078 is not set: UseSWIG generates standard target names. Run "cmake --help-policy CMP0078" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first): src/python/CMakeLists.txt:12 (swig_add_library) This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake3/Modules/UseSWIG.cmake:460 (message): Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module flag. Run "cmake --help-policy CMP0086" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

================== make output

Scanning dependencies of target pywraps2_swig_compilation [100%] Swig compile s2.i for python /var/lib/s2geometry/src/s2/s2region.h:45: Warning 362: operator= ignored /var/lib/s2geometry/src/s2/s2cell_union.h:73: Warning 509: Overloaded method S2CellUnion::S2CellUnion(std::vector< uint64,std::allocator< uint64 > > const &) effectively ignored, /var/lib/s2geometry/src/s2/s2cell_union.h:69: Warning 509: as it is shadowed by S2CellUnion::S2CellUnion(std::vector< S2CellId,std::allocator< S2CellId > >). [100%] Built target pywraps2_swig_compilation Scanning dependencies of target _pywraps2 [100%] Building CXX object python/CMakeFiles/_pywraps2.dir/CMakeFiles/_pywraps2.dir/s2PYTHON_wrap.cxx.o [100%] Linking CXX shared module _pywraps2.so [100%] Built target _pywraps2

acm-234 avatar Nov 08 '19 14:11 acm-234

It looks like it's building pywraps2 fine. Probably python just isn't finding it.

Do make install and show that output to see where it goes.

jmr avatar Nov 08 '19 14:11 jmr

Since there was a lot of output I just pasted what. Thought might be relevant. Let me know if you need something else from the output.

==================== -- Installing: /usr/local/lib/libs2.a -- Installing: /usr/local/lib/libs2testing.a -- Installing: /usr/local/lib/libgtest.a -- Installing: /usr/local/lib/libgtest_main.a -- Up-to-date: /usr/local/include/gtest -- Up-to-date: /usr/local/include/gtest/gtest-death-test.h -- Up-to-date: /usr/local/include/gtest/gtest-message.h -- Up-to-date: /usr/local/include/gtest/gtest-param-test.h -- Up-to-date: /usr/local/include/gtest/gtest-param-test.h.pump -- Up-to-date: /usr/local/include/gtest/gtest-printers.h -- Up-to-date: /usr/local/include/gtest/gtest-spi.h -- Up-to-date: /usr/local/include/gtest/gtest-test-part.h -- Up-to-date: /usr/local/include/gtest/gtest-typed-test.h -- Up-to-date: /usr/local/include/gtest/gtest.h -- Up-to-date: /usr/local/include/gtest/gtest_pred_impl.h -- Up-to-date: /usr/local/include/gtest/gtest_prod.h -- Up-to-date: /usr/local/include/gtest/internal -- Up-to-date: /usr/local/include/gtest/internal/custom -- Up-to-date: /usr/local/include/gtest/internal/custom/gtest-port.h -- Up-to-date: /usr/local/include/gtest/internal/custom/gtest-printers.h -- Up-to-date: /usr/local/include/gtest/internal/custom/gtest.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-death-test-internal.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-filepath.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-internal.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-linked_ptr.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-param-util-generated.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-param-util-generated.h.pump -- Up-to-date: /usr/local/include/gtest/internal/gtest-param-util.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-port-arch.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-port.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-string.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-tuple.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-tuple.h.pump -- Up-to-date: /usr/local/include/gtest/internal/gtest-type-util.h -- Up-to-date: /usr/local/include/gtest/internal/gtest-type-util.h.pump -- Installing: /usr/local/lib64/python2.7/site-packages/_pywraps2.so -- Installing: /usr/local/lib64/python2.7/site-packages/pywraps2.py

acm-234 avatar Nov 08 '19 14:11 acm-234

When you run python, is it python2 or python3?

jmr avatar Nov 08 '19 15:11 jmr

When I run python it uses version 2.7.5. The path to the python function. $which python -> /usr/bin/python

acm-234 avatar Nov 08 '19 15:11 acm-234

Run python -m site and check that /usr/local/lib64/python2.7/site-packages/ is in the sys.path.

Maybe it's related to #93.

figroc avatar Dec 25 '19 05:12 figroc

Could you try with #128?

jmr avatar Aug 28 '20 13:08 jmr

#128 has been merged, you can try at HEAD.

jmr avatar Aug 28 '20 19:08 jmr