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

python: cannot import name frontend #260

Closed
engahmed1190 opened this issue Feb 22, 2018 · 4 comments
Closed

python: cannot import name frontend #260

engahmed1190 opened this issue Feb 22, 2018 · 4 comments

Comments

@engahmed1190
Copy link

i have seen that this error reported before but none of the suggested solution solved my case
my machine is Ubuntu 16.04 doesn't have cuda , fresh installed

i have installed thrift successfully including wangle , the error i have is related to frontend module

+ cd /tmp/fblualib-build.FSDy82/thpp/thpp
+ '[' 1 -eq 0 ']'
+ ./build.sh
If you don't have folly or thrift installed, try doing
  THPP_NOFB=1 ./build.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129    0   129    0     0     55      0 --:--:--  0:00:02 --:--:--    55
100  618k  100  618k    0     0   113k      0  0:00:05  0:00:05 --:--:--  225k
curl: Saved to filename 'googletest-release-1.7.0.zip'
Archive:  googletest-release-1.7.0.zip
c99458533a9b4c743ed51537e25989ea55944908
   creating: googletest-release-1.7.0/
  inflating: googletest-release-1.7.0/CHANGES  
  inflating: googletest-release-1.7.0/CMakeLists.txt  
  inflating: googletest-release-1.7.0/CONTRIBUTORS  
  inflating: googletest-release-1.7.0/LICENSE  
  inflating: googletest-release-1.7.0/Makefile.am  
  inflating: googletest-release-1.7.0/README  
   creating: googletest-release-1.7.0/build-aux/
 extracting: googletest-release-1.7.0/build-aux/.keep  
   creating: googletest-release-1.7.0/cmake/
  inflating: googletest-release-1.7.0/cmake/internal_utils.cmake  
   creating: googletest-release-1.7.0/codegear/
  inflating: googletest-release-1.7.0/codegear/gtest.cbproj  
  inflating: googletest-release-1.7.0/codegear/gtest.groupproj  
  inflating: googletest-release-1.7.0/codegear/gtest_all.cc  
  inflating: googletest-release-1.7.0/codegear/gtest_link.cc  
  inflating: googletest-release-1.7.0/codegear/gtest_main.cbproj  
  inflating: googletest-release-1.7.0/codegear/gtest_unittest.cbproj  
  inflating: googletest-release-1.7.0/configure.ac  
   creating: googletest-release-1.7.0/include/
   creating: googletest-release-1.7.0/include/gtest/
  inflating: googletest-release-1.7.0/include/gtest/gtest-death-test.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-message.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-param-test.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-param-test.h.pump  
  inflating: googletest-release-1.7.0/include/gtest/gtest-printers.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-spi.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-test-part.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest-typed-test.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest_pred_impl.h  
  inflating: googletest-release-1.7.0/include/gtest/gtest_prod.h  
   creating: googletest-release-1.7.0/include/gtest/internal/
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-death-test-internal.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-filepath.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-internal.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-linked_ptr.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-param-util-generated.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-param-util-generated.h.pump  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-param-util.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-port.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-string.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-tuple.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-tuple.h.pump  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-type-util.h  
  inflating: googletest-release-1.7.0/include/gtest/internal/gtest-type-util.h.pump  
   creating: googletest-release-1.7.0/m4/
  inflating: googletest-release-1.7.0/m4/acx_pthread.m4  
  inflating: googletest-release-1.7.0/m4/gtest.m4  
   creating: googletest-release-1.7.0/make/
  inflating: googletest-release-1.7.0/make/Makefile  
   creating: googletest-release-1.7.0/msvc/
  inflating: googletest-release-1.7.0/msvc/gtest-md.sln  
  inflating: googletest-release-1.7.0/msvc/gtest-md.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest.sln  
  inflating: googletest-release-1.7.0/msvc/gtest.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_main-md.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_main.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_prod_test-md.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_prod_test.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_unittest-md.vcproj  
  inflating: googletest-release-1.7.0/msvc/gtest_unittest.vcproj  
   creating: googletest-release-1.7.0/samples/
  inflating: googletest-release-1.7.0/samples/prime_tables.h  
  inflating: googletest-release-1.7.0/samples/sample1.cc  
  inflating: googletest-release-1.7.0/samples/sample1.h  
  inflating: googletest-release-1.7.0/samples/sample10_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample1_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample2.cc  
  inflating: googletest-release-1.7.0/samples/sample2.h  
  inflating: googletest-release-1.7.0/samples/sample2_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample3-inl.h  
  inflating: googletest-release-1.7.0/samples/sample3_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample4.cc  
  inflating: googletest-release-1.7.0/samples/sample4.h  
  inflating: googletest-release-1.7.0/samples/sample4_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample5_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample6_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample7_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample8_unittest.cc  
  inflating: googletest-release-1.7.0/samples/sample9_unittest.cc  
   creating: googletest-release-1.7.0/scripts/
  inflating: googletest-release-1.7.0/scripts/fuse_gtest_files.py  
  inflating: googletest-release-1.7.0/scripts/gen_gtest_pred_impl.py  
  inflating: googletest-release-1.7.0/scripts/gtest-config.in  
  inflating: googletest-release-1.7.0/scripts/pump.py  
   creating: googletest-release-1.7.0/scripts/test/
  inflating: googletest-release-1.7.0/scripts/test/Makefile  
  inflating: googletest-release-1.7.0/scripts/upload.py  
  inflating: googletest-release-1.7.0/scripts/upload_gtest.py  
   creating: googletest-release-1.7.0/src/
  inflating: googletest-release-1.7.0/src/gtest-all.cc  
  inflating: googletest-release-1.7.0/src/gtest-death-test.cc  
  inflating: googletest-release-1.7.0/src/gtest-filepath.cc  
  inflating: googletest-release-1.7.0/src/gtest-internal-inl.h  
  inflating: googletest-release-1.7.0/src/gtest-port.cc  
  inflating: googletest-release-1.7.0/src/gtest-printers.cc  
  inflating: googletest-release-1.7.0/src/gtest-test-part.cc  
  inflating: googletest-release-1.7.0/src/gtest-typed-test.cc  
  inflating: googletest-release-1.7.0/src/gtest.cc  
  inflating: googletest-release-1.7.0/src/gtest_main.cc  
   creating: googletest-release-1.7.0/test/
  inflating: googletest-release-1.7.0/test/gtest-death-test_ex_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-death-test_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-filepath_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-linked_ptr_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-listener_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-message_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-options_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-param-test2_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-param-test_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-param-test_test.h  
  inflating: googletest-release-1.7.0/test/gtest-port_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-printers_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-test-part_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-tuple_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-typed-test2_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-typed-test_test.cc  
  inflating: googletest-release-1.7.0/test/gtest-typed-test_test.h  
  inflating: googletest-release-1.7.0/test/gtest-unittest-api_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_all_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_break_on_failure_unittest.py  
  inflating: googletest-release-1.7.0/test/gtest_break_on_failure_unittest_.cc  
  inflating: googletest-release-1.7.0/test/gtest_catch_exceptions_test.py  
  inflating: googletest-release-1.7.0/test/gtest_catch_exceptions_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_color_test.py  
  inflating: googletest-release-1.7.0/test/gtest_color_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_env_var_test.py  
  inflating: googletest-release-1.7.0/test/gtest_env_var_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_environment_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_filter_unittest.py  
  inflating: googletest-release-1.7.0/test/gtest_filter_unittest_.cc  
  inflating: googletest-release-1.7.0/test/gtest_help_test.py  
  inflating: googletest-release-1.7.0/test/gtest_help_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_list_tests_unittest.py  
  inflating: googletest-release-1.7.0/test/gtest_list_tests_unittest_.cc  
  inflating: googletest-release-1.7.0/test/gtest_main_unittest.cc  
  inflating: googletest-release-1.7.0/test/gtest_no_test_unittest.cc  
  inflating: googletest-release-1.7.0/test/gtest_output_test.py  
  inflating: googletest-release-1.7.0/test/gtest_output_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_output_test_golden_lin.txt  
  inflating: googletest-release-1.7.0/test/gtest_pred_impl_unittest.cc  
  inflating: googletest-release-1.7.0/test/gtest_premature_exit_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_prod_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_repeat_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_shuffle_test.py  
  inflating: googletest-release-1.7.0/test/gtest_shuffle_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_sole_header_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_stress_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_test_utils.py  
  inflating: googletest-release-1.7.0/test/gtest_throw_on_failure_ex_test.cc  
  inflating: googletest-release-1.7.0/test/gtest_throw_on_failure_test.py  
  inflating: googletest-release-1.7.0/test/gtest_throw_on_failure_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_uninitialized_test.py  
  inflating: googletest-release-1.7.0/test/gtest_uninitialized_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_unittest.cc  
  inflating: googletest-release-1.7.0/test/gtest_xml_outfile1_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_xml_outfile2_test_.cc  
  inflating: googletest-release-1.7.0/test/gtest_xml_outfiles_test.py  
  inflating: googletest-release-1.7.0/test/gtest_xml_output_unittest.py  
  inflating: googletest-release-1.7.0/test/gtest_xml_output_unittest_.cc  
  inflating: googletest-release-1.7.0/test/gtest_xml_test_utils.py  
  inflating: googletest-release-1.7.0/test/production.cc  
  inflating: googletest-release-1.7.0/test/production.h  
   creating: googletest-release-1.7.0/xcode/
   creating: googletest-release-1.7.0/xcode/Config/
  inflating: googletest-release-1.7.0/xcode/Config/DebugProject.xcconfig  
  inflating: googletest-release-1.7.0/xcode/Config/FrameworkTarget.xcconfig  
  inflating: googletest-release-1.7.0/xcode/Config/General.xcconfig  
  inflating: googletest-release-1.7.0/xcode/Config/ReleaseProject.xcconfig  
  inflating: googletest-release-1.7.0/xcode/Config/StaticLibraryTarget.xcconfig  
  inflating: googletest-release-1.7.0/xcode/Config/TestTarget.xcconfig  
   creating: googletest-release-1.7.0/xcode/Resources/
  inflating: googletest-release-1.7.0/xcode/Resources/Info.plist  
   creating: googletest-release-1.7.0/xcode/Samples/
   creating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/Info.plist  
   creating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj  
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/runtests.sh  
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/widget.cc  
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/widget.h  
  inflating: googletest-release-1.7.0/xcode/Samples/FrameworkSample/widget_test.cc  
   creating: googletest-release-1.7.0/xcode/Scripts/
  inflating: googletest-release-1.7.0/xcode/Scripts/runtests.sh  
  inflating: googletest-release-1.7.0/xcode/Scripts/versiongenerate.py  
   creating: googletest-release-1.7.0/xcode/gtest.xcodeproj/
  inflating: googletest-release-1.7.0/xcode/gtest.xcodeproj/project.pbxproj  
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/osama/torch/install
-- Found Folly: /usr/local/include  
-- Found Thrift: /usr/local/include  
-- Performing Test HAS_NO_AS_NEEDED
-- Performing Test HAS_NO_AS_NEEDED - Success
-- Found Glog: /usr/include  
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/fblualib-build.FSDy82/thpp/thpp/build
[  5%] Generating thpp/if/gen-cpp2/Tensor_data.h, thpp/if/gen-cpp2/Tensor_types.h, thpp/if/gen-cpp2/Tensor_types.tcc, thpp/if/gen-cpp2/Tensor_constants.h, thpp/if/gen-cpp2/Tensor_data.cpp, thpp/if/gen-cpp2/Tensor_types.cpp, thpp/if/gen-cpp2/Tensor_constants.cpp
/usr/bin/python: cannot import name frontend
CMakeFiles/thpp.dir/build.make:61: recipe for target 'thpp/if/gen-cpp2/Tensor_data.h' failed
make[2]: *** [thpp/if/gen-cpp2/Tensor_data.h] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/thpp.dir/all' failed
make[1]: *** [CMakeFiles/thpp.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

what i have done till now

1 -

 cd fbthrift/thrift/compiler/py/
 sudo python setup.py install

2- try to compile the using

g++ -I /usr/include/python2.7 -I fbthrift -std=c++14 -fpic -shared -o frontend.so compiler.cc -lboost_python -lpython2.7 -L/build/lib -lcompiler_base -lcompiler_ast -lboost_system -lboost_filesystem -lssl -lcrypto
could it not find frontend.so also i have an error related to relocation R_X86_64_32 against although i have added


set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_C_FLAGS "-fPIC")"

