Uploaded smaller sample example 
(http://docs.scipy.org/doc/scipy/reference/sparse.html) using numpy/scipy.

This smaller sample example uses the numpy.random module but the result is 
the same as the previous sample example which didn't use any random module 
or function.  As before, this sample example:

a. works with the Python interpreter
> b. works when calling just the .pyd (generated with cython)
> c. doesn't work with pyinstaller


It appears that the Python//Lib//tempfile.py is called, which imports 
random but instead of loading the Python//Lib/random module it loads the 
numpy.random module (which doesn't have a Random). So, somewhere along the 
line, pyinstaller is not re-setting sys.path.

Anyway, you will probably have a much better explanation and solution and 
look forward to it.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


python ..//pyinstaller-develop//pyinstaller.py --noconfirm --log-level=ERROR 
--onedir --console --nowindowed tto.spec

Attachment: tto.spec
Description: Binary data

import other


if __name__ == '__main__':
    other.solve()
## usage: python setup.py build_ext --inplace

import numpy

from distutils.core import setup
# from distutils.extension import Extension
from Cython.Distutils.extension import Extension
from Cython.Distutils import build_ext


ext_modules = [Extension("other", ["other.pyx"])]

setup(
    cmdclass = {'build_ext': build_ext},
    ext_modules = ext_modules,
    include_dirs=[numpy.get_include()]
    )

# http://docs.scipy.org/doc/scipy/reference/sparse.html

import numpy
# cimport numpy

import scipy
from scipy.sparse import lil_matrix
from scipy.sparse.linalg import spsolve
from numpy.linalg import solve, norm
from numpy.random import rand


def do_arrays():
    print "numpy array=", numpy.array([12, 23, 34, 45, 56, 67, 78, 89, 90])
    print "numpy version=", numpy.__version__
    print "scipy version=", scipy.__version__
    solve()
    return
    
def solve():

    A = lil_matrix((1000, 1000))
    A[0, :100] = rand(100)
    A[1, 100:200] = A[0, :100]
    A.setdiag(rand(1000))

    # Now convert it to CSR format and solve A x = b for x:
    A = A.tocsr()
    b = rand(1000)
    x = spsolve(A, b)
    
    # Convert it to a dense matrix and solve, and check that the result is the same:
    x_ = solve(A.todense(), b)
    print "x:", x_
    return

Attachment: other.pyx
Description: Binary data

Reply via email to