Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97046

Re: PyInstaller+ Python3.5 (h5py import error)

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: PyInstaller+ Python3.5 (h5py import error)
Date 2015-09-23 20:07 +0200
Organization A noiseless patient Spider
Message-ID <mtupls$7te$1@dont-email.me> (permalink)
References <4d764608-4091-4600-a1ed-ac11bd790792@googlegroups.com> <4ca597c9-5b1f-4709-a88b-5ecc78d1c590@googlegroups.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Porting Python Application to a new  linux machine Heli Nix <hemla21@gmail.com> - 2015-09-03 07:32 -0700
  Re: Porting Python Application to a new linux machine Joel Goldstick <joel.goldstick@gmail.com> - 2015-09-03 11:27 -0400
  Re: Porting Python Application to a new linux machine Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-09-03 17:31 +0200
    Re: Porting Python Application to a new linux machine Chris Angelico <rosuav@gmail.com> - 2015-09-04 01:39 +1000
    Re: Porting Python Application to a new linux machine Chris Angelico <rosuav@gmail.com> - 2015-09-04 01:55 +1000
    Re: Porting Python Application to a new linux machine Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-09-03 18:23 +0200
      Re: Porting Python Application to a new linux machine Chris Angelico <rosuav@gmail.com> - 2015-09-04 02:49 +1000
        Re: Porting Python Application to a new linux machine Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-09-03 19:29 +0200
          Re: Porting Python Application to a new linux machine Chris Angelico <rosuav@gmail.com> - 2015-09-04 03:33 +1000
  Re: Porting Python Application to a new linux machine Laura Creighton <lac@openend.se> - 2015-09-04 00:26 +0200
  Re: Porting Python Application to a new  linux machine Christian Gollwitzer <auriocus@gmx.de> - 2015-09-04 07:43 +0200
    Re: Porting Python Application to a new  linux machine Grant Edwards <invalid@invalid.invalid> - 2015-09-04 13:16 +0000
  PyInstaller+ Python3.5 (h5py import error) Heli Nix <hemla21@gmail.com> - 2015-09-23 09:20 -0700
    Re: PyInstaller+ Python3.5 (h5py import error) Christian Gollwitzer <auriocus@gmx.de> - 2015-09-23 20:07 +0200
      Re: PyInstaller+ Python3.5 (h5py import error) Heli Nix <hemla21@gmail.com> - 2015-09-24 02:58 -0700
        Re: PyInstaller+ Python3.5 (h5py import error) Laura Creighton <lac@openend.se> - 2015-09-24 13:11 +0200
          Re: PyInstaller+ Python3.5 (h5py import error) Hedieh E <hemla21@gmail.com> - 2015-09-25 01:53 -0700

csiph-web