Andriy Drozdyuk
Andriy Drozdyuk

Reputation: 61041

Alternative to scipy and numpy for linear algebra?

Is there a good (small and light) alternative to numpy for python, to do linear algebra? I only need matrices (multiplication, addition), inverses, transposes and such.

Why?

I am tired of trying to install numpy/scipy - it is such a pita to get it to work - it never seems to install correctly (esp. since I have two machines, one linux and one windows): no matter what I do: compile it or install from pre-built binaries. How hard is it to make a "normal" installer that just works?

Upvotes: 12

Views: 13015

Answers (7)

eadmaster
eadmaster

Reputation: 1447

I'm surprised nobody mentioned SymPy, which is written entirely in Python and does not require compilation like Numpy.

There is also tinynumpy, which is a pure python alternative to Numpy with limited features.

Upvotes: 3

Cesc
Cesc

Reputation: 1190

Have you ever tried anaconda? https://www.anaconda.com/download This should allow it to install those packages easily.

conda install -c conda-forge scipy

conda install -c conda-forge numpy

Apart from offering you an easy way to install them in linux/mac/linux you will get virtualenviroments management too

Upvotes: 1

newhelpfriend
newhelpfriend

Reputation: 11

For people who still have the problem: Try python portable: http://portablepython.com/wiki/Download/

Upvotes: 0

jsalonen
jsalonen

Reputation: 30481

I hear you, I have been there as well. Numpy/scipy are really wonderful libraries and it is a pity that installation problems get somewhat often in the way of their usage.

Also, as far as I understand there are not very many good (easier to use) options either. The only possibly easier solution for you I know about is the "Yet Another Matrix Module" (see NumericAndScientific/Libraries listing on python.org). I am not aware of the status of this library (stability, speed, etc.). The possibility is that in the long run your needs will outgrow any simple library and you will end up installing numpy anyway.

Another notable downside on using any other library is that your code will potentially be incompatible with numpy, which happens to be the de facto library for linear algebra in python. Note also that numpy has been heavily optimized - speed is something you are not guaranteed to get with other libraries.

I would really just put more effort on solving the installation/setup problems. The alternatives are potentially much worse.

Upvotes: 2

jsbueno
jsbueno

Reputation: 110263

Given your question, I decided just factor out the matrix code from where I were using it, and put it in a publicly accessible place -

So, this is basically a pure python ad-hoc implementation of a Matrix class which can perform addition, multiplication, matrix determinant and matrix inversion - should be of some use -

Since it is in pure python, and not worried with performance at all it unsuitable for any real calculation - but it is good enough for playing around with matrices in an interactive way, or where matrix algebra is far from being the critical part of the code.

The repository is here, https://bitbucket.org/jsbueno/toymatrix/

And you can download it straight from here: https://bitbucket.org/jsbueno/toymatrix/downloads/toymatrix_0.1.tar.gz

Upvotes: 2

Lostsoul
Lostsoul

Reputation: 25999

I sometimes have this problem..not sure if this works but I often install it using my own account then try to run it in an IDE(komodo in my case) and it doesn't work. Like your issue it says it cannot find it. The way I solve this is to use sudo -i to get into root and then install it from there.

If that does not work can you update your answer to provide a bit more info about the type of system your using(linux, mac, windows), version of python/numpy and how your accessing it so it'll be easier to help.

Upvotes: 0

Related Questions