Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in PSD Generation #3

Open
lcolok opened this issue Jun 24, 2023 · 0 comments
Open

Error in PSD Generation #3

lcolok opened this issue Jun 24, 2023 · 0 comments

Comments

@lcolok
Copy link

lcolok commented Jun 24, 2023

I hope this message finds you well. I wanted to provide some feedback regarding the auto_undercoat code that I have been using on Linux with Docker. I encountered an issue during the final stage of PSD generation, which I did not experience when running the Colab version of the code.

Here is the specific error traceback that occurred:

au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/gradio/routes.py", line 337, in run_predict
au_container_test    |     output = await app.get_blocks().process_api(
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/gradio/blocks.py", line 1015, in process_api
au_container_test    |     result = await self.call_function(
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/gradio/blocks.py", line 833, in call_function
au_container_test    |     prediction = await anyio.to_thread.run_sync(
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
au_container_test    |     return await get_asynclib().run_sync_in_worker_thread(
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
au_container_test    |     return await future
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
au_container_test    |     result = context.run(func, *args)
au_container_test    |   File "/home/auto_undercoat/app.py", line 56, in undercoat
au_container_test    |     filename = save_psd(
au_container_test    |   File "/home/auto_undercoat/undercoat/utils.py", line 47, in save_psd
au_container_test    |     psd.write(fd2)
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/core.py", line 281, in write
au_container_test    |     self.layer_and_mask_info.write(fd, self)
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/layers.py", line 1430, in write
au_container_test    |     self.layer_info.write(fd, header)
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/layers.py", line 1226, in write
au_container_test    |     layer.write_channel_data(fd, header)
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/layers.py", line 1120, in write_channel_data
au_container_test    |     lengths.append(data.write(fd, header, shape))
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/layers.py", line 602, in write
au_container_test    |     codecs.compress_image(
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/codecs.py", line 488, in compress_image
au_container_test    |     return compressors[compression](fd, image, depth, version)
au_container_test    |   File "/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/codecs.py", line 331, in compress_rle
au_container_test    |     packed = packbits.encode(row)
au_container_test    | NameError: name 'packbits' is not defined

After conducting some research, it appears that the issue lies within the pytoshop library. I came across an article that addresses this problem and provides a solution. You can find it here: Article Link

To address this issue, I made the following modifications in the Dockerfile used to build the image:

RUN git clone https://github.com/mattyamonaca/auto_undercoat;

RUN cd auto_undercoat && \
    conda activate py3.10.6 && \
    pip install -r requirements.txt && \
    cd /

RUN conda activate py3.10.6 && \
    pip install packbits

RUN codecs_file="/root/miniconda/envs/py3.10.6/lib/python3.10/site-packages/pytoshop/codecs.py" && \
    backup_file="${codecs_file}.bak" && \
    cp "${codecs_file}" "${backup_file}" && \
    sed -i 's/from \. import packbits/import packbits/g' "${codecs_file}"

RUN echo "Modification complete. pytoshop should now work correctly."

I hope this information is helpful for resolving the issue. I appreciate the effort you have put into developing auto_undercoat, and I would like to encourage you to continue optimizing this project. It has great potential to benefit the community of users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant