Can't run .p3d with packaged scipy on win_i386 with 1.9.4

Hey,

So I’ve downloaded .whl files for scipy and numpy+mkl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
I extracted the source after installation and created panda3d packages for each. I then create a dummy program that calls a scipy routine. I use ppackage to build and it builds just fine, but with some warnings about how it can’t add certain python files. The dummy program runs fine when it doesn’t use numpy / scipy, but gives this exact same error when I incorporate either numpy, scipy, or both:

:PackageInfo: Package panda3d uses 104 MB
:PackageInfo: Package morepy uses 16 MB
Traceback (most recent call last):
  File "C:\buildslave\rtdist-windows-i386\build\built\direct\p3d\AppRunner.py", line 844, in addPackageInfo
  File "C:\buildslave\rtdist-windows-i386\build\built\direct\p3d\PackageInfo.py", line 1135, in installPackage
  File "VFSImporter", line 523, in reloadSharedPackages
  File "VFSImporter", line 498, in reloadSharedPackage
  File "VFSImporter", line 435, in load_module
AttributeError: 'module' object has no attribute '__path__'

My dummy python file (front.py):

import sys
sys.path.insert(0,'.\\')


def main():

    from scipy.interpolate.interpolate import interp2d
    import numpy as np

    x = np.arange(-5.01, 5.01, 0.25)
    y = np.arange(-5.01, 5.01, 0.25)
    xx, yy = np.meshgrid(x, y)
    z = np.sin(xx**2+yy**2)
    f = interp2d(x, y, z, kind='cubic')
    print "Finished!"


if __name__ == '__main__':
    sys.exit(main())

My .pdef file:

import sys

sys.path.insert(0,'')
sys.path.insert(0,'src')
packager.setHost('file:///C:/Users/<path>/<to>/<my>/<Packages>/')

class numpy(package):
    module('numpy')
    module('numpy.*')
    module('numpy.*.*')
    dir('src/numpy',newDir='numpy')

class scipy(package):
    require('numpy', host='file:///C:/Users/<path>/<to>/<packages>/')
    module('scipy')
    module('scipy.*')
    module('scipy.*.*')
    dir('src/scipy',newDir='scipy')

class TestP3D(p3d):
    require('morepy','panda3d') # include some other packages
    require('scipy', host='file:///C:/Users/<path>/<to>/<packages>/')
    require('numpy', host='file:///C:/Users/<path>/<to>/<packages>/')

    config( 
        version="0.0", 
        display_name="TestP3D") 
 
    main('front.py')

I call

ppython build.py build

My build.py file is:


import subprocess
import sys

p=sys.argv[1]

destDir='.\\'
pdef='all.pdef'
ppython="ppython"
if p == "build":
    ppackage="C:\\Panda3D-1.9.4\\direct\\p3d\\ppackage.py"
    args=[ppython, ppackage,  "-i",destDir,pdef]

p = subprocess.Popen(args).communicate(input=None)

I checked the contents of my .p3d file using

multify -t -f TestP3D.0.0.win_i386.p3d

and I get the following, which does contain scipy/interpolate/interpolate.pyc:

