Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserWarning: mkl-service package failed to import in the import example #41

Closed
Lancashire3000 opened this issue Jan 12, 2022 · 3 comments

Comments

@Lancashire3000
Copy link

Lancashire3000 commented Jan 12, 2022

Hi,

I tried to do the example about import in https://github.com/ylikx/forpy#import-a-python-module-in-fortran

By gfortran -c forpy_mod.F90
and gfortran py-import.f90 forpy_mod.o python3-config --ldflags --embed -fno-lto -static-libgfortran (I named the file as py-import.f90 )

then run a.out, I got

/home/user/intel/oneapi/intelpython/latest/envs/idp-2/lib/python3.8/site-packages/numpy/__init__.py:159: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7fd9f1b886aa
#1  0x7fd9f1b87fb5
#2  0x7fd9f14f620f
#3  0x7fd9f1a4e17e
#4  0x7fd9f1afd2a4
#5  0x7fd9f1ae1f08
#6  0x7fd9f1ae2137
#7  0x7fd9f14d70b2
#8  0x7fd9f1ae1ddd
#9  0xffffffffffffffff
Segmentation fault (core dumped)

My python 3.8.11 is from https://software.intel.com/en-us/python-distribution and https://www.intel.com/content/www/us/en/developer/articles/technical/using-intel-distribution-for-python-with-anaconda.html, not sure if intel-python has any issue with forpy

@Lancashire3000
Copy link
Author

Lancashire3000 commented Jan 12, 2022

If I create a new conda environment with python=3.8, conda install -c conda-forge fypp, then
gfortran -c forpy_mod.F90
gfortran py-import.f90 forpy_mod.o python3-config --ldflags --embed -fno-lto
./a.out

I got

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f6437c31700 in ???
#1  0x7f6437c308a5 in ???
#2  0x7f643790620f in ???
#3  0x7f64380a544e in PyObject_GetAttr
#4  0x7f6438153ed4 in __forpy_mod_MOD_object_getattribute
#5  0x7f6438138b38 in MAIN__
#6  0x7f6438138d67 in main
Segmentation fault (core dumped)

@ylikx
Copy link
Owner

ylikx commented Jan 13, 2022

Anaconda changed how its cpython is built. This should help: #25

@Lancashire3000
Copy link
Author

Thank you so much! gfortran py-import.f90 forpy_mod.o python3-config --ldflags --embed -fno-lto -static-libgfortran -Xlinker -export-dynamic
leads to Today is 2022-01-13
It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants