python-sparse: ImportError: No module named sparse (from pysparse.sparse import spmatrix)

Asked by numpy.problem@gmail.com on 2012-04-10

I am having trouble installing pysparse on ubuntu. I installed the package python-sparse, but when running the example code found in the documentation

    from pysparse.sparse import spmatrix
    from pysparse.direct import superlu
    import numpy
    n = 100
    A = poisson2d_sym_blk(n)
    b = numpy.ones(n*n)
    x = numpy.empty(n*n)
    LU = superlu.factorize(A.to_csr(), diag_pivot_thresh=0.0)
    LU.solve(b, x)

I get the error message

    Traceback (most recent call last):
      File "sparse2.py", line 1, in <module>
        from pysparse.sparse import spmatrix
    ImportError: No module named sparse

I have also tried running

    $ pip install pysparse
    Requirement already satisfied: pysparse in /usr/lib/python2.6/dist-packages
    Installing collected packages: pysparse
    Successfully installed pysparse

Why does the example code from the documentation not work?

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu python-defaults Edit question
Assignee:
No assignee Edit question
Last query:
2012-04-12
Last reply:
2012-04-16
Jeet (gour-jitendrasingh) said : #1

why you asked same question on many forum ::

neways provide output of uname -a; lsb_realese -a;

and rather copy paste program try developing your own so you will came to know

thanks

Jeet

I am having a hard time understanding you since your English is not very good. Is there an answer to my question somewhere in your reply?

thanks

Jeet (gour-jitendrasingh) said : #3

no there is no answer .. sorry for my english.

i asked you info about your ubuntu
paste output of commands

lsb_release -a; uname -a

path for latest pysparse : http://www.ubuntuupdates.org/pysparse

you can add this to /etc/apt/lists

then try

sudo apt-get update && sudo apt-get install pysparse

thanks

Jeet

I am having this problem om both my machines with different ubuntu versions:

# output on my laptop
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid
Linux laptopname 2.6.32-40-generic #87-Ubuntu SMP Mon Mar 5 20:26:31 UTC 2012 i686 GNU/Linux

# output on my stationary machine at home
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu precise (development branch)
Release: 12.4
Codename: precise
Linux homename 3.2.0-20-generic #32-Ubuntu SMP Thu Mar 22 02:22:46 UTC 2012 x86_64 x86_64 x_86_64 GNU/Linux

Can you help with this problem?

Provide an answer of your own, or ask numpy.problem@gmail.com for more information if necessary.

To post a message you must log in.