Closed ErwanFagnou closed 2 years ago
It's hard to tell what exactly went wrong with your installation without further logs/infos. The circular import does only point towards a problem with the Python-interface (more specific with the cythonized library-bindings). Whenever there is a crash or something similar, this kind of error appears. This should be already triggered by pip3 install networkit
however.
Using Python 3.8 is ok (for Windows we support >3.8 due to some requirements).
Since the release of NetworKit 9.0 we already merged some patches improving the experimental state of the Windows-port. Therefore you might get better results, if you build the master-branch for yourself locally.
git clone https://github.com/networkit/networkit networkit
cd networkit
python3 setup.py build_ext [-jX]
pip3 install -e .
Another possibility is to use the pre-build wheels (sry, only Python 3.9 for win64) created by our CI (will be available by pip3 install
with the next release). Therefore check the latest successful CI run on master like here: https://github.com/networkit/networkit/actions/runs/1493805390#artifacts
Yet another way is to use the (tested) pre-built conda-forge package for Windows: https://anaconda.org/conda-forge/networkit
We can also try to fix the installation problem (might also be insightful for us). If you are interested in going deeper into the rabbit hole - could you post the output of pip install -v networkit
? And also the output of which pip
, which python
, pip --version
and python --version
?
I built it myself, following your instructions, but I still get the same error when importing...
Here are the outputs you requested:
pip install -v networkit
Using pip 21.3.1 from c:\users\r1ben\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)
Collecting networkit
Using cached networkit-9.0-cp38-cp38-win_amd64.whl
Requirement already satisfied: numpy in c:\users\r1ben\appdata\local\programs\python\python38\lib\site-packages (from networkit) (1.21.4)
Requirement already satisfied: scipy in c:\users\r1ben\appdata\local\programs\python\python38\lib\site-packages (from networkit) (1.7.2)
Installing collected packages: networkit
Successfully installed networkit-9.0
where pip
C:\Users\r1ben\AppData\Local\Programs\Python\Python38\Scripts\pip.exe
C:\Users\r1ben\AppData\Local\Programs\Python\Python310\Scripts\pip.exe
C:\Users\r1ben\AppData\Local\Programs\Python\Python37\Scripts\pip.exe
where python
C:\Users\r1ben\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\r1ben\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\r1ben\AppData\Local\Programs\Python\Python37\python.exe
C:\Users\r1ben\AppData\Local\Microsoft\WindowsApps\python.exe
pip --version
pip 21.3.1 from c:\users\r1ben\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)
python --version
Python 3.8.0
I also tried using a venv, with the same results.
As I must use Python 3.8 for my project, the pre-build wheels are not an option for me. And I'll look into the Conda alternative you mentioned. Anyways, thank you for your reactivity!
Only based on the Python-paths you posted, this looks good.
For pip install -v networkit
you have to uninstall networkit before triggering the command (should have mentioned that). Note that the install-log will be rather huge.
In addition to gather more information: Can you post the version of Visual Studio, Windows 10 and basic hardware specs?
I tried an install this morning on a clean Windows 11 up-to-date, Visual Studio CE 2019, Ryzen-CPU based system with Python 3.8.10 (from the official website) and clean pyenv. This works as expected.
Just for the off-chance: Did you name a file In the same directory "graph"?(.py)
This caused a similar error for me a while ago.
@CxVercility I don't, but I have a folder named "graph". However, renaming it didn't change anything. The issue is not with my project structure/content, as I got the errors even in the console.
I ended up using Python 3.9.9 and the pre-built wheel, which worked just fine!
The issue I encountered has something to do with the Python version. I tried the installation with different versions (using pip):
To conclude, Python 3.10 is the only version that worked perfectly. And the 3.9.x versions work fine by installing with the prebuilt wheel.
But I don't really feel like the issue has been solved. Here are the logs of the different errors I had when using Python 3.8.10 (I'm sorry, there is some French text but it should be self explanatory):
As for Visual Studio, I tried with VS Community 2019 (16.11.7) and 2022 (17.0.1). I have Windows 10 version 10.0.19042 (build 19042). My PC is a HP Pavilion Gaming Laptop 15-DK1xxx, the CPU is an Intel Core i5-10300H, the GPU is a NVIDIA GeForce GTX 1650 Ti.
Thanks for gathering all the information. Based on the logs, it seems that for your system python calling the installation and python as detected by cmake is different.
From your logs:
-- Found Python3: C:/Users/r1ben/AppData/Local/Programs/Python/Python310/python.exe (found version "3.10.0") found components: Interpreter Development Development.Module Development.Embed
That is likely why the final package is not working for Python != 3.10. We already fixed this by syncing the detection of Python versions for Python + compiling extensions on master
.
If I understand you correctly, building from source didn't work either for you? It would be interesting to see whether the version-detection still have some flaws on Windows.
I had tried building from source when using Python 3.8.0, but I still had the circular import error. However, I had not tried doing it in 3.8.10. I just did it, and it worked!
So everything is fine (except for the error in older versions of Python 3.8.x) using the current GitHub repository.
I'll close this issue, thank you for your help!
Hi, I have just installed NetworKit on my Windows 10 laptop, following the instructions on the website (installed cython and networkit using pip from the "Native Tools Command Prompt” provided by Visual Studio. It actually worked, the error comes later, when importing networkit in Python:
I am using Python3.8, and here are my package versions:
Any idea where the issue is? The install went just fine, so maybe it's just, as the error said, a circular import? I also tried to remove the "from . import graph" of the "networkit__init__.py" file, but the next imports also raise the same error.