Closed alvrogd closed 3 years ago
This is the full traceback of the error:
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3427, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-3-01155a6fbd98>", line 1, in <module>
image = GeoTiff("datasets/z1/z1_nir.tif")
File "/opt/conda/lib/python3.8/site-packages/geotiff/__init__.py", line 113, in __init__
self.tifShape: List[int] = tif.asarray().shape
File "/opt/conda/lib/python3.8/site-packages/tifffile/tifffile.py", line 3106, in asarray
result = pages[0].asarray(out=out, maxworkers=maxworkers)
File "/opt/conda/lib/python3.8/site-packages/tifffile/tifffile.py", line 6247, in asarray
for _ in self.segments(
File "/opt/conda/lib/python3.8/site-packages/tifffile/tifffile.py", line 6129, in segments
yield from executor.map(decode, segments)
File "/opt/conda/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator
yield fs.pop().result()
File "/opt/conda/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/opt/conda/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/opt/conda/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/conda/lib/python3.8/site-packages/tifffile/tifffile.py", line 6101, in decode
result = keyframe.decode(*args, **decodeargs)
File "/opt/conda/lib/python3.8/site-packages/tifffile/tifffile.py", line 5755, in decode
raise ValueError(f'TiffPage {self.index}: {exc}')
ValueError: TiffPage 0: <COMPRESSION.LZW: 5> requires the 'imagecodecs' package
Thanks for submitting this.
imagecodecs
is a dep of tifffile
. See here
I could not reproduce this error, both in a venv (fresh install) and during a recent run https://github.com/Open-Source-Agriculture/geotiff/runs/2159682261
Edit: I also did a fresh install in a conda env (I noticed you are using one) and it's all g.
I'll leave this here a while in case it comes up again
P.S. feel free to use the new version 0.1.2
Thanks for the info! Given that tifffile
is indeed in the requirements
file, the dependency should be automatically installed, so I'm starting to think that it might just be an issue with the Docker image that I'm using.
I'll try using another image later this week when I have some free time, and I'll let you know if I find out anything new.
P.S. I'll also try out the new version!
@alvrogd how did you go the re-try?
I'm also getting the same error. Even though I've installed imagecodecs, tiffile and any other required dependencies (imagecodecs-lite etc etc).
I don't understand why this is happening. I'm trying to reshape a .tiff file, and the same code worked for other tiff files earlier.
This is the full traceback:
Traceback (most recent call last): File "c:\Users\vishawjeet\Documents\Dataset\reshape.py", line 60, in <module> img=imread(path) ^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\skimage\io\_io.py", line 53, in imread img = call_plugin('imread', fname, plugin=plugin, **plugin_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\skimage\io\manage_plugins.py", line 205, in call_plugin return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\skimage\io\_plugins\tifffile_plugin.py", line 74, in imread return tifffile_imread(fname, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 1086, in imread return tif.asarray( ^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 4267, in asarray result = stack_pages(pages, out=out, maxworkers=maxworkers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 22180, in stack_pages func(page, index) File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 22175, in func page.asarray(lock=lock, out=out[index], **kwargs) File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 8923, in asarray for _ in self.segments( File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 8724, in segments yield decode(segment) ^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 8712, in decode return func(decode(*args, **decodeargs)) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vishawjeet\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tifffile\tifffile.py", line 8190, in decode_raise_compression raise ValueError(f'{exc}') ValueError: <COMPRESSION.LZW: 5> requires the 'imagecodecs' package
When trying to open a GeoTIFF file w/ LZW compression using this package, it raised an internal error about the
imagecodecs
package not being available. I believe that it may need to be added as a dependency in order to run properly on any platforms that do not have the package by default.I was running Python inside a Docker container based on
nvcr.io/nvidia/pytorch:21.02-py3
, and I installed both packages through pip in order to be able to read the file: