Re: PyInstaller+ Python3.5 (h5py import error)
On Thursday, September 24, 2015 at 1:12:31 PM UTC+2, Laura Creighton wrote: > In a message of Thu, 24 Sep 2015 02:58:35 -0700, Heli Nix writes: > >Thanks Christian, > > > >It turned out that h5py.defs was not the only hidden import that I needed to > >add. > > > >I managed to get it working with the follwoing command adding 4 hidden > >imports. > > > > > >pyinstaller --hidden-import=h5py.defs --hidden-import=h5py.utils > >--hidden-import=h5py.h5ac --hidden-import=h5py._proxy test.py > > > > > >is there anyway that you can use to add all h5py submodules all together? > > > >Thanks, > > > > Yes. You can use a hook file. > see: https://pythonhosted.org/PyInstaller/#using-hook-files > > Laura Thanks Laura, Very Useful, -- https://mail.python.org/mailman/listinfo/python-list
Re: PyInstaller+ Python3.5 (h5py import error)
Thanks Christian, It turned out that h5py.defs was not the only hidden import that I needed to add. I managed to get it working with the follwoing command adding 4 hidden imports. pyinstaller --hidden-import=h5py.defs --hidden-import=h5py.utils --hidden-import=h5py.h5ac --hidden-import=h5py._proxy test.py is there anyway that you can use to add all h5py submodules all together? Thanks, -- https://mail.python.org/mailman/listinfo/python-list
Re: PyInstaller+ Python3.5 (h5py import error)
In a message of Thu, 24 Sep 2015 02:58:35 -0700, Heli Nix writes: >Thanks Christian, > >It turned out that h5py.defs was not the only hidden import that I needed to >add. > >I managed to get it working with the follwoing command adding 4 hidden >imports. > > >pyinstaller --hidden-import=h5py.defs --hidden-import=h5py.utils >--hidden-import=h5py.h5ac --hidden-import=h5py._proxy test.py > > >is there anyway that you can use to add all h5py submodules all together? > >Thanks, > Yes. You can use a hook file. see: https://pythonhosted.org/PyInstaller/#using-hook-files Laura -- https://mail.python.org/mailman/listinfo/python-list
PyInstaller+ Python3.5 (h5py import error)
Dear all, Thanks a lot for your replies. Very helpful. I have already done some trials with Virtualenv, but PyInstaller is much closer to the idea of an installer you can pass to someone. I have been using development version of PyInstaller in order to be able to use it with my script written with Python versin 3.3.5. I started with a very simple script just to test. I use the following command to create the distribution folder. pyinstaller test.py my script contains the following few lines and it runs ok on my own machine. import numpy as np import h5py a=np.arange(10) print(a) inputFiles="test.h5" with h5py.File(inputFiles, 'w') as inputFileOpen: pass I am getting the following error related to importing h5py. test returned -1 Traceback (most recent call last): File "", line 2, in File "/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py", line 311, in load_module File "/usr/lib64/python3.3/site-packages/h5py/__init__.py", line 23, in File "/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py", line 493, in load_module File "h5r.pxd", line 21, in init h5py._conv (/tmp/pip_build_root/h5py/h5py/_conv.c:6563) File "/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py", line 493, in load_module File "_objects.pxd", line 12, in init h5py.h5r (/tmp/pip_build_root/h5py/h5py/h5r.c:2708) File "/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py", line 493, in load_module File "_objects.pyx", line 1, in init h5py._objects (/tmp/pip_build_root/h5py/h5py/_objects.c:6407) ImportError: No module named 'h5py.defs' If I modify my script to import numpy as np import h5py a=np.arange(10) print(a) then, the created exectuable will run successfully on other linux machines. Does anybody have any idea why I am getting the following h5py import error? My spec file also looks like this: # -*- mode: python -*- block_cipher = None a = Analysis(['test.py'], pathex=['/home/albert/test'], binaries=None, datas=None, hiddenimports=[], hookspath=None, runtime_hooks=None, excludes=None, win_no_prefer_redirects=None, win_private_assemblies=None, cipher=block_cipher) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, exclude_binaries=True, name='test', debug=False, strip=None, upx=True, console=True ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=None, upx=True, name='test') Thank you very much in Advance for your help, -- https://mail.python.org/mailman/listinfo/python-list
Re: PyInstaller+ Python3.5 (h5py import error)
Am 23.09.15 um 18:20 schrieb Heli Nix: Dear all, Thanks a lot for your replies. Very helpful. I have already done some trials with Virtualenv, but PyInstaller is much closer to the idea of an installer you can pass to someone. I have been using development version of PyInstaller in order to be able to use it with my script written with Python versin 3.3.5. I started with a very simple script just to test. I use the following command to create the distribution folder. pyinstaller test.py my script contains the following few lines and it runs ok on my own machine. import numpy as np import h5py a=np.arange(10) print(a) inputFiles="test.h5" with h5py.File(inputFiles, 'w') as inputFileOpen: pass I am getting the following error related to importing h5py. [...] ImportError: No module named 'h5py.defs' pyinstaller guesses from the code which modules are imported. It looks like if h5py imports a module h5py.defs, which is missing. For some programs, you need to support pyinstaller with additional information, especially if modules are loaded at runtime. Try: pyinstaller --hidden-import=h5py.defs test.py If I modify my script to import numpy as np import h5py a=np.arange(10) print(a) This is another hint: obviously h5py defers module loading until you first really open a HDF5 file. There pyinstaller has no means to find this out. Christian -- https://mail.python.org/mailman/listinfo/python-list