Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: gmres() got an unexpected keyword argument 'tol' #1235

Closed
Zethson opened this issue Nov 28, 2024 · 1 comment · Fixed by #1237
Closed

TypeError: gmres() got an unexpected keyword argument 'tol' #1235

Zethson opened this issue Nov 28, 2024 · 1 comment · Fixed by #1237
Assignees
Labels
bug Something isn't working

Comments

@Zethson
Copy link
Member

Zethson commented Nov 28, 2024

g.compute_fate_probabilities()
g.plot_fate_probabilities()

results in

{
	"name": "TypeError",
	"message": "gmres() got an unexpected keyword argument 'tol'",
	"stack": "---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[17], line 1
----> 1 g.compute_fate_probabilities()
      2 g.plot_fate_probabilities()

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/cellrank/estimators/mixins/_fate_probabilities.py:208, in FateProbsMixin.compute_fate_probabilities(self, keys, solver, use_petsc, n_jobs, backend, show_progress_bar, tol, preconditioner)
    206 start = logg.info(\"Computing fate probabilities\")
    207 data = self._rec_trans_states(keys, ctx=\"fate_probs\")
--> 208 fate_probs = self._compute_fate_probabilities(
    209     data.q,
    210     data.s,
    211     trans_indices=data.trans_indices,
    212     term_states=data.term_states,
    213     solver=solver,
    214     use_petsc=use_petsc,
    215     n_jobs=n_jobs,
    216     backend=backend,
    217     tol=tol,
    218     show_progress_bar=show_progress_bar,
    219     preconditioner=preconditioner,
    220 )
    221 fate_probs = Lineage(
    222     fate_probs,
    223     names=list(data.term_states.cat.categories),
    224     colors=data.term_states_colors,
    225 )
    227 params = self._create_params(remove=[\"use_petsc\", \"n_jobs\", \"backend\", \"show_progress_bar\"])

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/cellrank/estimators/mixins/_fate_probabilities.py:455, in FateProbsMixin._compute_fate_probabilities(self, q, s, trans_indices, term_states, solver, use_petsc, n_jobs, backend, tol, show_progress_bar, preconditioner)
    441 def _compute_fate_probabilities(
    442     self: FateProbsProtocol,
    443     q: Union[np.ndarray, sp.spmatrix],
   (...)
    453     preconditioner: str,
    454 ) -> np.ndarray:
--> 455     _abs_classes = _solve_lin_system(
    456         q,
    457         s,
    458         solver=solver,
    459         use_petsc=use_petsc,
    460         n_jobs=n_jobs,
    461         backend=backend,
    462         tol=tol,
    463         use_eye=True,
    464         show_progress_bar=show_progress_bar,
    465         preconditioner=preconditioner,
    466     )
    467     abs_classes = np.zeros(shape=(len(self), len(term_states.cat.categories)), dtype=np.float64)
    468     for col, rec_class in enumerate(term_states.cat.categories):

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/cellrank/_utils/_linear_solver.py:457, in _solve_lin_system(mat_a, mat_b, solver, use_petsc, preconditioner, n_jobs, backend, tol, use_eye, show_progress_bar)
    451         mat_b = sp.csr_matrix(mat_b)
    453     logg.debug(
    454         f\"Solving the linear system using `scipy` solver `{solver!r}` on `{n_jobs} cores(s)` with `tol={tol}`\"
    455     )
--> 457     mat_x, n_converged = parallelize(
    458         _solve_many_sparse_problems,
    459         mat_b,
    460         n_jobs=n_jobs,
    461         backend=backend,
    462         as_array=False,
    463         extractor=extractor,
    464         show_progress_bar=show_progress_bar,
    465     )(mat_a, solver=_AVAIL_ITER_SOLVERS[solver], tol=tol)
    467 else:
    468     raise ValueError(f\"Invalid solver `{solver!r}`.\")

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/cellrank/_utils/_parallelize.py:97, in parallelize.<locals>.wrapper(*args, **kwargs)
     94 else:
     95     pbar, queue, thread = None, None, None
---> 97 res = jl.Parallel(n_jobs=n_jobs, backend=backend)(
     98     jl.delayed(callback)(
     99         *((i, cs) if use_ixs else (cs,)),
    100         *args,
    101         **kwargs,
    102         queue=queue,
    103     )
    104     for i, cs in enumerate(collections)
    105 )
    107 res = np.array(res) if as_array else res
    108 if thread is not None:

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/joblib/parallel.py:1918, in Parallel.__call__(self, iterable)
   1916     output = self._get_sequential_output(iterable)
   1917     next(output)
-> 1918     return output if self.return_generator else list(output)
   1920 # Let's create an ID that uniquely identifies the current call. If the
   1921 # call is interrupted early and that the same instance is immediately
   1922 # re-used, this id will be used to prevent workers that were
   1923 # concurrently finalizing a task from the previous call to run the
   1924 # callback.
   1925 with self._lock:

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/joblib/parallel.py:1847, in Parallel._get_sequential_output(self, iterable)
   1845 self.n_dispatched_batches += 1
   1846 self.n_dispatched_tasks += 1
-> 1847 res = func(*args, **kwargs)
   1848 self.n_completed_tasks += 1
   1849 self.print_progress()

File ~/miniconda3/envs/ehrapy/lib/python3.11/site-packages/cellrank/_utils/_linear_solver.py:230, in _solve_many_sparse_problems(mat_b, mat_a, solver, tol, queue)
    226 kwargs = {} if solver is not sp.linalg.gmres else {\"atol\": \"legacy\"}  # get rid of the warning
    228 for b in mat_b:
    229     # actually call the solver for the current sub-problem
--> 230     x, info = solver(mat_a, b.toarray().flatten(), tol=tol, x0=None, **kwargs)
    232     # append solution and info
    233     x_list.append(np.atleast_1d(x))

TypeError: gmres() got an unexpected keyword argument 'tol'"
}

Versions:

cellrank==2.0.6 scanpy==1.10.4 anndata==0.11.1 numpy==2.0.2 numba==0.60.0 scipy==1.14.1 pandas==2.2.3 pygpcca==1.0.4 scikit-learn==1.5.2 statsmodels==0.14.4 python-igraph==0.11.8 scvelo==0.3.3.dev12+g22b6e7e pygam==0.8.0 matplotlib==3.9.2 seaborn==0.13.2

@Zethson Zethson added the bug Something isn't working label Nov 28, 2024
@michalk8
Copy link
Collaborator

Thanks, seems scipy.linalg.gmres now accepts rtol/atol instead of tol/atol, will fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants