tensor-compiler / taco

The Tensor Algebra Compiler (taco) computes sparse tensor expressions on CPUs and GPUs
http://tensor-compiler.org
Other
1.25k stars 188 forks source link

pytaco import error immediately after install #473

Closed gussmith23 closed 3 years ago

gussmith23 commented 3 years ago

Here's what happens:

➜  build git:(master) cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON=ON ..

-- Will build Python extension
-- Release Build
-- Shared library
-- Submodule update
-- pybind11 v2.6.2 
-- Will build Python extension
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gus/taco/build
➜  build git:(master) make -j16
[  2%] Built target taco-gtest
[ 58%] Built target taco
[ 62%] Built target taco-tool
[ 62%] Built target tensor_times_vector
[ 85%] Built target core_modules
[100%] Built target taco-test
➜  taco git:(master) echo $PYTHONPATH
/home/gus/taco/build/lib:...
➜  taco git:(master) python3 build/python_bindings/unit_tests.py    

Traceback (most recent call last):
  File "build/python_bindings/unit_tests.py", line 4, in <module>
    import pytaco as pt
  File "/home/gus/taco/build/lib/pytaco/__init__.py", line 1, in <module>
    from .core.core_modules import *
ModuleNotFoundError: No module named 'pytaco.core.core_modules'

I have also installed the packages listed in the README. HEAD is at 2c2545d61383546df345b1a37bfd2c3409e2bc79. Any idea what is happening?

kirshanthans commented 3 years ago

Check the default python3 version that you are using. I think pybind picks the latest version. I had both python3.6 and python3.7 but my default python3 is version 3.6. When I explicitly python3.7, pytaco works fine.

gussmith23 commented 3 years ago

Thanks for the quick reply!

➜  ~ python --version
Python 3.7.10

seems like I have the right version!

Also, just in case it'll help, here's what's in build:

