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

AttributeError: module 'numba' has no attribute 'generated_jit' #430

Open
jw3126 opened this issue Apr 7, 2024 · 5 comments
Open

AttributeError: module 'numba' has no attribute 'generated_jit' #430

jw3126 opened this issue Apr 7, 2024 · 5 comments

Comments

@jw3126
Copy link

jw3126 commented Apr 7, 2024

I tried:

conda install -c conda-forge clifford

When I try to import clifford I get:

AttributeError: module 'numba' has no attribute 'generated_jit'
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.28.1               hd590300_0    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
clifford                  1.4.0              pyhd8ed1ab_0    conda-forge
h5py                      3.10.0          nompi_py312h1b477d7_101    conda-forge
hdf5                      1.14.3          nompi_h4f84152_100    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libaec                    1.1.3                h59595ed_0    conda-forge
libblas                   3.9.0           21_linux64_openblas    conda-forge
libcblas                  3.9.0           21_linux64_openblas    conda-forge
libcurl                   8.7.1                hca28451_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.6.2                h59595ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgfortran-ng            13.2.0               h69a702a_5    conda-forge
libgfortran5              13.2.0               ha4646dd_5    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
liblapack                 3.9.0           21_linux64_openblas    conda-forge
libllvm14                 14.0.6               hcd5def8_4    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.26          pthreads_h413a1c8_0    conda-forge
libsqlite                 3.45.2               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
llvmlite                  0.42.0          py312hb06c811_1    conda-forge
ncurses                   6.4.20240210         h59595ed_0    conda-forge
numba                     0.59.1          py312hacefee8_0    conda-forge
numpy                     1.26.4          py312heda63a1_0    conda-forge
openssl                   3.2.1                hd590300_1    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
python                    3.12.2          hab00c5b_0_cpython    conda-forge
python_abi                3.12                    4_cp312    conda-forge
readline                  8.2                  h8228510_1    conda-forge
scipy                     1.13.0          py312heda63a1_0    conda-forge
setuptools                69.2.0             pyhd8ed1ab_0    conda-forge
sparse                    0.15.1             pyhd8ed1ab_1    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge
@colinthart
Copy link

I have encountered this as well

numba.generated_jit has been deprecated and removed

Discussion of the removal of numba.generated_jit and recommendations for replacement

As a workaround until this change, clifford users can pin the version of numba installed by pip numba<0.59.0

fabaff pushed a commit to cor-rizzle/nixpkgs that referenced this issue Apr 11, 2024
@mhartl
Copy link

mhartl commented Jun 10, 2024

Just wanted to note that I ran into this issue as well. The workaround pip install numba==0.58.1 worked for now, though there is still a deprecation warning when doing calculations. Unfortunately, it is beyond my current powers to fix the issue myself, but consider this a vote for addressing it when possible.

@donhatch
Copy link
Contributor

Maybe a dup of #380 which was filed back in 2020?

However, no workaround details were posted there.

Workaround details were posted above by mhartl (pip install numba==0.58.1) but that now fails with:
RuntimeError: Cannot install on Python version 3.12.3; only versions >=3.8,<3.12 are supported.

So, we now have to pin to an old version of python, too :-(

Here is the full recipe, including workarounds, that works for me right now on ubuntu 24.04, to run from my clone of the clifford repo:

# Following instructions in https://clifford.readthedocs.io/en/latest/installation.html,
# plus workarounds for https://github.com/pygae/clifford/issues/430

git clone https://github.com/pygae/clifford.git

sudo add-apt-repository ppa:deadsnakes/ppa  # for python3.11-venv
sudo apt install python3.11-venv  # so `python3.11 -m venv` will work
python3.11 -m venv my_venv_for_clifford
source my_venv_for_clifford/bin/activate
pip3.11 install numba==0.58.1  # workaround for `AttributeError: module 'numba' has no attribute 'generated_jit'`
pip3.11 install -e ./clifford  # where `./clifford` is the repo dir

# Now assuming everything is installed, as above, do this in each new shell
source my_venv_for_clifford/bin/activate
cd ./clifford
# so current directory is the "clifford" repo dir
python3.11
  >>> # Example from https://github.com/pygae/clifford#quickstart
  >>> from clifford.g3 import *
  >>> from math import e, pi
  >>> a = e1 + 2*e2 + 3*e3 # vector 
  >>> R = e**(pi/4*e12)    # rotor 
    /home/donhatch/backed_up/gitrepos/clifford/clifford/taylor_expansions.py:71: NumbaDeprecationWarning: numba.generated_jit is deprecated. Please see the documentation at: https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-generated-jit for more information and advice on a suitable replacement.
      tmp = tmp*scaled * (1.0 / i)
  >>> R*a*~R    # rotate the vector  
    (2.0^e1) - (1.0^e2) + (3.0^e3)

@donhatch
Copy link
Contributor

Pending a fix, it would be great if a link to this bug could be added to https://clifford.readthedocs.io/en/latest/installation.html , to help people find the workaround more quickly.

@hugohadfield
Copy link
Member

Apologies everyone, we have all been pretty tied up recently and havent been taking as much care of our packages as we should be! Thanks so much for the work around, I have a couple of days I can dedicate to this coming up, and definitely appreciative of any suggestions. I think we went a bit overboard in integrating numba very tightly into the codebase chasing execution speed, I'll have a look if we can decouple it a bit

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

5 participants