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

environment: importing from xgcm bad on sciserver #20

Open
gjayb opened this issue May 24, 2022 · 1 comment
Open

environment: importing from xgcm bad on sciserver #20

gjayb opened this issue May 24, 2022 · 1 comment

Comments

@gjayb
Copy link

gjayb commented May 24, 2022

I'm trying to follow along from some of these sample notebooks but can't figure out the environment. I'm on sciserver. I have installed xgcm (it does appear in !conda list).
Can y'all help interpret this?

Traceback:

TypingErrorTraceback (most recent call last)
in
----> 1 from xgcm import Grid
2 from xgcm.autogenerate import generate_grid_ds

~/miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/init.py in
4 version = "unknown"
5
----> 6 from .autogenerate import generate_grid_ds
7 from .grid import Axis, Grid

~/miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/autogenerate.py in
1 import xarray as xr
2
----> 3 from xgcm.grid import Axis, raw_interp_function
4
5

~/miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/grid.py in
15 import numba
16
---> 17 from .transform import conservative_interpolation, linear_interpolation
18 except ImportError:
19 numba = None

~/miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/transform.py in
17 ],
18 "(n),(n),(m),(),()->(m)",
---> 19 nopython=True,
20 )
21 def _interp_1d_linear(

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/npyufunc/decorators.py in wrap(func)
177 guvec = GUVectorize(func, signature, **kws)
178 for fty in ftylist:
--> 179 guvec.add(fty)
180 return guvec.build_ufunc()
181

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/npyufunc/ufuncbuilder.py in add(self, sig)
194 targetoptions = self.nb_func.targetoptions
195 cres, args, return_type = _compile_element_wise_function(
--> 196 self.nb_func, targetoptions, sig)
197 sig = self._finalize_signature(cres, args, return_type)
198 self._sigs.append(sig)

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/npyufunc/ufuncbuilder.py in _compile_element_wise_function(nb_func, targetoptions, sig)
128 # Do compilation
129 # Return CompileResult to test
--> 130 cres = nb_func.compile(sig, **targetoptions)
131 args, return_type = sigutils.normalize_signature(sig)
132 return cres, args, return_type

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/npyufunc/ufuncbuilder.py in compile(self, sig, locals, **targetoptions)
77 flags.unset("enable_looplift")
78
---> 79 return self._compile_core(sig, flags, locals)
80
81 def _compile_core(self, sig, flags, locals):

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/npyufunc/ufuncbuilder.py in _compile_core(self, sig, flags, locals)
112 self.py_func, args=args,
113 return_type=return_type,
--> 114 flags=flags, locals=locals)
115
116 # cache lookup failed before so safe to save

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
970 pipeline = pipeline_class(typingctx, targetctx, library,
971 args, return_type, flags, locals)
--> 972 return pipeline.compile_extra(func)
973
974

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
388 self.lifted = ()
389 self.lifted_from = None
--> 390 return self._compile_bytecode()
391
392 def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
901 """
902 assert self.func_ir is None
--> 903 return self._compile_core()
904
905 def _compile_ir(self):

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
888 self.define_pipelines(pm)
889 pm.finalize()
--> 890 res = pm.run(self.status)
891 if res is not None:
892 # Early pipeline completion

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
264 # No more fallback pipelines?
265 if is_final_pipeline:
--> 266 raise patched_exception
267 # Go to next fallback pipeline
268 else:

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
255 try:
256 event("-- %s" % stage_name)
--> 257 stage()
258 except _EarlyPipelineCompletion as e:
259 return e.result

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in stage_nopython_frontend(self)
513 self.args,
514 self.return_type,
--> 515 self.locals)
516 self.typemap = typemap
517 self.return_type = return_type

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/compiler.py in type_inference_stage(typingctx, interp, args, return_type, locals)
1122
1123 infer.build_constraint()
-> 1124 infer.propagate()
1125 typemap, restype, calltypes = infer.unify()
1126

~/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py in propagate(self, raise_errors)
925 if errors:
926 if raise_errors:
--> 927 raise errors[0]
928 else:
929 return errors

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function interp at 0x7f44f9406cb0>) with argument(s) of type(s): (array(float32, 1d, A), array(float32, 1d, A), array(float32, 1d, A))

  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Invalid use of Function(<function np_interp_impl_inner_factory..impl at 0x7f44f60215f0>) with argument(s) of type(s): (array(float32, 1d, A), array(float32, 1d, A), array(float32, 1d, A), dtype(float64))
  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Cannot unify array(float32, 1d, C) and array(float64, 1d, C) for 'slopes', defined at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2120)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2120:
def impl(x, xp, fp, dtype):

if lenxp <= lenx:
slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1])
^

[1] During: typing of assignment at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2122)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2122:
def impl(x, xp, fp, dtype):

else:
slopes = np.empty(0, dtype=dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Cannot unify array(float32, 1d, C) and array(float64, 1d, C) for 'slopes', defined at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2120)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2120:
def impl(x, xp, fp, dtype):

if lenxp <= lenx:
slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1])
^

[1] During: typing of assignment at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2122)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2122:
def impl(x, xp, fp, dtype):

else:
slopes = np.empty(0, dtype=dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function np_interp_impl_inner_factory..impl at 0x7f44f60215f0>)
[2] During: typing of call at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2237)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2237:
def np_interp_impl(x, xp, fp):
return inner(x, xp, fp, dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function np_interp_impl_inner_factory..impl at 0x7f44f60215f0>) with argument(s) of type(s): (array(float32, 1d, A), array(float32, 1d, A), array(float32, 1d, A), dtype(float64))

  • parameterized
    In definition 0:
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Cannot unify array(float32, 1d, C) and array(float64, 1d, C) for 'slopes', defined at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2120)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2120:
def impl(x, xp, fp, dtype):

if lenxp <= lenx:
slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1])
^

[1] During: typing of assignment at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2122)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2122:
def impl(x, xp, fp, dtype):

else:
slopes = np.empty(0, dtype=dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Cannot unify array(float32, 1d, C) and array(float64, 1d, C) for 'slopes', defined at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2120)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2120:
def impl(x, xp, fp, dtype):

if lenxp <= lenx:
slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1])
^

[1] During: typing of assignment at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2122)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2122:
def impl(x, xp, fp, dtype):

else:
slopes = np.empty(0, dtype=dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function np_interp_impl_inner_factory..impl at 0x7f44f60215f0>)
[2] During: typing of call at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py (2237)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2237:
def np_interp_impl(x, xp, fp):
return inner(x, xp, fp, dtype)
^

raised from /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/numba/typeinfer.py:927

This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function interp at 0x7f44f9406cb0>)
[2] During: typing of call at /home/idies/miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/transform.py (31)

File "../../../../miniconda3/envs/py37/lib/python3.7/site-packages/xgcm/transform.py", line 31:
def _interp_1d_linear(

output[:] = np.interp(target_theta_levels, theta, phi)
^
@jbusecke
Copy link
Collaborator

This is xgcm transform, right? Can you post the line where you are actually calling this? It seems like there is an issue with the types of data being put in. If you could post a type(variable) for all inputs to grid.transform(...), that might help.
In general this could also be an issue with numba (which is an optional dependency for this fuctionality only), could you also print and post the numba version in your environment?

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

2 participants