in the CMakeLists.txt under fbthrift/thrift/compiler still the same error

how i can move forward in this case

@gbolin
Copy link

gbolin commented Feb 24, 2018

mark, same error.
in thrift/compiler/py/setup.py,
def run_setup(): if sys.argv[1] == 'build': shutil.copy('.libs/frontend.so', 'frontend.so')
where does the .libs come from , administrator?

@rockindy
Copy link

This is my way to solve this issue:

  1. use fbthrift/build$ cmake -DCMAKE_CXX_FLAGS=-fPIC .. to make the project
  2. use this command to compile frontend.so:
    fbthrift$ g++ -I . -I /usr/include/python2.7 -std=c++14 -fPIC -shared -o frontend.so thrift/compiler/py/compiler.cc -L_build/lib -Wl,--start-group -lboost_python -lpython2.7 -lcompiler_base -lcompiler_ast -lboost_system -lboost_filesystem -lssl -lcrypto -Wl,--end-group

@zhangchurong
Copy link

I followed the instructions mentioned above, and copy frontend.so to the thrift_compiler folder,but now I encounter this problem:
[ 5%] Generating thpp/if/gen-cpp2/Tensor_data.h, thpp/if/gen-cpp2/Tensor_types.h, thpp/if/gen-cpp2/Tensor_types.tcc, thpp/if/gen-cpp2/Tensor_constants.h, thpp/if/gen-cpp2/Tensor_data.cpp, thpp/if/gen-cpp2/Tensor_types.cpp, thpp/if/gen-cpp2/Tensor_constants.cpp /usr/bin/python: /usr/local/lib/python2.7/dist-packages/thrift_py-0.9.0-py2.7.egg/thrift_compiler/frontend.so: undefined symbol: _ZN5boost6system6detail25generic_category_instanceE CMakeFiles/thpp.dir/build.make:61: recipe for target 'thpp/if/gen-cpp2/Tensor_data.h' failed
can anyone help me out? thanks a lot!

@vitaut
Copy link
Contributor

vitaut commented Mar 15, 2019

Duplicate of #249.

@vitaut vitaut closed this as completed Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants