Forum Message



We have moved the forum to . 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.


The forum is in read only mode.

ngs-special-functions and pip

5 months 2 days ago #4790 by pbmonk
I have installed NGSolve on a Mac using pip and all is working well.  But I would like to use 
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.

5 months 1 day 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 ? 

5 months 1 day ago - 5 months 1 day 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
python3 -c "import ngsolve; print(ngsolve.__file__)"
In my case, that's 

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:
git clone 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.

Last edit: 5 months 1 day ago by matthiash. Reason: Code formatting
5 months 1 day 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

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

5 months 1 day ago #4799 by pbmonk
My post overlapped yours Matthias. I will do as you instruct. Thanks!
5 months 1 day 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.

Time to create page: 0.144 seconds