CMU-MS-DAS-Modern-Programming-Mini / ClassAssignmentNo3

Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

AttributeError: module 'scipy' has no attribute 'linalg' #9

Open ellielai opened 3 years ago

ellielai commented 3 years ago

When I am testing the solve_roothan_equations and the form_density_matrix functions, I get that Attribute Error for the tests due to the "mo_energies, mocoeffs = sp.linalg.eigh(Fuv, Suv_)" part within SCF.py, which doesn't make sense to me since I can run main.py perfectly fine?

I updated my fork for you to see if maybe there was something wrong with my code, but I thought I wrote it correctly for both of the tests.

shots47s commented 3 years ago

I ran into this on WSL for some reason, you should change the import to:

import scipy.linalg as sp_la

Then change your eigh call to:

mo_energies, mo_coeffs = sp_la.eigh(Fuv_, Suv_)

I am not sure why this happens, I think it is with newer versions of SciPy, they are enforcing not importing the whole library at once as used to be the convention.

ellielai commented 3 years ago

Ah okay, that worked! Thank you