Patch motion tiff_h_4_2_0.py

Hi,

We have some issues with patch motion correction jobs, that fails with this error:

[CPU: 83.8 MB]   Traceback (most recent call last):
  File "cryosparc_worker/cryosparc_compute/run.py", line 71, in cryosparc_compute.run.main
  File "/opt/bioxray/programs/cryosparc2/cryosparc2_worker/cryosparc_compute/jobs/jobregister.py", line 362, in get_run_function
    runmod = importlib.import_module(".."+modname, __name__)
  File "/opt/bioxray/programs/cryosparc2/cryosparc2_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1050, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "cryosparc_worker/cryosparc_compute/jobs/motioncorrection/run_patch.py", line 11, in init cryosparc_compute.jobs.motioncorrection.run_patch
  File "/opt/bioxray/programs/cryosparc2/cryosparc2_worker/cryosparc_compute/blobio/tiff.py", line 10, in <module>
    import libtiff
  File "/opt/bioxray/programs/cryosparc2/cryosparc2_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/site-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF, TIFF3D
  File "/opt/bioxray/programs/cryosparc2/cryosparc2_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/site-packages/libtiff/libtiff_ctypes.py", line 124, in <module>
    f = open(fn, 'w')
PermissionError: [Errno 13] Permission denied: '/opt/bioxray/programs/cryosparc2/cryosparc2_worker/deps/anaconda/envs/cryosparc_worker_env/lib/python3.7/site-packages/libtiff/tiff_h_4_2_0.py'

Funny thing is that the tiff_h_4_2_0.py file that cryosparc claims permission denied on, is not even installed on the worker, nor is the file a part of libtiff-4.2.0 wich cryosparc claims to use.
Any idea of what is going on here?

//Jesper

Hi Jesper, this is caused by the TIFF Python library included with cryoSPARC - it’s trying to write a file into cryoSPARC’s dependencies directory that it needs to do some internal operation.

Can you try giving the cryoSPARC user permission to write to this folder? To do so, log in as the user account that runs cryoSPARC into the machine where the cryosparc2_worker bundle is installed. Then run this command:

chmod -R +w /opt/bioxray/programs/cryosparc2/cryosparc2_worker/deps

Let me know how that goes.

1 Like

We have this issue too but it’s a cluster install and the worker folder on the cluster is shared among many nodes. Making it writable is not something we can support.

Incidentally, if anyone else runs into this. This may have been originally due to a goof installing an 2.x version of the worker package and then trying to upgrade it to 3.2. The libtiff library isn’t pip built until used. We manually went in as a root account with write privileges to the worker install location and ran:

  • conda activate /cryosparc2_worker/deps/anaconda/envs/cryosparc_worker_env
  • python
    [GCC 9.3.0] on linux
    Type “help”, “copyright”, “credits” or “license” for more information.
  • import libtiff
1 Like

@presleydc this is great insight, thanks! We’ll include the import libtiff in the installer script so that future installations don’t have to do this manually.

1 Like

@nfrasser We had to patch libtiff_ctypes.py in order to find tiff.h at the proper place.

Hello, this issue is now fixed in the latest cryoSPARC v3.3. New installations no longer require any workarounds to get the TIFF libraries to work.