Build from source on Windows

1 week 3 days ago #2924 by matthiash
What happens when you do following?

python -c 'import ngsolve'
echo %PYTHONPATH%

Best,
Matthias

Please Log in or Create an account to join the conversation.

1 week 2 days ago #2927 by ddrake
I think the issue may be that the PYTHONPATH did not get sourced in the 'git bash' mingw shell I used to do the build. Maybe if I closed and re-opened the shell after doing
cmake --build . --config Release --target set_environment_variables
but before doing the install step it would work? I can try that.

In the mingw shell I used to perform the (failed) build, if I cd to my home directory:
$ pwd
/c/Users/Dow
$ python -c 'import ngsolve'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ngsolve'
If I go back to the build directory and try, I get
$ cd ngsuite/build
$ pwd
/c/Users/Dow/ngsuite/build
$ python -c 'import ngsolve'
So the import succeeds. If I do
$ echo $PYTHONPATH
C:\Users\Dow;C:\Users\Dow\python;
(doesn't have ngsolve).

Now if I open a new 'git bash' shell, I see
$ echo $PYTHONPATH
C:\Users\Dow\ngsuite\install\;C:\Users\Dow;C:\Users\Dow\python;
so the environment variable is set, but in that same shell,
$ python -c 'import ngsolve'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ngsolve'
unless I cd to the build directory.

I see this same behavior if I open a regular command terminal
C:\Users\Dow>python -c "import ngsolve"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ngsolve'

C:\Users\Dow>cd ngsuite/build
C:\Users\Dow\ngsuite\build>python -c "import ngsolve"

C:\Users\Dow\ngsuite\build>echo %PYTHONPATH%
C:\Users\Dow\ngsuite\install\;C:\Users\Dow;C:\Users\Dow\python;

Best,
Dow

Please Log in or Create an account to join the conversation.

1 week 2 days ago #2929 by ddrake

Maybe if I closed and re-opened the shell after doing
cmake --build . --config Release --target set_environment_variables
but before doing the install step it would work? I can try that.

I tried this just now, but got the same error in the install step

Best,
Dow

Please Log in or Create an account to join the conversation.

1 week 2 days ago #2930 by matthiash
Hi Dow,

In your case, PYTHONPATH should have the value
C:/UsersDow/ngsuite/install/Lib/site-packages
This is where the python packages/modules are installed. (See the output.txt you sent).

I will test on Windows if there is an issue with the set_environment_variables target in
CMake.

Best,
Matthias

Please Log in or Create an account to join the conversation.

1 week 2 days ago #2935 by matthiash
Hi Dow,

I just tried it on Windows and it seems there is a problem with Python 3.8 (might be releated to Tcl/Tk).
Please downgrade to Python 3.7 and try again.

Best,
Matthias
The following user(s) said Thank You: ddrake

Please Log in or Create an account to join the conversation.

1 week 2 days ago #2936 by ddrake
Thanks, Matthias! Downgrading to Python 3.7 eliminated the build error.

Then to get things working, I just had to
add %NETGENDIR% to my path and
add C:\Users\dow\ngsuite\install\lib\site-packages to my PYTHONPATH

Best,
Dow

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve