Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Build from source on Windows

More
3 years 9 months ago #2924 by matthiash
What happens when you do following?

python -c 'import ngsolve'
echo %PYTHONPATH%

Best,
Matthias
More
3 years 9 months ago #2927 by ddrake
Replied by ddrake on topic Build from source on Windows
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
Code:
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:
Code:
$ 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
Code:
$ cd ngsuite/build $ pwd /c/Users/Dow/ngsuite/build $ python -c 'import ngsolve'
So the import succeeds. If I do
Code:
$ echo $PYTHONPATH C:\Users\Dow;C:\Users\Dow\python;
(doesn't have ngsolve).

Now if I open a new 'git bash' shell, I see
Code:
$ 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,
Code:
$ 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
Code:
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
More
3 years 9 months ago #2929 by ddrake
Replied by ddrake on topic Build from source on Windows

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
More
3 years 9 months 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
More
3 years 9 months 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
More
3 years 9 months ago #2936 by ddrake
Replied by ddrake on topic Build from source on Windows
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
Time to create page: 0.180 seconds