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

ImportError: No module named _dilation #12

Open
jasan001 opened this issue Jan 7, 2018 · 3 comments
Open

ImportError: No module named _dilation #12

jasan001 opened this issue Jan 7, 2018 · 3 comments

Comments

@jasan001
Copy link

jasan001 commented Jan 7, 2018

(caffe) wmdeMacBook-Pro:science_rcn-master wm$ python science_rcn/run.py
Traceback (most recent call last):
File "science_rcn/run.py", line 27, in
from inference import test_image
File "/Users/wm/workspace/RCN/science_rcn-master/science_rcn/inference.py", line 15, in
from dilation.dilation import dilate_2d
File "/Users/wm/workspace/RCN/science_rcn-master/science_rcn/dilation/dilation.py", line 4, in
from _dilation import max_filter1d, brute_max_filter1d
ImportError: No module named _dilation

@kiyse0713
Copy link

kiyse0713 commented Jan 30, 2018

I have received the same question, have you found any method to solve it?

@mikecheninoulu
Copy link

mikecheninoulu commented Mar 1, 2018

I also meet this problem when I try to modify this RCN, and I find that the _dilation is defined in the setup.py file, as:
# Setup C extensions dilation_module = Extension( '_dilation', sources=['science_rcn/dilation/dilation.cc'], )

Actually, dilation.cc is a library in C language written by RCN team, so python cannot import it directly. We have to setup.py it or make it (2 ways to go offered by this project).
so you have two choices,

  1. If you wanna directly use RCN, just run the setup.py or 'make' according to the readme before you use this RCN, in order to compile and setup the dilation library.

  2. If you wanna badly modify this RCN code, find the corresponding part in setup and change them as you wish to call the dilation.cc library. The related code is here:
    from setuptools import setup, find_packages, Extension
    # Setup C extensions
    dilation_module = Extension( '_dilation', sources=['science_rcn/dilation/dilation.cc'], )
    setup( ext_modules=[dilation_module], )
    then, make the file and nailed it.

But, I still face one problem that I can't debug it step by step as it seems that the _dilation can only be called as a whole.

@gxwangupc
Copy link

I also meet this problem when I try to modify this RCN, and I find that the _dilation is defined in the setup.py file, as:
# Setup C extensions dilation_module = Extension( '_dilation', sources=['science_rcn/dilation/dilation.cc'], )

Actually, dilation.cc is a library in C language written by RCN team, so python cannot import it directly. We have to setup.py it or make it (2 ways to go offered by this project).
so you have two choices,

  1. If you wanna directly use RCN, just run the setup.py or 'make' according to the readme before you use this RCN, in order to compile and setup the dilation library.
  2. If you wanna badly modify this RCN code, find the corresponding part in setup and change them as you wish to call the dilation.cc library. The related code is here:
    from setuptools import setup, find_packages, Extension
    # Setup C extensions
    dilation_module = Extension( '_dilation', sources=['science_rcn/dilation/dilation.cc'], )
    setup( ext_modules=[dilation_module], )
    then, make the file and nailed it.

But, I still face one problem that I can't debug it step by step as it seems that the _dilation can only be called as a whole.

Helpful.Thank you very much.

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

4 participants