Code Monkey home page Code Monkey logo

Comments (10)

jose-matos avatar jose-matos commented on June 27, 2024

I take back the failure just on 2.3.4.

This already fails on 2.3.3. It seems that for some reason I was not testing this before.

Example, with the 2.3.3 package installed on F40:

python /usr/lib64/python3.12/site-packages/pygsl/testing/sf.py
Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/pygsl/testing/sf.py", line 18, in <module>
    del _shortname
        ^^^^^^^^^^
NameError: name '_shortname' is not defined

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

Dear Jose,

I assume that somehow pygsl is not properly available in your environment: I assume it has issues to load the modules that are implemented in C.

There is a bug in testing.sf: but it is triggered that testing.sf._ufuncs do not load.

pytest is run as part of github actions, and I do not get any errors there.

Happy to provide further suggestions.

SIncerely yours
Pierre

from pygsl.

jose-matos avatar jose-matos commented on June 27, 2024

I think that the issue comes to this "where should the test be run?".

If they are in the build directory then that is not a problem, because testing.sf._ufuncs is built.

If they are supposed to be run in the install directory then it does not work because those modules are not installed.

In github, the test are run in the build directory, so there is no issue.
In Fedora to ensure that all works as it should the tests are run in the installed version.

Note that if the tests to be run are limited to the upper tests directory there is no issue. The issues occur with testing folder.

I can confirm that the _ufuncs module is built but not installed. I think that this is the underlying problem. Again I admit that the issue could be on my part but I tried a lot to ensure that we are not doing anything strange. :-)

Best regards,
José

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

from pygsl.

jose-matos avatar jose-matos commented on June 27, 2024

OK. I am also trying to understand what is going on.

What should be the outcome of importing _funcs from pygsl.testing?

I get (using ipython as the shell for simplicity):

In [1]: from pygsl.testing import _ufuncs

In [2]: dir (_ufuncs)
Out[2]: 
['PREC_APPROX',
 'PREC_DOUBLE',
 'PREC_SINGLE',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__spec__',
 'bessel_In_array',
 'bessel_Jn_array',
 'bessel_Kn_array',
 'bessel_Kn_scaled_array',
 'bessel_Yn_array',
 'bessel_il_scaled_array',
 'bessel_jl_array',
 'bessel_jl_steed_array',
 'bessel_kl_scaled_array',
 'bessel_yl_array',
 'coulomb_CL_array',
 'coulomb_wave_FG_array',
 'coulomb_wave_FGp_array',
 'coulomb_wave_F_array',
 'coulomb_wave_sphF_array',
 'gegenpoly_array',
 'legendre_H3d_array',
 'legendre_Pl_array',
 'polar_to_rect',
 'rect_to_polar']

At the same time, since this issue is with the special functions I also get:

In [3]: from pygsl import sf
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[3], line 1
----> 1 from pygsl import sf

ImportError: cannot import name 'sf' from 'pygsl' (/usr/lib64/python3.12/site-packages/pygsl/__init__.py)

This happens even though pygsl/__init__.py refers to it:

__all__=['blas', 'chebyshev', 'combination', 'const', 'deriv', 'eigen', 'fit',
         'fft', 'histogram','ieee', 'integrate', 'interpolation','linalg',
         'math', 'minimize', 'monte', 'multifit', 'multifit_nlin', 'multimin',
         'multiroots','odeiv', 'permutation', 'poly', 'qrng', 'rng', 'roots',
         'siman', 'sf', 'spline', 'statistics']

Best regards,
José

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

from pygsl.

jose-matos avatar jose-matos commented on June 27, 2024

That just shows the problem initially revealed by pytest:

$ ipython
Python 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 14.0.1 20240217 (Red Hat 14.0.1-0)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.21.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:  import pygsl.testing.sf as f
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pygsl.testing.sf as f

File /usr/lib64/python3.12/site-packages/pygsl/testing/sf.py:18
     16 del _token
     17 del _tokl
---> 18 del _shortname
     19 del _name
     20 del _cmd

NameError: name '_shortname' is not defined

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

Dear Jose,

this _shortname is hiding a bug. If you import the sf module from pygsl.testing the
module _ufuncs is imported.

Printing it should reveal something like

>>> print(sf._ufuncs)
<module 'pygsl.testing._ufuncs' from '/home/mfp/Devel/pygsl/venv/lib/python3.12/site-packages/pygsl/testing/_ufuncs.cpython-312-x86_64-linux-gnu.so'>

Sometimes it happens that the libraries are not installed, but some "hiding" package is installed. One could also check it by

