teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

言語名、ライブラリの追加

2020/08/18 04:54

投稿

netz-eng
netz-eng

スコア105

title CHANGED
File without changes
body CHANGED
@@ -137,7 +137,7 @@
137
137
  DelayedImportError: could not import name 'lzw_decode' from 'imagecodecs'
138
138
  ```
139
139
  「lzw_decodeがインポートできませんでした」と言われたため、sample.exeの元となるsample.py内で、
140
- ```ここに言語を入力
140
+ ```python
141
141
  from imagecodecs import lzw_decode
142
142
  ```
143
143
  のコードを追加し、再度PyInstallerで.exe化しました。すると、エラーの内容が以下に変わりました。
@@ -188,4 +188,5 @@
188
188
  Python 3.8.3
189
189
  OpenCV 4.4.0.40
190
190
  tifffile 2020.8.13
191
- PyInstaller 4.0
191
+ PyInstaller 4.0
192
+ imagecodecs 2020.5.30

2

追記

2020/08/18 04:54

投稿

netz-eng
netz-eng

スコア105

title CHANGED
File without changes
body CHANGED
@@ -130,7 +130,59 @@
130
130
  name='sample')
131
131
  ```
132
132
 
133
+ ### 追記・試したこととエラー変更
134
+ 「imagecodecsがありません」と言われているのはなんとなく分かったため、imagecodecsライブラリをインストールしてみました。
135
+ すると、エラー内容が下のようになりました。エラー箇所は恐らく同じです。
136
+ ```python
137
+ DelayedImportError: could not import name 'lzw_decode' from 'imagecodecs'
138
+ ```
139
+ 「lzw_decodeがインポートできませんでした」と言われたため、sample.exeの元となるsample.py内で、
140
+ ```ここに言語を入力
141
+ from imagecodecs import lzw_decode
142
+ ```
143
+ のコードを追加し、再度PyInstallerで.exe化しました。すると、エラーの内容が以下に変わりました。
144
+ ```python
145
+ Traceback (most recent call last):
146
+ File "sample.py", line 286, in storedata
147
+ File "tifffile\tifffile.py", line 712, in imread
148
+ File "tifffile\tifffile.py", line 2651, in asarray
149
+ File "tifffile\tifffile.py", line 5455, in asarray
150
+ File "tifffile\tifffile.py", line 5320, in segments
151
+ File "tifffile\tifffile.py", line 5309, in decode
152
+ File "tifffile\tifffile.py", line 5270, in decode
153
+ File "imagecodecs\imagecodecs.py", line 459, in stub_decode
154
+ imagecodecs.imagecodecs.DelayedImportError: could not import name 'lzw_decode' from 'imagecodecs'
155
+ ```
156
+ 流石に数千行ある内容すべてを転写するのは長すぎるため、↑のtifffile.pyと、imagecodecs.pyのエラー箇所を抜粋します。
157
+ ```python
158
+ # tifffile.py
133
159
 
160
+ # line 712
161
+ return tif.asarray(**kwargs)
162
+ # line 2651
163
+ result = pages[0].asarray(out=out, maxworkers=maxworkers)
164
+ # line 5455
165
+ for in self.segments(
166
+ func=func, lock=lock, maxworkers=maxworkers, sort=True
167
+ # line 5320
168
+ yield decode(segments)
169
+ # line 5309
170
+ result = keyframe.decode(*args, **decodeargs)
171
+ # line 5270
172
+ data = decompress(data, out=size * dtype.itemsize)
173
+ ```
174
+ ```python
175
+ # imagecodecs.py
176
+
177
+ # line 459
178
+ if name.endswith('_decode'):
179
+ def stub_decode(*args, **kwargs):
180
+ f"""Stub for imagecodecs.{name}."""
181
+ raise DelayedImportError(name) # <-- line 459
182
+ ```
183
+ かなりマイナーなエラーで、非常に困っています。
184
+ 解消方法にお心当たりのある方、是非よろしくお願いします。
185
+
134
186
  ### 補足情報(FW/ツールのバージョンなど)
135
187
  Windows10
136
188
  Python 3.8.3

1

初心者アイコンの利用

2020/08/18 04:50

投稿

netz-eng
netz-eng

スコア105

title CHANGED
File without changes
body CHANGED
@@ -131,7 +131,6 @@
131
131
  ```
132
132
 
133
133
 
134
-
135
134
  ### 補足情報(FW/ツールのバージョンなど)
136
135
  Windows10
137
136
  Python 3.8.3