vislearn/ngransac

Not import Successfully.

DRjy opened this issue · 5 comments

DRjy commented

After I run python setup.py install, it shows install successfully, as follows:

Detected active conda environment: D:\Programs\Anaconda3\envs\torch12
Assuming OpenCV dependencies in:
D:\Programs\Anaconda3\envs\torch12/Library/include
D:\Programs\Anaconda3\envs\torch12/Library/lib
running install
running bdist_egg
running egg_info
writing ngransac.egg-info\PKG-INFO
writing dependency_links to ngransac.egg-info\dependency_links.txt
writing top-level names to ngransac.egg-info\top_level.txt
reading manifest file 'ngransac.egg-info\SOURCES.txt'
writing manifest file 'ngransac.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.7\ngransac.cp37-win_amd64.pyd -> build\bdist.win-amd64\egg
creating stub loader for ngransac.cp37-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\ngransac.py to ngransac.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying ngransac.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying ngransac.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying ngransac.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying ngransac.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
pycache.ngransac.cpython-37: module references file
creating 'dist\ngransac-0.0.0-py3.7-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing ngransac-0.0.0-py3.7-win-amd64.egg
creating d:\programs\anaconda3\envs\torch12\lib\site-packages\ngransac-0.0.0-py3.7-win-amd64.egg
Extracting ngransac-0.0.0-py3.7-win-amd64.egg to d:\programs\anaconda3\envs\torch12\lib\site-packages
Adding ngransac 0.0.0 to easy-install.pth file

Installed d:\programs\anaconda3\envs\torch12\lib\site-packages\ngransac-0.0.0-py3.7-win-amd64.egg
Processing dependencies for ngransac==0.0.0
Finished processing dependencies for ngransac==0.0.0

But, when I run import ngransac, it shows:

ImportError: DLL load failed: The specified module could not be found.

After I locate the location of ngransac, the sturcture of directory is as follows:

image
image

Can you help me? Thanks in advance!
@ebrach

DRjy commented

Strangely, I run the command line python setup.py install in the window of x64 Native Tools Command Prompt for VS 2019. the values of opencv_lib_dir and opencv_inc_dir are given in advance, which is generated from the opencv 3.4.2 source code by building using VS2019. So the generated lib files has the version number. But I run the python setup.py install , it shows cannot open 'opencv_core.lib', so I copy the file "opencv_core342.lib" and rename "opencv_core.lib", is that the reason?@ebrach @ardizzone

Hi,

I'm working under Linux, and cannot give support for Windows and/or Visual Studio. Firstly, you should pin down which module cannot be loaded. The NGRANSAC module itself, or a dependency of NGRANSAC like OpenCV.

Best,
Eric

DRjy commented

I run in the torch12cpu environment, the error of run python setup.py build is as follows:

Finished generating code
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "D:\Programs\Anaconda3\envs\torch12cpu\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached

My best guess is that this issue is not related to ngransac itself, but to some incompatibility among other packages on your system. Searching for your error suggest that e.g. the Numpy version could be an issue, but the cause might as well be some other package.

To trace the problem, you could try to create a minimal C++ extension according to the following PyTorch tutorial to see whether building such extensions work in principle on your system: https://pytorch.org/tutorials/advanced/cpp_extension.html