You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sasmodel not supporting numpy 2.x, re-check when available #100
===================================================== ERRORS ======================================================
_______________________________________ ERROR collecting tests/test_sas.py ________________________________________
tests/test_sas.py:66: in <module>
from sasmodels.core import load_model, load_model_info
/Users/imac/miniconda3/envs/srfit_env/lib/python3.11/site-packages/sasmodels/core.py:22: in <module>
from . import generate
/Users/imac/miniconda3/envs/srfit_env/lib/python3.11/site-packages/sasmodels/generate.py:173: in <module>
from .modelinfo import Parameter
/Users/imac/miniconda3/envs/srfit_env/lib/python3.11/site-packages/sasmodels/modelinfo.py:82: in <module>
def parse_parameter(name, units='', default=np.NaN,
/Users/imac/miniconda3/envs/srfit_env/lib/python3.11/site-packages/numpy/__init__.py:400: in __getattr__
raise AttributeError(
E AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.
This issue is not relevant anymore. I've done a global search for print(load_model_info("ellipsoid")) and sasmodels.core, and I was not able to find any results. So this issue can be closed.
But on a side note, it's a bit unclear to me what the tests are trying to import. First, the tests in test_sas.py are being skipped because the has_sas() function is returning false in conftest.py. Inside has_sas(), it tries to import sas.pr.invertor and sas.models, which both fail even when I have sasmodels installed in my conda environment. sasview cannot be installed because it only supports up to python 3.11, and diffpy.srfit supports up to python 3.13. Should it be trying to import sasmodels.models instead? I see that it should exist according to the github repo at this link: https://github.com/SasView/sasmodels/tree/master/sasmodels/models
I'm not quite sure about sas.pr.invertor though.
that is exactly what this issue is about. We are skipping them because we can't load the sas feature and we can't load it because it is incompatible with our new build environment. So the task is to check that dependency and to see if the maintainers have pushed out a new release of the dependency. At least, that is the first step.
Ah, I see. Thanks for the clarification. I think my main roadblock right now is figuring out how the current code is importing sas. Specifically, it issues calls to import sas.models, sas.dataloader, sas.pr, etc, none of which exists in the sasview repo nor the sasmodels repo. I do believe something like sasmodels.core or sasmodels.models as mentioned by Bob in the error traceback above are valid imports, but I don't see them in the source code. Should I work on trying to find replacements for sas.models imports and etc?
I'd also like to mention that the maintainers of these packages have actually pushed out new releases according to their github repos. Both sasviews and sasmodels had a new release within the recent month or two. I've verified that the imports I mentioned above do not work even after installing both sasmodels and sasview (using the wheel file from their latest release).
Yes, sasview supports numpy >= 2.0 now as of this PR: SasView/sasview#3141
This PR also links additional PRs that separately updates the sasmodels and sasdata packages inside sasviews to use numpy >= 2.0.
OK, great news (and great work @zmx27). Let's try and dig down and figure out why these imports are not working then. During the sasview update process, did these guys change their API? To be honest I think we haven't had this working since 2010 or sthg (maybe more recenlty), so it could have happened a while ago. Basically, the task, which may need help from one of the more scattering-aware group members (realistically only Tina @tinatn29 is likely to know), is to figure out what our test is trying to do (fit some sas data with a model, but which model) and then track down where in the sasview architecture that model is stored and how it is accessed. If their refactor just moved the model and the signature is still the same we won't have to update our test too much (just the import), but if they changed the signature we will have to touch our test.
Yes, I believe that the API has changed significantly since we last used it. Since you said that this code is very old (maybe even from 2010), the use of sas.models has been deprecated, and they have converted this feature into the sasmodels subpackage. I will make a PR trying to address these api changes in test_sas.py, and I'll try my best not to update our tests too much.
I think numpy 2x is now supported, but the current issue with having sasview as a dependency is that it is not released for Python above 3.11 (as of version 6.0).
@sbillinge I mentioned in the last meeting we mentioned this since currently we did not list sasmodels as a dependency, we might skip this issue to a later version release (Moreover, because of the dependency issue for sasmodel, they could not release their latest version on conda-forge).
Activity
zmx27 commentedon Jul 29, 2025
This issue is not relevant anymore. I've done a global search for
print(load_model_info("ellipsoid"))andsasmodels.core, and I was not able to find any results. So this issue can be closed.But on a side note, it's a bit unclear to me what the tests are trying to import. First, the tests in
test_sas.pyare being skipped because thehas_sas()function is returning false inconftest.py. Insidehas_sas(), it tries to importsas.pr.invertorandsas.models, which both fail even when I have sasmodels installed in my conda environment.sasviewcannot be installed because it only supports up to python 3.11, anddiffpy.srfitsupports up to python 3.13. Should it be trying to importsasmodels.modelsinstead? I see that it should exist according to the github repo at this link: https://github.com/SasView/sasmodels/tree/master/sasmodels/modelsI'm not quite sure about
sas.pr.invertorthough.sbillinge commentedon Jul 29, 2025
that is exactly what this issue is about. We are skipping them because we can't load the sas feature and we can't load it because it is incompatible with our new build environment. So the task is to check that dependency and to see if the maintainers have pushed out a new release of the dependency. At least, that is the first step.
zmx27 commentedon Jul 29, 2025
Ah, I see. Thanks for the clarification. I think my main roadblock right now is figuring out how the current code is importing sas. Specifically, it issues calls to import
sas.models,sas.dataloader,sas.pr, etc, none of which exists in the sasview repo nor the sasmodels repo. I do believe something likesasmodels.coreorsasmodels.modelsas mentioned by Bob in the error traceback above are valid imports, but I don't see them in the source code. Should I work on trying to find replacements forsas.modelsimports and etc?I'd also like to mention that the maintainers of these packages have actually pushed out new releases according to their github repos. Both sasviews and sasmodels had a new release within the recent month or two. I've verified that the imports I mentioned above do not work even after installing both sasmodels and sasview (using the wheel file from their latest release).
sbillinge commentedon Jul 30, 2025
ok, nice work. We will have to drill down a bit to look into this. Did you check if sasview/sasmodels support numpy 2.??? now?
zmx27 commentedon Jul 30, 2025
Yes, sasview supports numpy >= 2.0 now as of this PR: SasView/sasview#3141
This PR also links additional PRs that separately updates the sasmodels and sasdata packages inside sasviews to use numpy >= 2.0.
sbillinge commentedon Jul 30, 2025
OK, great news (and great work @zmx27). Let's try and dig down and figure out why these imports are not working then. During the sasview update process, did these guys change their API? To be honest I think we haven't had this working since 2010 or sthg (maybe more recenlty), so it could have happened a while ago. Basically, the task, which may need help from one of the more scattering-aware group members (realistically only Tina @tinatn29 is likely to know), is to figure out what our test is trying to do (fit some sas data with a model, but which model) and then track down where in the sasview architecture that model is stored and how it is accessed. If their refactor just moved the model and the signature is still the same we won't have to update our test too much (just the import), but if they changed the signature we will have to touch our test.
zmx27 commentedon Jul 30, 2025
Yes, I believe that the API has changed significantly since we last used it. Since you said that this code is very old (maybe even from 2010), the use of
sas.modelshas been deprecated, and they have converted this feature into thesasmodelssubpackage. I will make a PR trying to address these api changes intest_sas.py, and I'll try my best not to update our tests too much.zmx27 commentedon Aug 3, 2025
As discussed in #126, let's move this issue to a later release
sbillinge commentedon Aug 3, 2025
I think numpy 2x is now supported, but the current issue with having sasview as a dependency is that it is not released for Python above 3.11 (as of version 6.0).
stevenhua0320 commentedon Mar 31, 2026
@zmx27 @sbillinge Hi guys, so what is the current status of this issue? what should I do for the appropriate testing of code behavior here?
sbillinge commentedon Apr 1, 2026
please check if there is a version of sasview available for python 3.12-3.14. If there is, we can unskip these tests and get them passing.
stevenhua0320 commentedon Apr 7, 2026
@sbillinge I mentioned in the last meeting we mentioned this since currently we did not list
sasmodelsas a dependency, we might skip this issue to a later version release (Moreover, because of the dependency issue forsasmodel, they could not release their latest version onconda-forge).sbillinge commentedon Apr 7, 2026
I moved it to
3.4.0milestone