taco/build
├── apps
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   └── progress.marks
│   ├── cmake_install.cmake
│   ├── CTestTestfile.cmake
│   ├── Makefile
│   └── tensor_times_vector
│       ├── CMakeFiles
│       │   ├── CMakeDirectoryInformation.cmake
│       │   ├── progress.marks
│       │   └── tensor_times_vector.dir
│       │       ├── build.make
│       │       ├── cmake_clean.cmake
│       │       ├── CXX.includecache
│       │       ├── DependInfo.cmake
│       │       ├── depend.internal
│       │       ├── depend.make
│       │       ├── flags.make
│       │       ├── link.txt
│       │       ├── progress.make
│       │       └── tensor_times_vector.cpp.o
│       ├── cmake_install.cmake
│       ├── CTestTestfile.cmake
│       └── Makefile
├── bin
│   ├── taco
│   ├── taco-tensor_times_vector
│   └── taco-test
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.18.4
│   │   ├── CMakeCCompiler.cmake
│   │   ├── CMakeCXXCompiler.cmake
│   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   ├── CMakeSystem.cmake
│   │   ├── CompilerIdC
│   │   │   ├── a.out
│   │   │   ├── CMakeCCompilerId.c
│   │   │   └── tmp
│   │   └── CompilerIdCXX
│   │       ├── a.out
│   │       ├── CMakeCXXCompilerId.cpp
│   │       └── tmp
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeOutput.log
│   ├── CMakeRuleHashes.txt
│   ├── CMakeTmp
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   ├── src.dir
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── DependInfo.cmake
│   │   └── progress.make
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── CTestTestfile.cmake
├── include
│   └── taco
│       └── version.h
├── lib
│   ├── libtaco-gtest.a
│   ├── libtaco.so
│   └── pytaco
│       ├── core
│       │   └── core_modules.cpython-39-x86_64-linux-gnu.so
│       ├── __init__.py
│       ├── numpy_license.txt
│       ├── __pycache__
│       │   └── __init__.cpython-37.pyc
│       └── pytensor
│           ├── __init__.py
│           ├── taco_tensor.py
│           └── tensorIO.py
├── Makefile
├── python_bindings
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── core_modules.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── CXX.includecache
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   ├── progress.make
│   │   │   └── src
│   │   │       ├── pyDatatypes.cpp.o
│   │   │       ├── pyFormat.cpp.o
│   │   │       ├── pyIndexNotation.cpp.o
│   │   │       ├── pyParsers.cpp.o
│   │   │       ├── pytaco.cpp.o
│   │   │       ├── pyTensor.cpp.o
│   │   │       └── pyTensorIO.cpp.o
│   │   └── progress.marks
│   ├── cmake_install.cmake
│   ├── CTestTestfile.cmake
│   ├── Makefile
│   ├── pybind11
│   │   ├── CMakeFiles
│   │   │   ├── CMakeDirectoryInformation.cmake
│   │   │   └── progress.marks
│   │   ├── cmake_install.cmake
│   │   ├── CTestTestfile.cmake
│   │   └── Makefile
│   └── unit_tests.py
├── src
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── progress.marks
│   │   └── taco.dir
│   │       ├── build.make
│   │       ├── cmake_clean.cmake
│   │       ├── codegen
│   │       │   ├── codegen_c.cpp.o
│   │       │   ├── codegen.cpp.o
│   │       │   ├── codegen_cuda.cpp.o
│   │       │   └── module.cpp.o
│   │       ├── cuda.cpp.o
│   │       ├── CXX.includecache
│   │       ├── DependInfo.cmake
│   │       ├── depend.internal
│   │       ├── depend.make
│   │       ├── error
│   │       │   ├── error_checks.cpp.o
│   │       │   └── error_messages.cpp.o
│   │       ├── error.cpp.o
│   │       ├── flags.make
│   │       ├── format.cpp.o
│   │       ├── index_notation
│   │       │   ├── index_notation.cpp.o
│   │       │   ├── index_notation_nodes_abstract.cpp.o
│   │       │   ├── index_notation_nodes.cpp.o
│   │       │   ├── index_notation_printer.cpp.o
│   │       │   ├── index_notation_rewriter.cpp.o
│   │       │   ├── index_notation_visitor.cpp.o
│   │       │   ├── intrinsic.cpp.o
│   │       │   ├── kernel.cpp.o
│   │       │   ├── provenance_graph.cpp.o
│   │       │   ├── schedule.cpp.o
│   │       │   └── transformations.cpp.o
│   │       ├── ir
│   │       │   ├── ir.cpp.o
│   │       │   ├── ir_generators.cpp.o
│   │       │   ├── ir_printer.cpp.o
│   │       │   ├── ir_rewriter.cpp.o
│   │       │   ├── ir_verifier.cpp.o
│   │       │   ├── ir_visitor.cpp.o
│   │       │   └── simplify.cpp.o
│   │       ├── ir_tags.cpp.o
│   │       ├── link.txt
│   │       ├── lower
│   │       │   ├── expr_tools.cpp.o
│   │       │   ├── iteration_forest.cpp.o
│   │       │   ├── iteration_graph.cpp.o
│   │       │   ├── iterator.cpp.o
│   │       │   ├── lower.cpp.o
│   │       │   ├── lowerer_impl.cpp.o
│   │       │   ├── merge_lattice.cpp.o
│   │       │   ├── mode_access.cpp.o
│   │       │   ├── mode.cpp.o
│   │       │   ├── mode_format_compressed.cpp.o
│   │       │   ├── mode_format_dense.cpp.o
│   │       │   ├── mode_format_impl.cpp.o
│   │       │   ├── mode_format_singleton.cpp.o
│   │       │   └── tensor_path.cpp.o
│   │       ├── parser
│   │       │   ├── einsum_parser.cpp.o
│   │       │   ├── lexer.cpp.o
│   │       │   ├── parser.cpp.o
│   │       │   └── schedule_parser.cpp.o
│   │       ├── progress.make
│   │       ├── storage
│   │       │   ├── array.cpp.o
│   │       │   ├── file_io_mtx.cpp.o
│   │       │   ├── file_io_rb.cpp.o
│   │       │   ├── file_io_tns.cpp.o
│   │       │   ├── index.cpp.o
│   │       │   ├── pack.cpp.o
│   │       │   ├── storage.cpp.o
│   │       │   ├── typed_index.cpp.o
│   │       │   └── typed_value.cpp.o
│   │       ├── taco_tensor_t.cpp.o
│   │       ├── target.cpp.o
│   │       ├── tensor.cpp.o
│   │       ├── type.cpp.o
│   │       └── util
│   │           ├── env.cpp.o
│   │           ├── files.cpp.o
│   │           ├── name_generator.cpp.o
│   │           └── strings.cpp.o
│   ├── cmake_install.cmake
│   ├── CTestTestfile.cmake
│   └── Makefile
├── test
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── progress.marks
│   │   ├── taco-gtest.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── cmake_clean_target.cmake
│   │   │   ├── CXX.includecache
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── gtest
│   │   │   │   └── gtest-all.cc.o
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   └── taco-test.dir
│   │       ├── build.make
│   │       ├── cmake_clean.cmake
│   │       ├── CXX.includecache
│   │       ├── DependInfo.cmake
│   │       ├── depend.internal
│   │       ├── depend.make
│   │       ├── expr_factory.cpp.o
│   │       ├── flags.make
│   │       ├── link.txt
│   │       ├── progress.make
│   │       ├── test.cpp.o
│   │       ├── tests-api.cpp.o
│   │       ├── tests-copyprop.cpp.o
│   │       ├── tests-error.cpp.o
│   │       ├── tests-expr.cpp.o
│   │       ├── tests-expr-reduction.cpp.o
│   │       ├── tests-expr_storage.cpp.o
│   │       ├── tests-format.cpp.o
│   │       ├── tests-format-mm-permute.cpp.o
│   │       ├── tests-index.cpp.o
│   │       ├── tests-indexexpr.cpp.o
│   │       ├── tests-index_notation.cpp.o
│   │       ├── tests-indexstmt.cpp.o
│   │       ├── tests-io.cpp.o
│   │       ├── tests-lower.cpp.o
│   │       ├── tests-merge_lattice.cpp.o
│   │       ├── tests-parafac.cpp.o
│   │       ├── tests-qcd.cpp.o
│   │       ├── tests-regression.cpp.o
│   │       ├── tests-schedule-parser.cpp.o
│   │       ├── tests-scheduling.cpp.o
│   │       ├── tests-scheduling-eval.cpp.o
│   │       ├── tests-storage_alloc.cpp.o
│   │       ├── tests-storage.cpp.o
│   │       ├── tests-tensor.cpp.o
│   │       ├── tests-tensor_types.cpp.o
│   │       ├── tests-transformation.cpp.o
│   │       ├── tests-transpose.cpp.o
│   │       ├── tests-type.cpp.o
│   │       ├── tests-windowing.cpp.o
│   │       ├── tests-workspaces.cpp.o
│   │       ├── test_tensors.cpp.o
│   │       └── test-typedcomponent-memory.cpp.o
│   ├── cmake_install.cmake
│   ├── CTestTestfile.cmake
│   └── Makefile
├── Testing
│   └── Temporary
│       ├── CTestCostData.txt
│       ├── LastTest.log
│       ├── LastTestsDisabled.log
│       └── LastTestsFailed.log
└── tools
    ├── CMakeFiles
    │   ├── CMakeDirectoryInformation.cmake
    │   ├── progress.marks
    │   └── taco-tool.dir
    │       ├── build.make
    │       ├── cmake_clean.cmake
    │       ├── CXX.includecache
    │       ├── DependInfo.cmake
    │       ├── depend.internal
    │       ├── depend.make
    │       ├── flags.make
    │       ├── link.txt
    │       ├── progress.make
    │       └── taco.cpp.o
    ├── cmake_install.cmake
    ├── CTestTestfile.cmake
    └── Makefile

48 directories, 240 files
kirshanthans commented 3 years ago

Check your system for all python3 versions (e.g., python3.6 and python3.7 in my case). When taco builds, it might have picked up the higher version.

gussmith23 commented 3 years ago

you were right! it was picking up the wrong python. fixed it by explicitly pointing it to python. note the problem is likely because i'm using pyenv (and probably using it incorrectly...) now i can import it in python!

➜  build git:(master) cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON=ON -DPYTHON_EXECUTABLE=/usr/local/google/home/gusss/.pyenv/versions/3.7.10/bin/python -DPYTHON_LIBRARY=/usr/local/google/home/gusss/.pyenv/versions/3.7.10/lib/libpython3.7m.a ..

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Will build Python extension
-- Release Build
-- Shared library
-- Submodule update
-- pybind11 v2.6.2 
-- Found PythonInterp: /usr/local/google/home/gusss/.pyenv/versions/3.7.10/bin/python (found version "3.7.10") 
-- Found PythonLibs: /usr/local/google/home/gusss/.pyenv/versions/3.7.10/lib/libpython3.7m.a
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Will build Python extension
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/google/home/gusss/taco/build