Ngs-special-functions and pip

I have installed NGSolve on a Mac using pip and all is working well. But I would like to use
ngs-special-functions
I got the code from GitHub but it would not compile (which makes sense since I have no build folders for NGSolve). Is there any way to get access to special functions when NGSolve is installed via pip? I want to use Hankel functions in a scattering code.

Thanks!

Hi Peter,

it should work with the pip installer. It installs the ngsolve header files as well.
Make sure to rerun cmake after re-installung ngsolve, or updating the xcode compiler.

What are the errors you get ?

Joachim

Hi Peter,

It’s possible to get it running with the pip version, you just need to point CMake to the right directories.
To find out, where netgen/ngsolve is installed, run

python3 -c "import ngsolve; print(ngsolve.__file__)"

In my case, that’s /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ngsolve/__init__.py

Now take the directory above and add ‘cmake’, this is where CMake finds the build configuration (same applies for netgen).
The final build call looks like this:

[code]git clone GitHub - NGSolve/ngs-special-functions: Add special functions of SLATEC (http://www.netlib.org/slatec/) to NGSolve
cd ngs-special-functions
mkdir build
cd build

cmake …
-DNGSolve_DIR=/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ngsolve/cmake
-DNetgen_DIR=/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netgen/cmake
make -j4[/code]

Make sure to run cmake in an empty directory (remove files created by cmake before), otherwise the install dir is not set correctly.

Best,
Matthias

Hi Joachim, thanks for looking into this.

I worked on this some more and I see the header files that cmake is looking for in/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ngsolve/cmake/NGSolveConfig.cmake
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/netgen/cmake

so I tried

export CMAKE_PREFIX_PATH=“/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages:/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/netgen:${CMAKE_PREFIX_PATH}”
cmake …
make -j4

make ran OK but I got this error message from make

make -j4
[ 4%] Performing update step for ‘project_f2c’
[ 8%] No patch step for ‘project_f2c’
[ 12%] Performing configure step for ‘project_f2c’

Consolidate compiler generated dependencies of target special_functions[100%] Built target special_functions
Install the project…
– Install configuration: “Release”
CMake Error at cmake_install.cmake:41 (file):
file cannot create directory: /usr/local/ngsolve. Maybe need administrative privileges.
make[3]: *** [install] Error 1
make[2]: *** [project_ngsolve_specialcfs-prefix/src/project_ngsolve_specialcfs-stamp/project_ngsolve_specialcfs-install] Error 2
make[1]: *** [CMakeFiles/project_ngsolve_specialcfs.dir/all] Error 2
make: *** [all] Error 2

My post overlapped yours Matthias. I will do as you instruct. Thanks!

The error you got at the end is what I mentioned with the install directory. Just start in a clean directory and it should work.

Best,
Matthias

Thanks very much! Building in a clean download of the package using your instructions worked perfectly.