>>> from pygsl.testing.sf import _ufuncs
>>> print(_ufuncs)
<module 'pygsl.testing._ufuncs' from '/home/mfp/Devel/pygsl/venv/lib/python3.12/site-packages/pygsl/testing/_ufuncs.cpython-312-x86_64-linux-gnu.so'>

Then the dir command should give something like

>>> dir(_ufuncs)
['PREC_APPROX', 'PREC_DOUBLE', 'PREC_SINGLE', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'acosh', 'asinh', 'atanh', 'bessel_In_array', 'bessel_Jn_array', 'bessel_Kn_array', 'bessel_Kn_scaled_array', 'bessel_Yn_array', 'bessel_il_scaled_array', 'bessel_jl_array', 'bessel_jl_steed_array', 'bessel_kl_scaled_array', 'bessel_yl_array', 'coerce_double', 'complex_abs', 'complex_abs2', 'complex_add', 'complex_add_imag', 'complex_add_real', 'complex_arccos', 'complex_arccos_real', 'complex_arccosh', 'complex_arccosh_real', 'complex_arccot', 'complex_arccoth', 'complex_arccsc', 'complex_arccsc_real', 'complex_arccsch', 'complex_arcsec', 'complex_arcsec_real', 'complex_arcsech', 'complex_arcsin', 'complex_arcsin_real', 'complex_arcsinh', 'complex_arctan', 'complex_arctanh', 'complex_arctanh_real', 'complex_arg', 'complex_conjugate', 'complex_cos', 'complex_cosh', 'complex_cot', 'complex_coth', 'complex_csc', 'complex_csch', 'complex_div', 'complex_div_imag', 'complex_div_real', 'complex_exp', 'complex_inverse', 'complex_log', 'complex_log10', 'complex_log_b', 'complex_logabs', 'complex_mul', 'complex_mul_imag', 'complex_mul_real', 'complex_negative', 'complex_polar', 'complex_pow', 'complex_pow_real', 'complex_rect', 'complex_sec', 'complex_sech', 'complex_sin', 'complex_sinh', 'complex_sqrt', 'complex_sqrt_real', 'complex_sub', 'complex_sub_imag', 'complex_sub_real', 'complex_tan', 'complex_tanh', 'coulomb_CL_array', 'coulomb_wave_FG_array', 'coulomb_wave_FGp_array', 'coulomb_wave_F_array', 'coulomb_wave_sphF_array', 'expm1', 'fcmp', 'fdiv', 'finite', 'frexp', 'gegenpoly_array', 'hypot', 'hypot3', 'isinf', 'isnan', 'ldexp', 'legendre_H3d_array', 'legendre_Pl_array', 'log1p', 'polar_to_rect', 'rect_to_polar', 'sf_Chi', 'sf_Chi_e', 'sf_Ci', 'sf_Ci_e', 'sf_Shi', 'sf_Shi_e', 'sf_Si', 'sf_Si_e', 'sf_airy_Ai', 'sf_airy_Ai_deriv', 'sf_airy_Ai_deriv_e', 'sf_airy_Ai_deriv_scaled', 'sf_airy_Ai_deriv_scaled_e', 'sf_airy_Ai_e', 'sf_airy_Ai_scaled', 'sf_airy_Ai_scaled_e', 'sf_airy_Bi', 'sf_airy_Bi_deriv', 'sf_airy_Bi_deriv_e', 'sf_airy_Bi_deriv_scaled', 'sf_airy_Bi_deriv_scaled_e', 'sf_airy_Bi_e', 'sf_airy_Bi_scaled', 'sf_airy_Bi_scaled_e', 'sf_airy_zero_Ai', 'sf_airy_zero_Ai_deriv', 'sf_airy_zero_Ai_deriv_e', 'sf_airy_zero_Ai_e', 'sf_airy_zero_Bi', 'sf_airy_zero_Bi_deriv', 'sf_airy_zero_Bi_deriv_e', 'sf_airy_zero_Bi_e', 'sf_angle_restrict_pos', 'sf_angle_restrict_pos_err_e', 'sf_angle_restrict_symm', 'sf_angle_restrict_symm_err_e', 'sf_atanint', 'sf_atanint_e', 'sf_bessel_I0', 'sf_bessel_I0_e', 'sf_bessel_I0_scaled', 'sf_bessel_I0_scaled_e', 'sf_bessel_I1', 'sf_bessel_I1_e', 'sf_bessel_I1_scaled', 'sf_bessel_I1_scaled_e', 'sf_bessel_In', 'sf_bessel_In_e', 'sf_bessel_In_scaled', 'sf_bessel_In_scaled_e', 'sf_bessel_Inu', 'sf_bessel_Inu_e', 'sf_bessel_Inu_scaled', 'sf_bessel_Inu_scaled_e', 'sf_bessel_J0', 'sf_bessel_J0_e', 'sf_bessel_J1', 'sf_bessel_J1_e', 'sf_bessel_Jn', 'sf_bessel_Jn_e', 'sf_bessel_Jnu', 'sf_bessel_Jnu_e', 'sf_bessel_K0', 'sf_bessel_K0_e', 'sf_bessel_K0_scaled', 'sf_bessel_K0_scaled_e', 'sf_bessel_K1', 'sf_bessel_K1_e', 'sf_bessel_K1_scaled', 'sf_bessel_K1_scaled_e', 'sf_bessel_Kn', 'sf_bessel_Kn_e', 'sf_bessel_Kn_scaled', 'sf_bessel_Kn_scaled_e', 'sf_bessel_Knu', 'sf_bessel_Knu_e', 'sf_bessel_Knu_scaled', 'sf_bessel_Knu_scaled_e', 'sf_bessel_Knu_scaled_e10_e', 'sf_bessel_Y0', 'sf_bessel_Y0_e', 'sf_bessel_Y1', 'sf_bessel_Y1_e', 'sf_bessel_Yn', 'sf_bessel_Yn_e', 'sf_bessel_Ynu', 'sf_bessel_Ynu_e', 'sf_bessel_i0_scaled', 'sf_bessel_i0_scaled_e', 'sf_bessel_i1_scaled', 'sf_bessel_i1_scaled_e', 'sf_bessel_i2_scaled', 'sf_bessel_i2_scaled_e', 'sf_bessel_il_scaled', 'sf_bessel_il_scaled_e', 'sf_bessel_j0', 'sf_bessel_j0_e', 'sf_bessel_j1', 'sf_bessel_j1_e', 'sf_bessel_j2', 'sf_bessel_j2_e', 'sf_bessel_jl', 'sf_bessel_jl_e', 'sf_bessel_k0_scaled', 'sf_bessel_k0_scaled_e', 'sf_bessel_k1_scaled', 'sf_bessel_k1_scaled_e', 'sf_bessel_k2_scaled', 'sf_bessel_k2_scaled_e', 'sf_bessel_kl_scaled', 'sf_bessel_kl_scaled_e', 'sf_bessel_lnKnu', 'sf_bessel_lnKnu_e', 'sf_bessel_y0', 'sf_bessel_y0_e', 'sf_bessel_y1', 'sf_bessel_y1_e', 'sf_bessel_y2', 'sf_bessel_y2_e', 'sf_bessel_yl', 'sf_bessel_yl_e', 'sf_bessel_zero_J0', 'sf_bessel_zero_J0_e', 'sf_bessel_zero_J1', 'sf_bessel_zero_J1_e', 'sf_bessel_zero_Jnu', 'sf_bessel_zero_Jnu_e', 'sf_beta', 'sf_beta_e', 'sf_beta_inc', 'sf_beta_inc_e', 'sf_choose', 'sf_choose_e', 'sf_clausen', 'sf_clausen_e', 'sf_complex_dilog_xy_e', 'sf_complex_psi_e', 'sf_complex_spence_xy_e', 'sf_conicalP_0', 'sf_conicalP_0_e', 'sf_conicalP_1', 'sf_conicalP_1_e', 'sf_conicalP_cyl_reg', 'sf_conicalP_cyl_reg_e', 'sf_conicalP_half', 'sf_conicalP_half_e', 'sf_conicalP_mhalf', 'sf_conicalP_mhalf_e', 'sf_conicalP_sph_reg', 'sf_conicalP_sph_reg_e', 'sf_cos', 'sf_cos_e', 'sf_cos_err_e', 'sf_coulomb_CL_e', 'sf_coulomb_wave_FG_e', 'sf_coupling_3j', 'sf_coupling_3j_e', 'sf_coupling_6j', 'sf_coupling_6j_e', 'sf_coupling_9j', 'sf_coupling_9j_e', 'sf_coupling_RacahW', 'sf_coupling_RacahW_e', 'sf_dawson', 'sf_dawson_e', 'sf_debye_1', 'sf_debye_1_e', 'sf_debye_2', 'sf_debye_2_e', 'sf_debye_3', 'sf_debye_3_e', 'sf_debye_4', 'sf_debye_4_e', 'sf_debye_5', 'sf_debye_5_e', 'sf_debye_6', 'sf_debye_6_e', 'sf_dilog', 'sf_dilog_e', 'sf_doublefact', 'sf_doublefact_e', 'sf_ellint_D', 'sf_ellint_D_e', 'sf_ellint_Dcomp', 'sf_ellint_Dcomp_e', 'sf_ellint_E', 'sf_ellint_E_e', 'sf_ellint_Ecomp', 'sf_ellint_Ecomp_e', 'sf_ellint_F', 'sf_ellint_F_e', 'sf_ellint_Kcomp', 'sf_ellint_Kcomp_e', 'sf_ellint_P', 'sf_ellint_P_e', 'sf_ellint_Pcomp', 'sf_ellint_Pcomp_e', 'sf_ellint_RC', 'sf_ellint_RC_e', 'sf_ellint_RD', 'sf_ellint_RD_e', 'sf_ellint_RF', 'sf_ellint_RF_e', 'sf_ellint_RJ', 'sf_ellint_RJ_e', 'sf_elljac_e', 'sf_erf', 'sf_erf_Q', 'sf_erf_Q_e', 'sf_erf_Z', 'sf_erf_Z_e', 'sf_erf_e', 'sf_erfc', 'sf_erfc_e', 'sf_eta', 'sf_eta_e', 'sf_eta_int', 'sf_eta_int_e', 'sf_exp', 'sf_exp_e', 'sf_exp_e10_e', 'sf_exp_err_e', 'sf_exp_err_e10_e', 'sf_exp_mult', 'sf_exp_mult_e', 'sf_exp_mult_e10_e', 'sf_exp_mult_err_e', 'sf_exp_mult_err_e10_e', 'sf_expint_3', 'sf_expint_3_e', 'sf_expint_E1', 'sf_expint_E1_e', 'sf_expint_E1_scaled', 'sf_expint_E1_scaled_e', 'sf_expint_E2', 'sf_expint_E2_e', 'sf_expint_E2_scaled', 'sf_expint_E2_scaled_e', 'sf_expint_Ei', 'sf_expint_Ei_e', 'sf_expint_Ei_scaled', 'sf_expint_Ei_scaled_e', 'sf_expint_En', 'sf_expint_En_e', 'sf_expint_En_scaled', 'sf_expint_En_scaled_e', 'sf_expm1', 'sf_expm1_e', 'sf_exprel', 'sf_exprel_2', 'sf_exprel_2_e', 'sf_exprel_e', 'sf_exprel_n', 'sf_exprel_n_CF_e', 'sf_exprel_n_e', 'sf_fact', 'sf_fact_e', 'sf_fermi_dirac_0', 'sf_fermi_dirac_0_e', 'sf_fermi_dirac_1', 'sf_fermi_dirac_1_e', 'sf_fermi_dirac_2', 'sf_fermi_dirac_2_e', 'sf_fermi_dirac_3half', 'sf_fermi_dirac_3half_e', 'sf_fermi_dirac_half', 'sf_fermi_dirac_half_e', 'sf_fermi_dirac_inc_0', 'sf_fermi_dirac_inc_0_e', 'sf_fermi_dirac_int', 'sf_fermi_dirac_int_e', 'sf_fermi_dirac_m1', 'sf_fermi_dirac_m1_e', 'sf_fermi_dirac_mhalf', 'sf_fermi_dirac_mhalf_e', 'sf_gamma', 'sf_gamma_e', 'sf_gamma_inc', 'sf_gamma_inc_P', 'sf_gamma_inc_P_e', 'sf_gamma_inc_Q', 'sf_gamma_inc_Q_e', 'sf_gamma_inc_e', 'sf_gammainv', 'sf_gammainv_e', 'sf_gammastar', 'sf_gammastar_e', 'sf_gegenpoly_1', 'sf_gegenpoly_1_e', 'sf_gegenpoly_2', 'sf_gegenpoly_2_e', 'sf_gegenpoly_3', 'sf_gegenpoly_3_e', 'sf_gegenpoly_n', 'sf_gegenpoly_n_e', 'sf_hazard', 'sf_hazard_e', 'sf_hydrogenicR', 'sf_hydrogenicR_1', 'sf_hydrogenicR_1_e', 'sf_hydrogenicR_e', 'sf_hyperg_0F1', 'sf_hyperg_0F1_e', 'sf_hyperg_1F1', 'sf_hyperg_1F1_e', 'sf_hyperg_1F1_int', 'sf_hyperg_1F1_int_e', 'sf_hyperg_2F0', 'sf_hyperg_2F0_e', 'sf_hyperg_2F1', 'sf_hyperg_2F1_conj', 'sf_hyperg_2F1_conj_e', 'sf_hyperg_2F1_conj_renorm', 'sf_hyperg_2F1_conj_renorm_e', 'sf_hyperg_2F1_e', 'sf_hyperg_2F1_renorm', 'sf_hyperg_2F1_renorm_e', 'sf_hyperg_U', 'sf_hyperg_U_e', 'sf_hyperg_U_e10_e', 'sf_hyperg_U_int', 'sf_hyperg_U_int_e', 'sf_hyperg_U_int_e10_e', 'sf_hypot', 'sf_hypot_e', 'sf_hzeta', 'sf_hzeta_e', 'sf_laguerre_1', 'sf_laguerre_1_e', 'sf_laguerre_2', 'sf_laguerre_2_e', 'sf_laguerre_3', 'sf_laguerre_3_e', 'sf_laguerre_n', 'sf_laguerre_n_e', 'sf_lambert_W0', 'sf_lambert_W0_e', 'sf_lambert_Wm1', 'sf_lambert_Wm1_e', 'sf_legendre_H3d', 'sf_legendre_H3d_0', 'sf_legendre_H3d_0_e', 'sf_legendre_H3d_1', 'sf_legendre_H3d_1_e', 'sf_legendre_H3d_e', 'sf_legendre_P1', 'sf_legendre_P1_e', 'sf_legendre_P2', 'sf_legendre_P2_e', 'sf_legendre_P3', 'sf_legendre_P3_e', 'sf_legendre_Pl', 'sf_legendre_Pl_e', 'sf_legendre_Plm', 'sf_legendre_Plm_e', 'sf_legendre_Q0', 'sf_legendre_Q0_e', 'sf_legendre_Q1', 'sf_legendre_Q1_e', 'sf_legendre_Ql', 'sf_legendre_Ql_e', 'sf_legendre_sphPlm', 'sf_legendre_sphPlm_e', 'sf_lnbeta', 'sf_lnbeta_e', 'sf_lnbeta_sgn_e', 'sf_lnchoose', 'sf_lnchoose_e', 'sf_lncosh', 'sf_lncosh_e', 'sf_lndoublefact', 'sf_lndoublefact_e', 'sf_lnfact', 'sf_lnfact_e', 'sf_lngamma', 'sf_lngamma_e', 'sf_lngamma_sgn_e', 'sf_lnpoch', 'sf_lnpoch_e', 'sf_lnpoch_sgn_e', 'sf_lnsinh', 'sf_lnsinh_e', 'sf_log', 'sf_log_1plusx', 'sf_log_1plusx_e', 'sf_log_1plusx_mx', 'sf_log_1plusx_mx_e', 'sf_log_abs', 'sf_log_abs_e', 'sf_log_e', 'sf_log_erfc', 'sf_log_erfc_e', 'sf_multiply', 'sf_multiply_e', 'sf_multiply_err_e', 'sf_poch', 'sf_poch_e', 'sf_pochrel', 'sf_pochrel_e', 'sf_pow_int', 'sf_pow_int_e', 'sf_psi', 'sf_psi_1', 'sf_psi_1_e', 'sf_psi_1_int', 'sf_psi_1_int_e', 'sf_psi_1piy', 'sf_psi_1piy_e', 'sf_psi_e', 'sf_psi_int', 'sf_psi_int_e', 'sf_psi_n', 'sf_psi_n_e', 'sf_sin', 'sf_sin_e', 'sf_sin_err_e', 'sf_sinc', 'sf_sinc_e', 'sf_synchrotron_1', 'sf_synchrotron_1_e', 'sf_synchrotron_2', 'sf_synchrotron_2_e', 'sf_taylorcoeff', 'sf_taylorcoeff_e', 'sf_transport_2', 'sf_transport_2_e', 'sf_transport_3', 'sf_transport_3_e', 'sf_transport_4', 'sf_transport_4_e', 'sf_transport_5', 'sf_transport_5_e', 'sf_zeta', 'sf_zeta_e', 'sf_zeta_int', 'sf_zeta_int_e', 'sf_zetam1', 'sf_zetam1_e', 'sf_zetam1_int', 'sf_zetam1_int_e']

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

An other thing to test could be to set zip_safe=False in pyproject.toml

see https://setuptools.pypa.io/en/latest/deprecated/zip_safe.html

from pygsl.

PierreSchnizer avatar PierreSchnizer commented on June 27, 2024

Unfortunately I can not reproduce the bug. That makes it difficult to me to analyse it.

If you are using some build tool that has output, it could be helpful if you send me the link to this output.

If you prefer, you could also send it to me on my personal email. Have a look into the log file, you will find it there.

Sincerely yours
Pierre

from pygsl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.