__main__.pyc
p3d_info.xml
scipy/__init__.pyc
scipy/_build_utils/__init__.pyc
scipy/_build_utils/_fortran.pyc
scipy/_lib/__init__.pyc
scipy/_lib/_ccallback.pyc
scipy/_lib/_ccallback_c.pyd
scipy/_lib/_threadsafety.pyc
scipy/_lib/_util.pyc
scipy/_lib/_version.pyc
scipy/_lib/decorator.pyc
scipy/_lib/six.pyc
scipy/interpolate/__init__.pyc
scipy/interpolate/_bspl.pyd
scipy/interpolate/_fitpack.pyd
scipy/interpolate/_ppoly.pyd
scipy/interpolate/dfitpack.pyd
scipy/interpolate/fitpack.pyc
scipy/interpolate/fitpack2.pyc
scipy/interpolate/interpnd.pyd
scipy/interpolate/interpolate.pyc
scipy/interpolate/ndgriddata.pyc
scipy/interpolate/polyint.pyc
scipy/interpolate/rbf.pyc
scipy/linalg/__init__.pyc
scipy/linalg/_decomp_update.pyd
scipy/linalg/_fblas.pyd
scipy/linalg/_flapack.pyd
scipy/linalg/_flinalg.pyd
scipy/linalg/_solve_toeplitz.pyd
scipy/linalg/basic.pyc
scipy/linalg/blas.pyc
scipy/linalg/decomp.pyc
scipy/linalg/decomp_cholesky.pyc
scipy/linalg/decomp_lu.pyc
scipy/linalg/decomp_qr.pyc
scipy/linalg/decomp_schur.pyc
scipy/linalg/decomp_svd.pyc
scipy/linalg/flinalg.pyc
scipy/linalg/lapack.pyc
scipy/linalg/linalg_version.pyc
scipy/linalg/matfuncs.pyc
scipy/linalg/misc.pyc
scipy/linalg/special_matrices.pyc
scipy/sparse/__init__.pyc
scipy/sparse/_csparsetools.pyd
scipy/sparse/_sparsetools.pyd
scipy/sparse/base.pyc
scipy/sparse/bsr.pyc
scipy/sparse/compressed.pyc
scipy/sparse/construct.pyc
scipy/sparse/coo.pyc
scipy/sparse/csc.pyc
scipy/sparse/csgraph/__init__.pyc
scipy/sparse/csgraph/_min_spanning_tree.pyd
scipy/sparse/csgraph/_reordering.pyd
scipy/sparse/csgraph/_shortest_path.pyd
scipy/sparse/csgraph/_tools.pyd
scipy/sparse/csgraph/_traversal.pyd
scipy/sparse/csr.pyc
scipy/sparse/data.pyc
scipy/sparse/dia.pyc
scipy/sparse/dok.pyc
scipy/sparse/extract.pyc
scipy/sparse/lil.pyc
scipy/sparse/linalg/__init__.pyc
scipy/sparse/linalg/dsolve/__init__.pyc
scipy/sparse/linalg/dsolve/_superlu.pyd
scipy/sparse/linalg/eigen/__init__.pyc
scipy/sparse/linalg/eigen/arpack/__init__.pyc
scipy/sparse/linalg/eigen/arpack/_arpack.pyd
scipy/sparse/linalg/isolve/__init__.pyc
scipy/sparse/linalg/isolve/_iterative.pyd
scipy/sparse/sputils.pyc
scipy/spatial/__init__.pyc
scipy/spatial/_distance_wrap.pyd
scipy/spatial/_hausdorff.pyd
scipy/spatial/_voronoi.pyd
scipy/spatial/ckdtree.pyd
scipy/spatial/distance.pyc
scipy/spatial/kdtree.pyc
scipy/spatial/qhull.pyd
scipy/special/__init__.pyc
scipy/special/_comb.pyd
scipy/special/_ellip_harm_2.pyd
scipy/special/_ufuncs.pyd
scipy/special/basic.pyc
scipy/special/lambertw.pyc
scipy/special/orthogonal.pyc
scipy/special/sf_error.pyc
scipy/special/specfun.pyd
scipy/special/spfun_stats.pyc

Hmm, perhaps check the scipy source to see what file uses path and on what module it expects it to be present?

I did a

grep -rn __path__ 

from the numpy and scipy parent folder and got this:

numpy/lib/utils.py:906:       if import_modules and hasattr(item, '__path__'):
numpy/lib/utils.py:907:           for pth in item.__path__:
numpy/_import_tools.py:21:   parent_path = eval('__path__', frame.f_globals, frame.f_locals)

Those are all in numpy, but as seen in the .p3d contents, nothing from numpy is being put in the .p3d.

