h5py: OSError: Unable to create file (unable to lock file, errno = 11, error message = 'Resource temporarily unavailable')

To assist reproducing bugs, please include the following:

  • Operating System: CentOS 6.9
  • Python version: Python 3.6.6 (Anaconda, Inc
  • h5py version: 2.8.0
  • HDF5 version: 1.10.1
  • The full traceback/stack trace shown:

OSError                                   Traceback (most recent call last)
~/pafnucy/pdbbind_data.py in <module>()
    141 
    142 
--> 143 with h5py.File('%s/core2013.hdf' % path, 'w') as g:
    144     j = 0
    145 

~/.conda/envs/pafnucy_env/lib/python3.6/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
    310             with phil:
    311                 fapl = make_fapl(driver, libver, **kwds)
--> 312                 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
    313 
    314                 if swmr_support:

~/.conda/envs/pafnucy_env/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    146         fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl)
    147     elif mode == 'w':
--> 148         fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
    149     elif mode == 'a':
    150         # Open in append mode (read/write).

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.create()

OSError: Unable to create file (unable to lock file, errno = 11, error message = 'Resource temporarily unavailable')

h5py.version.info contains the needed versions, which can be displayed by:

Summary of the h5py configuration

h5py 2.8.0 HDF5 1.10.2 Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51) [GCC 7.2.0] sys.platform linux sys.maxsize 9223372036854775807 numpy 1.14.5

Hi all,

I am having this issue with a software recently installed, for some reason when I am trying to run the script with ipython, it returns the aformentioned traceback, I am afraid hdf5/h5py is a big mystery for me so while I am looking for a solution I thought I’d post this error and ask for help; so from your experience, does it ring any bell ? If you need anymore information please let me know.

Best wishes,

    Boris TOUZEAU

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 16

Most upvoted comments

OK, Thank you I solved the issue.

You was right, I tried to write a file that already existed, hence the script pointing to the different opening modes (w --> write, a–> read and write). My mistake for launching scripts several times.

Best wishes,

Boris TOUZEAU

Dear Boris,

Your traceback is hard to understand, are you trying to open the same file using different modes (r, w, a, etc)? Then you need to close after each create or open statement.

By default, the hdf5 library allows only one r/w access (mode = r+, w, or a), but many read-only.

I have also noticed that I get the same error message (can not lock file), when I try to access a file in ‘r+’ mode on a read-only file system, which is oke to me.

Greetings, Richard

On 5 July 2018 at 05:21, samarre notifications@github.com wrote:

To assist reproducing bugs, please include the following:

  • Operating System: CentOS 6.9
  • Python version: Python 3.6.6 (Anaconda, Inc
  • h5py version: 2.8.0
  • HDF5 version: 1.10.1
  • The full traceback/stack trace shown:

OSError Traceback (most recent call last) ~/pafnucy/pdbbind_data.py in () 141 142 –> 143 with h5py.File(‘%s/core2013.hdf’ % path, ‘w’) as g: 144 j = 0 145

~/.conda/envs/pafnucy_env/lib/python3.6/site-packages/h5py/_hl/files.py in init(self, name, mode, driver, libver, userblock_size, swmr, **kwds) 310 with phil: 311 fapl = make_fapl(driver, libver, **kwds) –> 312 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr) 313 314 if swmr_support:

~/.conda/envs/pafnucy_env/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr) 146 fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl) 147 elif mode == ‘w’: –> 148 fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl) 149 elif mode == ‘a’: 150 # Open in append mode (read/write).

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.create()

OSError: Unable to create file (unable to lock file, errno = 11, error message = ‘Resource temporarily unavailable’)

h5py.version.info contains the needed versions, which can be displayed by:

‘Summary of the h5py configuration\n---------------------------------\n\nh5py 2.8.0\nHDF5 1.10.2\nPython 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51) \n[GCC 7.2.0]\nsys.platform linux\nsys.maxsize 9223372036854775807\nnumpy 1.14.5\n’

Hi all,

I am having this issue with a software recently installed, for some reason when I am trying to run the script with ipython, it returns the aformentioned traceback, I am afraid hdf5/h5py is a big mystery for me so while I am looking for a solution I thought I’d post this error and ask for help; so from your experience, does it ring any bell ? If you need anymore information please let me know.

Best wishes,

Boris TOUZEAU

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/h5py/h5py/issues/1066, or mute the thread https://github.com/notifications/unsubscribe-auth/ADi7qgzaFmuZJuJWE-QXckra66mso9U8ks5uDYYlgaJpZM4VDMhH .

To those who observe this too, try closing/killing all process that you suspect might be accessing the same hdf5 file. In my case, it was a notebook so I had to restart the kernel. HTH

Thank you for the quick answer but I am not reading anything, only trying to open as write the file core2013.hdf. I believe since it does not exist that it will be created during the process.

I am told that I cannot and I am shown the 2 following paragraphs linking to h5py folder and the scripts it uses. I do not really understand them but I guess they must be the one called when creating the file to format it as hdf5.

Best,

Boris

Keeping a backup copy of the file is the only way from what I’ve seen. Another option is to mv the file to another location, sometimes that helps.

Dear Wugewuxing,

I realized that in my case, I had an error due to my code, essentially iI checked if some files existed at a specific folder.

==> if [[ ! -e $mol2file ]]; then

When commenting this line (because my files already existed actually), I was able to run my script. I am not too sure if your issue is really related to h5py. So my first advice would be to check on the other tasks in your script, see if something is conflicting with what you want to do, and check for the path.

Best wishes,

Boris

Le jeu. 14 mars 2019 à 10:00, wugewuxing notifications@github.com a écrit :

Dear Boris, @samarre https://github.com/samarre Have you solved your problem? I met the same problem as you. Do you know how you solved it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/h5py/h5py/issues/1066#issuecomment-472674458, or mute the thread https://github.com/notifications/unsubscribe-auth/Am9AW6lAj-Lc4bnaXcziy5-EEo1hcv4uks5vWa0ggaJpZM4VDMhH .