Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using SciPy in application

77 views
Skip to first unread message

Roozbeh

unread,
Apr 24, 2013, 5:13:45 AM4/24/13
to
Hi all,

I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?

Thanks in advance for your help

Oscar Benjamin

unread,
Apr 24, 2013, 7:04:27 AM4/24/13
to Roozbeh, pytho...@python.org
On 24 April 2013 10:13, Roozbeh <rooz...@gmail.com> wrote:
>
> I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?

They cannot use the function from scipy if scipy is not installed.
There are three ways round this problem:
1) Rewrite the interpolation function you need in your own code.
2) Require the user to install scipy.
3) Require the user to install some other package that has
interpolation functions.

Rewriting the interpolation function is probably not that difficult
depending on the type of interpolation you're using.


Oscar

Robert Kern

unread,
Apr 24, 2013, 7:10:57 AM4/24/13
to pytho...@python.org
On 2013-04-24 16:34, Oscar Benjamin wrote:
> On 24 April 2013 10:13, Roozbeh <rooz...@gmail.com> wrote:
>>
>> I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?
>
> They cannot use the function from scipy if scipy is not installed.
> There are three ways round this problem:
> 1) Rewrite the interpolation function you need in your own code.

Variant:

1.a) Copy the interpolation code from scipy into your own code.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Message has been deleted

Roozbeh

unread,
Apr 24, 2013, 7:29:37 AM4/24/13
to
On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
> Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help

The thing is that the SciPy code for spline interpolation imports NumPy which also I don't want to use. So, I think I will have to write the code myself I guess.

Roozbeh

unread,
Apr 24, 2013, 7:34:44 AM4/24/13
to
On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
> Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help

Any idea where can I find the recipe for the spline interpolation that does not rely on NumPy and/or SciPy and is written pure Python (no C code)?

Robert Kern

unread,
Apr 24, 2013, 7:40:14 AM4/24/13
to pytho...@python.org
If Google can't find it, it probably doesn't exist. Very few people would do
this without numpy.

Alex van der Spek

unread,
Apr 24, 2013, 7:57:39 AM4/24/13
to
On Wed, 24 Apr 2013 04:34:44 -0700, Roozbeh wrote:

The scipy interpolation routines (splev, splrep, etc.) are on netlib:

http://www.netlib.org/dierckx/

This gives you FORTRAN source codes which you will have to compile
yourself to either a DLL or an SO. Call them from python using ctypes.

I have done that for a number of the dierckx routines. No problems at all.

Hope this helps,
Alex van der Spek

Miki Tebeka

unread,
Apr 24, 2013, 9:52:50 AM4/24/13
to
> I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately.
You can pack you application with py2exe, pyinstaller ... and then they won't even need to install Python.

Another option (which is not always possible) is to make you application a web site and then only you need to install SciPy on the server.

Roozbeh

unread,
Apr 24, 2013, 10:41:53 AM4/24/13
to
On Wednesday, April 24, 2013 3:52:50 PM UTC+2, Miki Tebeka wrote:
> > I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. You can pack you application with py2exe, pyinstaller ... and then they won't even need to install Python. Another option (which is not always possible) is to make you application a web site and then only you need to install SciPy on the server.


I thought about the py2exe option but the problem is, this application is a plug-in written for Abaqus CAE and hence it will use the python version that comes with Abaqus CAE distribution and Abaqus must be able to compile the Python codes every time on the start-up otherwise it won't recognize the plug-in and thats why SciPy and NumPy are also not an option.
I guess as Alex said, I will have to use DLLs or write it myself.

Maarten

unread,
Apr 24, 2013, 10:49:44 AM4/24/13
to
On Wednesday, April 24, 2013 1:40:14 PM UTC+2, Robert Kern wrote:
> On 2013-04-24 17:04, Roozbeh wrote:
>
> > On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
>
> >> Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help
>
> > Any idea where can I find the recipe for the spline interpolation that does not rely on NumPy and/or SciPy and is written pure Python (no C code)?
>
>
> If Google can't find it, it probably doesn't exist. Very few people would do this without numpy.

A trivial 'pure python spline' google search yields this:
http://urchin.earth.li/~twic/splines.py

(Warning: old code, python 2.2 era).

Maarten

Grant Edwards

unread,
Apr 24, 2013, 3:18:40 PM4/24/13
to
On 2013-04-24, Roozbeh <rooz...@gmail.com> wrote:

> I want to use spline interpolation function from SciPy in an
> application and at the same time, I don't want the end user to have
> to install SciPy separately. Is there a way around this problem?

You could bundle you app along with python and SciPy and whatever
other libraries are required using py2exe, py2app, cx_Freeze, Freeze,
etc.

--
Grant Edwards grant.b.edwards Yow! JAPAN is a WONDERFUL
at planet -- I wonder if we'll
gmail.com ever reach their level of
COMPARATIVE SHOPPING ...
0 new messages