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

infinitephasescreen unecessary handling of missing numba #67

Closed
carandraug opened this issue May 27, 2021 · 4 comments
Closed

infinitephasescreen unecessary handling of missing numba #67

carandraug opened this issue May 27, 2021 · 4 comments
Projects

Comments

@carandraug
Copy link

The aotools.turbulence.infinitephasescreen module has the following to handle the case of missing numba:

try:
    import numba
except:
    numba = None  
[...]
        if numba:
            calc_seperations_fast(positions, self.seperations)
        else:
[...]

However, it later has:

@numba.jit(nopython=True, parallel=True)
def calc_seperations_fast(positions, seperations):

Which defeats the whole point of handling the missing numba in the first place.

Either the handling of missing numba could be removed and keep things cleaner, or the numba.jit decorator needs to be done in some other way. I can propose a fix, no problem, but I'm not sure which way you'd rather go (I would guess remove the handling of missing numba since numba is now a "hard" requirement of aotools).

@andrewpaulreeves
Copy link
Contributor

Hallo - yes you're completely right. In the "early days" of Numba it was quite tricky to install on some platforms. To be honest, I think it still might be but it comes with Anaconda so I never notice. Looking at the recent install docs, perhaps its ok now?

@matthewtownson what do you think? Are you happy with AOtools going "Full-Numba"?

@carandraug
Copy link
Author

[...] In the "early days" of Numba it was quite tricky to install on some platforms. To be honest, I think it still might be but it comes with Anaconda so I never notice. [...]

The whole reason why I end up in this situation is because the latest numba does not actually work on my platform. The thing is, "pip install numba" succeeds but after installation importing numba fails (I guess this is a numba bug. It is definitely not an AOtools issue). What matters to AOtools is that "pip install aotools" then also succeeds, but then actually importing numba fails (because of the handling for missing numba not actually working, I get the weird "AttributeError: 'NoneType' object has no attribute 'jit'`).

@matthewtownson
Copy link
Member

What platform are you on @carandraug that numba isn't working on?

I am happy adding numba as a full requirement which should solve some of this issue, depending on how niche the issue with numba is.

@carandraug
Copy link
Author

What platform are you on @carandraug that numba isn't working on?

That was a Windows 7 machine running Python 3.8 from python.org. I don't think there was anything particular about the system (this was at my previous job so I can't go there and check more details). I ended up working around this installing an older version of some packages but I have no notes left from that work.

Removing the try/except block would mean getting an error that would immediately point to a failure to import numba. One then knows that the issue is the numba installation. As it is now, one gets the cryptic AttributeError: 'NoneType' object has no attribute 'jit'.

@matthewtownson matthewtownson added this to To Do in V1.1 via automation Mar 11, 2022
andrewpaulreeves added a commit that referenced this issue Mar 18, 2022
@matthewtownson matthewtownson moved this from To Do to Done in V1.1 Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
V1.1
Done
Development

No branches or pull requests

3 participants