ngs-special-functions and pip

More
1 year 2 months ago #4790 by pbmonk
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!
More
1 year 2 months ago #4792 by joachim
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
 
More
1 year 2 months ago - 1 year 2 months ago #4797 by matthiash
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
Code:
python3 -c "import ngsolve; print(ngsolve.__file__)"
In my case, that's 
Code:
/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 https://github.com/ngsolve/ngs-special-functions.git 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


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
Last edit: 1 year 2 months ago by matthiash. Reason: Code formatting
More
1 year 2 months ago #4798 by pbmonk
 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'
<many lines of messages deleted>
 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

 
More
1 year 2 months ago #4799 by pbmonk
My post overlapped yours Matthias. I will do as you instruct. Thanks!
More
1 year 2 months ago #4800 by matthiash
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
Time to create page: 0.109 seconds