xmlyqing00 / Cholmod-Scikit-Sparse-Windows

Set up cholmod and scikit-sparse python package on Windows.
GNU General Public License v3.0
38 stars 11 forks source link

ModuleNotFoundError: No module named 'sksparse.cholmod' #1

Closed davidchieregato closed 5 years ago

davidchieregato commented 5 years ago

Hello I can follow all the installation steps apparently succesfully but when I try to use the library in python it is not found: the import from sksparse.cholmod import cholesky returns ModuleNotFoundError: No module named 'sksparse.cholmod' I am using Windows 10 x64 with Anaconda 3 and Visual Studio 2017. I can use the compiled packages in Visual Studio C++ projects so the issue is probably in the python installation script.

(base) C:\Users\david\Downloads\Cholmod-Scikit-Sparse-Windows-master\scikit-sparse-0.4.3>python setup.py build running build running build_py UPDATING build\lib.win-amd64-3.7\sksparse/_version.py set build\lib.win-amd64-3.7\sksparse/_version.py to '0.4.3' running build_ext skipping 'sksparse\cholmod.c' Cython extension (up-to-date) Install:


(base) C:\Users\david\Downloads\Cholmod-Scikit-Sparse-Windows-master\scikit-sparse-0.4.3>python setup.py install
running install
running bdist_egg
running egg_info
writing scikit_sparse.egg-info\PKG-INFO
writing dependency_links to scikit_sparse.egg-info\dependency_links.txt
writing requirements to scikit_sparse.egg-info\requires.txt
writing top-level names to scikit_sparse.egg-info\top_level.txt
reading manifest file 'scikit_sparse.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README'
no previously-included directories found matching 'doc\_build'
warning: manifest_maker: MANIFEST.in, line 5: 'prune' expects a single <dir_pattern>

warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'scikit_sparse.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
UPDATING build\lib.win-amd64-3.7\sksparse/_version.py
set build\lib.win-amd64-3.7\sksparse/_version.py to '0.4.3'
running build_ext
skipping 'sksparse\cholmod.c' Cython extension (up-to-date)
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\sksparse
copying build\lib.win-amd64-3.7\sksparse\cholmod.cp37-win_amd64.pyd -> build\bdist.win-amd64\egg\sksparse
copying build\lib.win-amd64-3.7\sksparse\provamatrix4.py -> build\bdist.win-amd64\egg\sksparse
copying build\lib.win-amd64-3.7\sksparse\test_cholmod.py -> build\bdist.win-amd64\egg\sksparse
creating build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\illc1033.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\illc1033_rhs1.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\illc1850.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\illc1850_rhs1.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\well1033.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\well1033_rhs1.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\well1850.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\test_data\well1850_rhs1.mtx.gz -> build\bdist.win-amd64\egg\sksparse\test_data
copying build\lib.win-amd64-3.7\sksparse\_version.py -> build\bdist.win-amd64\egg\sksparse
copying build\lib.win-amd64-3.7\sksparse\__init__.py -> build\bdist.win-amd64\egg\sksparse
byte-compiling build\bdist.win-amd64\egg\sksparse\provamatrix4.py to provamatrix4.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\sksparse\test_cholmod.py to test_cholmod.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\sksparse\_version.py to _version.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\sksparse\__init__.py to __init__.cpython-37.pyc
creating stub loader for sksparse\cholmod.cp37-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\sksparse\cholmod.py to cholmod.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying scikit_sparse.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying scikit_sparse.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying scikit_sparse.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying scikit_sparse.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying scikit_sparse.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...
sksparse.__pycache__.cholmod.cpython-37: module references __file__
creating 'dist\scikit_sparse-0.4.3-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 scikit_sparse-0.4.3-py3.7-win-amd64.egg
removing 'c:\users\david\anaconda3\lib\site-packages\scikit_sparse-0.4.3-py3.7-win-amd64.egg' (and everything under it)
creating c:\users\david\anaconda3\lib\site-packages\scikit_sparse-0.4.3-py3.7-win-amd64.egg
Extracting scikit_sparse-0.4.3-py3.7-win-amd64.egg to c:\users\david\anaconda3\lib\site-packages
scikit-sparse 0.4.3 is already the active version in easy-install.pth

Installed c:\users\david\anaconda3\lib\site-packages\scikit_sparse-0.4.3-py3.7-win-amd64.egg
Processing dependencies for scikit-sparse==0.4.3
Searching for scipy==1.2.1
Best match: scipy 1.2.1
Adding scipy 1.2.1 to easy-install.pth file

Using c:\users\david\anaconda3\lib\site-packages
Searching for numpy==1.16.2
Best match: numpy 1.16.2
Adding numpy 1.16.2 to easy-install.pth file
Installing f2py-script.py script to C:\Users\david\Anaconda3\Scripts
Installing f2py.exe script to C:\Users\david\Anaconda3\Scripts

Using c:\users\david\anaconda3\lib\site-packages
Finished processing dependencies for scikit-sparse==0.4.3```
xmlyqing00 commented 5 years ago

Thank you for your reports. That's weird. Please check the following suggestions:

  1. Your installation is using python setup.py install. When you enter from sksparse.cholmod import cholesky, do you use the same python interpreter?

  2. Maybe you can check pip list (with the same python interpreter) to check whether you can see scikit-sparse or not.

davidchieregato commented 5 years ago

pip list will return a long list including scikit-sparse 0.4.3 I have only one python interpreter installed, it's anaconda 3 with python 3.7.3 The situation is actually really strange

xmlyqing00 commented 5 years ago

Yes, that's really strange. It is difficult for me to simulate your environment. Here are some other possible solutions:

  1. Re-run python setup.py install. Maybe it will print something like requirements is already satisfied.
  2. import sys, and print (sys.path). It will print a list of python modules searching path. Your log says the sksparse module is installed in c:\users\david\anaconda3\lib\site-packages\. Check whether this address is in the sys.path.
  3. If not, please add such site-packages path to your system environment. You can search on google for details. Maybe rebooting is required.
  4. Go to c:\users\david\anaconda3\lib\site-packages\ and check there exists a folder named scikit_sparse (or something like this).
  5. Go to python console, type help('modules'), you could see a list of available modules. If everything works well, you are supposed to see sksparse.
  6. Last solution, add the sksparse path temporally to your project by sys.path.append("path/to/module") before import it.

Feel free to ask me any questions.

ThomasPellegrini commented 5 years ago

Hi I have a problem with: python setup.py build The error is: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe failed with exit status 1181

I am using Windows 10 x64 with Anaconda 3 and Visual Studio 2017.

xmlyqing00 commented 5 years ago

Hi I have a problem with: python setup.py build The error is: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe failed with exit status 1181

I am using Windows 10 x64 with Anaconda 3 and Visual Studio 2017.

@ThomasPellegrini Hi, Thank you for your interest. Could you please open a new issue and provide more details about your problem?

xmlyqing00 commented 5 years ago

@stnoh fixed this bug yesterday. You can try the latest codes.

lzcchl commented 2 years ago

@davidchieregato I got this error, but after restart cmd and rerun "from sksparse.cholmod import cholesky", it is ok!

xmlyqing00 commented 2 years ago

@davidchieregato I got this error, but after restart cmd and rerun "from sksparse.cholmod import cholesky", it is ok!

So, no error now? I'm glad this repository still helps many people.