Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
scipy.test() fails importing from scipy.stats
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
htInEdin
n00b
n00b


Joined: 06 Jan 2022
Posts: 6

PostPosted: Thu Jan 06, 2022 6:31 pm    Post subject: scipy.test() fails importing from scipy.stats Reply with quote

I just did a complete install of numpy and scipy (after a successful world update). Running scipy.test() fails, and indeed any attempt to import scipy.stats fails:
Code:
:> python3
Python 3.9.9 (main, Jan  5 2022, 08:31:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy.stats
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/stats/__init__.py", line 441, in <module>
    from .stats import *
  File "/lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/stats/stats.py", line 43, in <module>
    from . import distributions
  File "/lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/stats/distributions.py", line 10, in <module>
    from . import _continuous_distns
  File "/lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/stats/_continuous_distns.py", line 22, in <module>
    from . import _stats
  File "_stats.pyx", line 1, in init scipy.stats._stats
ImportError: /lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/special/cython_special.cpython-39-x86_64-linux-gnu.so: undefined symbol: _gfortran_stop_numeric


Couldn't find anything that looks relevant in Bugzilla, but before submitting a bug I thought I'd check here. Is it possible that something is wrong with my setup such that the right fortran library is not being found? As far as I can see that symbol is defined in libgfortran.so...

Thanks

ht
_________________
Using gentoo/startprefix under ubuntu
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6090
Location: Removed by Neddy

PostPosted: Thu Jan 06, 2022 6:46 pm    Post subject: Reply with quote

Code:
py
Python 3.9.9 (main, Nov 21 2021, 11:47:16)
[Clang 13.0.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy.stats
>>>


either python or scipy needs to be rebuilt (or both), you have an abi mismatch somewhere
_________________
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Back to top
View user's profile Send private message
htInEdin
n00b
n00b


Joined: 06 Jan 2022
Posts: 6

PostPosted: Thu Jan 06, 2022 10:38 pm    Post subject: Reply with quote

Naib wrote:
Code:
py
Python 3.9.9 (main, Nov 21 2021, 11:47:16)
[Clang 13.0.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy.stats
>>>


either python or scipy needs to be rebuilt (or both), you have an abi mismatch somewhere


Thanks, but no joy. That is, I
  • Resynced
  • emerge --depclean
  • Did a world update
  • emerge @preserved-rebuild
  • emerge =dev-lang/python-3.9.9
  • emerge dev-python/scipy

Same problem.

I noticed one difference, however.

Your python shows "[Clang 13.0.0]"
My python (now) shows "[GCC 11.2.1 20211127]"

Could that be related to the problem? If so, how did you install your python?

Thanks,

ht
_________________
Using gentoo/startprefix under ubuntu
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6090
Location: Removed by Neddy

PostPosted: Thu Jan 06, 2022 11:18 pm    Post subject: Reply with quote

you might need to rebuild lapack as this is the fortran part that scipy uses. That should bring all ABI in alignment.

As to myself using clang... im just messing around with a clang built system ( 99% of all packages use clang for me) so you using gcc and myself using clang won't be why ( I am a heavy scipy user so used it when I used gcc). HOWEVER... I have rebuilt my entire world a few times while I was converting over and thus all ABI's were 100% aligned. I could have done that with gcc
_________________
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Back to top
View user's profile Send private message
htInEdin
n00b
n00b


Joined: 06 Jan 2022
Posts: 6

PostPosted: Fri Jan 07, 2022 2:01 pm    Post subject: Reply with quote

Naib wrote:
you might need to rebuild lapack as this is the fortran part that scipy uses. That should bring all ABI in alignment.

Still no joy.

I have checked that the missing binding (of _gfortran_stop_numeric) is present in .../gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/libgfortran.so, and that
gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 is present in /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf

So I don't understand how the error is happening:
Code:
ImportError: /lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/special/cython_special.cpython-39-x86_64-linux-gnu.so: undefined symbol: _gfortran_stop_numeric


Just to avoid obvious things, can you just tell me your python, scipy, openblas and lapack versions?

Can anyone report on a successful python-3.9.9 scipy-1.7.3 numpy-1.22.0 lapack-3.10.0 openblas-0.3.19 install?

Thanks for any suggestions, I'm struggling here...

ht
_________________
Using gentoo/startprefix under ubuntu
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2406

PostPosted: Fri Jan 07, 2022 2:51 pm    Post subject: Reply with quote

Can you rebuild numpy (latest revision)? It's possibly related to bug 830630.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6090
Location: Removed by Neddy

PostPosted: Fri Jan 07, 2022 3:53 pm    Post subject: Reply with quote

htInEdin wrote:
Naib wrote:
you might need to rebuild lapack as this is the fortran part that scipy uses. That should bring all ABI in alignment.

Still no joy.

I have checked that the missing binding (of _gfortran_stop_numeric) is present in .../gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/libgfortran.so, and that
gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1 is present in /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf

So I don't understand how the error is happening:
Code:
ImportError: /lustre/home/dc007/hst/gentoo/usr/lib/python3.9/site-packages/scipy/special/cython_special.cpython-39-x86_64-linux-gnu.so: undefined symbol: _gfortran_stop_numeric


Just to avoid obvious things, can you just tell me your python, scipy, openblas and lapack versions?

Can anyone report on a successful python-3.9.9 scipy-1.7.3 numpy-1.22.0 lapack-3.10.0 openblas-0.3.19 install?

Thanks for any suggestions, I'm struggling here...

ht


Code:

merge -pv python:3.9 scipy numpy lapack openblas

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/python-3.9.9:3.9::gentoo  USE="gdbm lto ncurses pgo readline sqlite ssl tk xml -bluetooth -build -examples -hardened -test -verify-sig -wininst" 0 KiB
[ebuild  N     ] sci-libs/openblas-0.3.19::gentoo  USE="eselect-ldso openmp -dynamic -index-64bit -pthread -relapack -test" 12,409 KiB
[ebuild   R    ] sci-libs/lapack-3.10.0::gentoo  USE="eselect-ldso -deprecated -doc -lapacke -test" 0 KiB
[ebuild     U  ] dev-python/numpy-1.22.0-r1::gentoo [1.22.0::gentoo] USE="lapack -doc -test" PYTHON_TARGETS="python3_9 -python3_8 -python3_10" 0 KiB
[ebuild   R    ] dev-python/scipy-1.7.3::gentoo  USE="pythran -doc -sparse -test" PYTHON_TARGETS="python3_9 -python3_8 -python3_10" 0 KiB

Total: 5 packages (1 upgrade, 1 new, 3 reinstalls), Size of downloads: 12,409 KiB
[jrb:~] $ eselect blas list
Available BLAS/CBLAS (lib) candidates:
  (none found)
Available BLAS/CBLAS (lib64) candidates:
  [1]   reference *

_________________
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Back to top
View user's profile Send private message
htInEdin
n00b
n00b


Joined: 06 Jan 2022
Posts: 6

PostPosted: Fri Jan 07, 2022 6:37 pm    Post subject: Reply with quote

Naib wrote:

Code:

merge -pv python:3.9 scipy numpy lapack openblas

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/python-3.9.9:3.9::gentoo  USE="gdbm lto ncurses pgo readline sqlite ssl tk xml -bluetooth -build -examples -hardened -test -verify-sig -wininst" 0 KiB
[ebuild  N     ] sci-libs/openblas-0.3.19::gentoo  USE="eselect-ldso openmp -dynamic -index-64bit -pthread -relapack -test" 12,409 KiB
[ebuild   R    ] sci-libs/lapack-3.10.0::gentoo  USE="eselect-ldso -deprecated -doc -lapacke -test" 0 KiB
[ebuild     U  ] dev-python/numpy-1.22.0-r1::gentoo [1.22.0::gentoo] USE="lapack -doc -test" PYTHON_TARGETS="python3_9 -python3_8 -python3_10" 0 KiB
[ebuild   R    ] dev-python/scipy-1.7.3::gentoo  USE="pythran -doc -sparse -test" PYTHON_TARGETS="python3_9 -python3_8 -python3_10" 0 KiB

Total: 5 packages (1 upgrade, 1 new, 3 reinstalls), Size of downloads: 12,409 KiB
[jrb:~] $ eselect blas list
Available BLAS/CBLAS (lib) candidates:
  (none found)
Available BLAS/CBLAS (lib64) candidates:
  [1]   reference *


Bingo! Rebuilding in that order fixed it. Hope this helps someone else in the same situation as me...

Thanks very much,

ht
_________________
Using gentoo/startprefix under ubuntu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum