pytorch / extension-ffi

Examples of C extensions for PyTorch
258 stars 70 forks source link

Package test does not work #1

Closed bpiwowar closed 7 years ago

bpiwowar commented 7 years ago

I was trying to play around with the package, but it reports errors


======================================================================
ERROR: my_lib (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: my_lib
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/Users/bpiwowar/development/pytorch/extension-ffi/package/my_package/_ext/my_lib/__init__.py", line 3, in <module>
    from ._my_lib import lib as _lib, ffi as _ffi
ModuleNotFoundError: No module named 'my_package._ext.my_lib._my_lib'

I also tried to install the package to see if it solved the problem, but it didn't

PYTHONPATH=$(pwd)/lib/python3.6/site-packages python3 setup.py install --prefix=$(pwd)

[...] OK

PYTHONPATH=$(pwd)/lib/python3.6/site-packages python3 test/test.py
Traceback (most recent call last):
  File "test/test.py", line 4, in <module>
    from my_package.modules.add import MyAddModule
  File "/Users/bpiwowar/development/pytorch/extension-ffi/package/lib/python3.6/site-packages/my_package-0.1-py3.6-macosx-10.12-x86_64.egg/my_package/modules/add.py", line 2, in <module>
    from ..functions.add import MyAddFunction
  File "/Users/bpiwowar/development/pytorch/extension-ffi/package/lib/python3.6/site-packages/my_package-0.1-py3.6-macosx-10.12-x86_64.egg/my_package/functions/add.py", line 4, in <module>
    from .._ext import my_lib
  File "/Users/bpiwowar/development/pytorch/extension-ffi/package/lib/python3.6/site-packages/my_package-0.1-py3.6-macosx-10.12-x86_64.egg/my_package/_ext/my_lib/__init__.py", line 3, in <module>
    from ._my_lib import lib as _lib, ffi as _ffi
ModuleNotFoundError: No module named 'my_package._ext.my_lib._my_lib'
apaszke commented 7 years ago

Ok, should be fixed. Can you try again now?

apaszke commented 7 years ago

(You'll need both pytorch and extension-ffi from master)

bpiwowar commented 7 years ago

OK this is fixed, thanks

wyhcqq commented 5 years ago

(You'll need both pytorch and extension-ffi from master) How can I do ? ModuleNotFoundError: No module named 'my_package._ext.my_lib._my_lib'

wyhcqq commented 5 years ago

Ok, should be fixed. Can you try again now?

can you tell me how to solve this problem, thank you