However, none of those lines are being run when I run my front.py directly from source. I’ve put print statements around all of them and I get nothing. Yes, I am importing from the local numpy / scipy folders.

However, numpy/init.py is being run when I run my front.py, but not getting imported.

I’ve tried incorporating scipy and numpy into a single package:

class scipy(package):
    module('scipy')
    module('scipy.*')
    module('scipy.*.*')
    module('numpy')
    module('numpy.*')
    module('numpy.*.*')
    dir('src/numpy',newDir='numpy')
    dir('src/scipy',newDir='scipy')

and took out the require(‘numpy’, host=‘blah/blah/blah’) from the p3d class in my .pdef

Now my .p3d contents is

__main__.pyc
distutils/__init__.pyc
distutils/cygwinccompiler.pyc
distutils/unixccompiler.pyc
libiomp5md.dll
numpy/__init__.pyc
numpy/add_newdocs.pyc
numpy/core/__init__.pyc
numpy/core/_dummy.pyd
numpy/core/memmap.pyc
numpy/core/multiarray.pyd
numpy/core/multiarray_tests.pyd
numpy/core/operand_flag_tests.pyd
numpy/core/struct_ufunc_test.pyd
numpy/core/test_rational.pyd
numpy/core/umath.pyd
numpy/core/umath_tests.pyd
numpy/ctypeslib.pyc
numpy/distutils/__config__.pyc
numpy/distutils/__init__.pyc
numpy/distutils/__version__.pyc
numpy/distutils/ccompiler.pyc
numpy/distutils/compat.pyc
numpy/distutils/conv_template.pyc
numpy/distutils/core.pyc
numpy/distutils/cpuinfo.pyc
numpy/distutils/environment.pyc
numpy/distutils/exec_command.pyc
numpy/distutils/extension.pyc
numpy/distutils/from_template.pyc
numpy/distutils/info.pyc
numpy/distutils/lib2def.pyc
numpy/distutils/log.pyc
numpy/distutils/mingw32ccompiler.pyc
numpy/distutils/misc_util.pyc
numpy/distutils/npy_pkg_config.pyc
numpy/distutils/numpy_distribution.pyc
numpy/distutils/system_info.pyc
numpy/distutils/unixccompiler.pyc
numpy/f2py/__init__.pyc
numpy/f2py/f2py_testing.pyc
numpy/fft/__init__.pyc
numpy/fft/fftpack.pyc
numpy/fft/fftpack_lite.pyd
numpy/fft/helper.pyc
numpy/fft/info.pyc
numpy/lib/__init__.pyc
numpy/lib/info.pyc
numpy/linalg/__init__.pyc
numpy/linalg/_umath_linalg.pyd
numpy/linalg/info.pyc
numpy/linalg/lapack_lite.pyd
numpy/linalg/linalg.pyc
numpy/ma/__init__.pyc
numpy/ma/core.pyc
numpy/ma/extras.pyc
numpy/polynomial/__init__.pyc
numpy/polynomial/_polybase.pyc
numpy/polynomial/chebyshev.pyc
numpy/polynomial/hermite.pyc
numpy/polynomial/hermite_e.pyc
numpy/polynomial/laguerre.pyc
numpy/polynomial/legendre.pyc
numpy/polynomial/polynomial.pyc
numpy/polynomial/polyutils.pyc
numpy/random/__init__.pyc
numpy/random/mtrand.pyd
numpy/testing/__init__.pyc
numpy/testing/decorators.pyc
numpy/testing/noseclasses.pyc
numpy/testing/nosetester.pyc
numpy/testing/utils.pyc
p3d_info.xml
scipy/__init__.pyc
scipy/_build_utils/__init__.pyc
scipy/_build_utils/_fortran.pyc

Almost everything is now numpy, only the last 3 lines are from scipy!!! Still getting exact same error when running the .p3d file $%#@!^

In my front.py file, I tried changing the ‘import numpy as np’ to ‘import scipy as np’ but still same thing.