Hi,
I am using Python 3.8.5 on Windows 8 . I installed igraph by “pip install python-igraph”. I run “import igraph” inPython, I got the error as the following. Could you please give any help?
import igraph
Traceback (most recent call last):
File “”, line 1, in
File “C:\ProgramData\Anaconda3\lib\site-packages\igraph_init_.py”, line 31,
in
from igraph._igraph import (
ImportError: DLL load failed while importing _igraph: The specified module could not be found
Best retgards,
Jennifer
I downloaded igraph 0.8 “python_igraph-0.8.0-cp38-cp38-win_amd64.whl” , and it works.
import igraph
print(igraph.version)
0.8.0
from igraph import *
g = Graph()
print(g)
IGRAPH U— 0 0 –
Good to see this works with version 0.8.0. Could you please report with which version this did not work for you? Presumably it also works with other 0.8.x versions, but perhaps not with version 0.9.0?
Hi vtrag,
It does not work with 0.9.0 - “python_igraph-0.9.0-cp38-cp38-win_amd64.whl”.
This is pure guesswork, but worth a try: Install the latest VC redistributables, restart Python, and see if it works. The latest supported Visual C++ downloads Please let us know how it went.
It’s good to note that Windows 8.1 support ended over 3 years ago and Windows 8 support over 5 years ago.
@hongn.zhu It would be very useful for us if you could let us know whether my last suggestion (i.e. installing VC++ redistributables) solved the issue for you.
The solution is to provide the python interpreter with the path-to-your-module. The simplest solution is to append that python path to your sys.path list. In your notebook, first try:
import sys
sys.path.append('my/path/to/module/folder')
This isn’t a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.
The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.
from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../ #each path must be separated by a colon
@romankris Did you get the exact same error as @hongn.zhu described? If not, please describe the problem that you are proposing a solution to, in order to avoid confusing future readers.
I expect that PYTHONPATH was correct for @hongn.zhu, as igraph as well the python-igraph shared library did begin to load. It was only loading one of its DLL dependencies that failed. I expect this dependency had to be the VC++ runtime (as there isn’t really any other). It’s a pity that @hongn.zhu did not respond and let us know if the fix I proposed worked.
Hi,
I uninstalled igraph 0.8 and installed iGraph latest version by pip install python-igraph
. import igraph
still does not work.
(base) C:\Users\Oliver Zhang>pip uninstall python-igraph
Found existing installation: python-igraph 0.8.0
Uninstalling python-igraph-0.8.0:
Would remove:
c:\programdata\anaconda3\include\python-igraph\igraphmodule_api.h
c:\programdata\anaconda3\lib\site-packages\igraph\*
c:\programdata\anaconda3\lib\site-packages\python_igraph-0.8.0.dist-info\*
c:\programdata\anaconda3\scripts\igraph
Proceed (y/n)? y
Successfully uninstalled python-igraph-0.8.0
(base) C:\Users\Oliver Zhang>pip install python-igraph
Collecting python-igraph
Downloading python_igraph-0.9.1-cp38-cp38-win_amd64.whl (2.3 MB)
....
Requirement already satisfied: texttable>=1.6.2 in c:\programdata\anaconda3\lib\
site-packages (from python-igraph) (1.6.3)
Installing collected packages: python-igraph
Successfully installed python-igraph-0.9.1
(base) C:\Users\Oliver Zhang>python
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Ana
conda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site.py", line 440, in register_readline
readline.read_history_file(history)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyreadline\rlmain.py", line 1
65, in read_history_file
self.mode._history.read_history_file(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyreadline\lineeditor\history
.py", line 82, in read_history_file
for line in open(filename, 'r'):
UnicodeDecodeError: 'gbk' codec can't decode byte 0x89 in position 1003: illegal
multibyte sequence
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\igraph\__init__.py", line 26,
in <module>
from igraph._igraph import (
ImportError: DLL load failed while importing _igraph: The specified module could
not be found.
Best regards,
Jennifer
I gave a specific suggestion above, and asked you several times to try it and report back if it fixed the problem. I do not think we can make progress on this issue unless you provide this information.
Hi,
I add igraph related paths and tried again. It still does not work. Please have a look at the following:
import sys
sys.path.append(‘C:\ProgramData\Anaconda3\Lib\site-packages\igraph’)
sys.path.append(‘C:\ProgramData\Anaconda3\Lib\site-packages\python_igra
ph-0.9.1.dist-info’)
sys.path.append(‘C:\ProgramData\Anaconda3\include\python-igraph’)
sys.path.append(‘C:\ProgramData\Anaconda3\Scripts\igraph’)
sys.path
[‘’, ‘C:\ProgramData\Anaconda3\python38.zip’, ‘C:\ProgramData\Anaconda3\DL
Ls’, ‘C:\ProgramData\Anaconda3\lib’, ‘C:\ProgramData\Anaconda3’, ‘C:\Progr
amData\Anaconda3\lib\site-packages’, ‘C:\ProgramData\Anaconda3\lib\site-p
ackages\win32’, ‘C:\ProgramData\Anaconda3\lib\site-packages\win32\lib’, ’
C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin’, ‘C:\ProgramData\An
aconda3\Lib\site-packages\igraph’, ‘C:\ProgramData\Anaconda3\Lib\site-pac
kages\python_igraph-0.9.1.dist-info’, ‘C:\ProgramData\Anaconda3\include\pyt
hon-igraph’, ‘C:\ProgramData\Anaconda3\Scripts\igraph’]
import igraph
Traceback (most recent call last):
File “”, line 1, in
File “C:\ProgramData\Anaconda3\lib\site-packages\igraph_init_.py”, line 26,
in
from igraph._igraph import (
ImportError: DLL load failed while importing _igraph: The specified module could
not be found.
Best regards,
Jennifer
@hongn.zhu, as I said above, PYTHONPATH has nothing to do with this problem. This is what you need to do:
Hi,
Could you please tell me which Visual C++ should be downloaded? My PC is Windows 8.1.
Visual Studio 2015, 2017 and 2019## Visual Studio 2013 (VC++ 12.0)## Visual Studio 2012 (VC++ 11.0)## Visual Studio 2010 (VC++ 10.0) SP1## Visual Studio 2008 (VC++ 9.0) SP1
Best regards,
Jennifer
If you have a 64-bit system (likely), download vc_redist.x64.exe from the first section.
If you have a 32-bit system, download vc_redist.x86.exe
Do not download Visual Studio, just the redistributable packages.
Hi,
It works with “vc_redist.x64.exe”. Thanks a lot!
(base) C:\Users\Oliver Zhang>python
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Ana
conda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.
Failed calling sys.interactivehook
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site.py”, line 440, in register_readline
readline.read_history_file(history)
File “C:\ProgramData\Anaconda3\lib\site-packages\pyreadline\rlmain.py”, line 1
65, in read_history_file
self.mode._history.read_history_file(filename)
File “C:\ProgramData\Anaconda3\lib\site-packages\pyreadline\lineeditor\history
.py”, line 82, in read_history_file
for line in open(filename, ‘r’):
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0x89 in position 1003: illegal
multibyte sequence
import igraph
print(igraph.version)
0.9.1
Best regards,
Jennifer
1 Like