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

scipy's spilu doesn't accept some string args #171

Closed
renefritze opened this issue Oct 13, 2015 · 15 comments
Closed

scipy's spilu doesn't accept some string args #171

renefritze opened this issue Oct 13, 2015 · 15 comments
Labels
Milestone

Comments

@renefritze
Copy link
Member

spilu errors out with Type Error in

        return _superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr,
>                             ilu=True, options=_options)
E       TypeError: 'str' does not support the buffer interface

passing only matrix, drop_tol=options['spilu_drop_tol'], fill_factor=options['spilu_fill_factor'] works around that issue

@sdrave
Copy link
Member

sdrave commented Oct 13, 2015

LGTM. Has scipy an open issue for this?

@renefritze
Copy link
Member Author

Nope, not even a closed one. And their tests pass for python 3.{3,4,5}.

@sdrave
Copy link
Member

sdrave commented Oct 15, 2015

Have you tried encoding the strings to bytes before passing them to scipy?

@renefritze
Copy link
Member Author

Yeah, I did. Threw a different error that I understood even less, which is why this ticket exists 😉

@sdrave
Copy link
Member

sdrave commented Oct 19, 2015

I just checked with current scipy master: Passing permc_spec to work, only drop_rule fails. Can you confirm that with your scipy installation?

@renefritze
Copy link
Member Author

Confirmed (python 3.5)

@sdrave
Copy link
Member

sdrave commented Oct 22, 2015

Yeah, I did. Threw a different error that I understood even less, which is why this ticket exists 😉

What error message did you get? I get the following:

In [4]: scipy.sparse.linalg.spilu(A, drop_rule='basic,area'.encode('UTF-8'))
/home/stephan/.virtualenvs/pymor34/lib/python3.4/site-packages/scipy/sparse/linalg/dsolve/linsolve.py:305: SparseEfficiencyWarning: splu requires CSC matrix format
  warn('splu requires CSC matrix format', SparseEfficiencyWarning)
Writing out traceback for vim ...
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-98147bd99f5d> in <module>()
----> 1 scipy.sparse.linalg.spilu(A, drop_rule='basic,area'.encode('UTF-8'))

/home/stephan/.virtualenvs/pymor34/lib/python3.4/site-packages/scipy/sparse/linalg/dsolve/linsolve.py in spilu(A, drop_tol, fill_factor, drop_rule, permc_spec, diag_pivot_thresh, relax, panel_size, options)
    319         _options.update(options)
    320     return _superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr,
--> 321                           ilu=True, options=_options)
    322 
    323 

TypeError: 'str' does not support the buffer interface

so it seems the bytes are converted back to str in scipy.

@renefritze
Copy link
Member Author

RIght. But then we cannot win atm, or can we?

@sdrave
Copy link
Member

sdrave commented Nov 6, 2015

Ok, so I guess we should file a bug report ...

@sdrave sdrave added this to the 0.5 milestone May 3, 2016
sdrave pushed a commit that referenced this issue May 4, 2016
sdrave pushed a commit that referenced this issue May 4, 2016
@sdrave sdrave added the bug label Oct 26, 2016
@renefritze
Copy link
Member Author

Still happening on current scipy master and 0.18.1. Reported: scipy/scipy#6917

@renefritze
Copy link
Member Author

The scipy bug has supposedly been fixed. I haven't tried yet, but I propose we wait till the next scipy release to revert the workaround and then pin >= that release in requirements.

@sdrave
Copy link
Member

sdrave commented Feb 9, 2017

I do not think that support for theses arguments is a reason to require a newer scipy (I have never used them). What about changing the try-except to a dispatch on the scipy and Python version?

Is this already in the latest scipy release?

@renefritze
Copy link
Member Author

Is this already in the latest scipy release?

The latest release is 0.18.1 from September 2016, so no.

Btw I get lots of test failures with scipy master because someone tried to parse the scipy version with this:

>               if list(map(int, scipy.version.version.split('.'))) >= [0, 14, 0]:
E               ValueError: invalid literal for int() with base 10: 'dev0+9e87f45'

Otherwise dispatching on version would be ok with me.

@sdrave
Copy link
Member

sdrave commented Nov 21, 2017

The error should be gone due to #405 ...

@sdrave
Copy link
Member

sdrave commented Nov 22, 2017

Has landed in SciPy 0.19. See 34daa3d.

@sdrave sdrave closed this as completed Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants