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

Inference problem: permission error #40

Open
Tommytom28 opened this issue Jan 7, 2025 · 8 comments
Open

Inference problem: permission error #40

Tommytom28 opened this issue Jan 7, 2025 · 8 comments

Comments

@Tommytom28
Copy link

Although Loghi worked fine a couple of days ago, I now run into a problem when I run inference-pipeline.sh. The .xml file only contains the lines, not any text. It appears that the HTR models doesn't work because of a permission error, as I get this feedback:

PermissionError: [Errno 13] Permission denied: '/tmp/tmp.gMb7lKokXj/output/'

Any idea how to fix this?

My apologies if I overlook something obvious, I'm completely new to this.

log.txt

@rvankoert
Copy link
Collaborator

That's odd. The model appears to load fine, and since the output dir is created earlier in the process this code should not have been called. Could you sent me your

  • inference-pipeline.sh (or mention what you have changed).
  • the results of the command "ls -la /tmp/tmp.gMb7lKokXj/"

@Tommytom28
Copy link
Author

The temporary folder has since been deleted, but if I repeat the process and run the command on the new folder I get these results:

tomas@tomas-MacBookAir6-2:~/loghi$ ls -la /tmp/tmp.f1rCsLqVyL/
total 28
drwx------ 4 tomas tomas 4096 Jan 8 10:07 .
drwxrwxrwt 22 root root 4096 Jan 8 10:07 ..
drwxrwxr-x 2 tomas tomas 4096 Jan 8 10:07 imagesnippets
-rw-rw-r-- 1 tomas tomas 0 Jan 8 10:07 lines.txt
-rw-rw-r-- 1 tomas tomas 8891 Jan 8 10:08 log.txt
drwxrwxr-x 2 tomas tomas 4096 Jan 8 10:07 output

I can't upload the .sh file here, but in inference-pipeline.sh I have changed the following lines (and these lines only):

LAYPABASELINEMODEL=/home/tomas/Downloads/general/baseline/config.yaml
LAYPABASELINEMODELWEIGHTS=/home/tomas/Downloads/general/baseline/model_best_mIoU.pth

HTRLOGHIMODEL=/home/tomas/Downloads/generic-2023-02-15

GPU=-1

@rvankoert
Copy link
Collaborator

Are you running on OSX? It is known that there might be issues and we don't officially support it, but let's try anyway.
Based on the information you provided it should work, but somehow an error is raised anyway. As a workaround you could try to remove line~72:
mkdir -p "$tmpdir"/output

That might work as the directory won't exist when the erroring code is called, and the directory should be created automatically.

It's entirely a guess though. If it doesn't work I'll dive deeper into the code. Just to make sure: earlier when everything was running fine was that the same machine and code?

@Tommytom28
Copy link
Author

Thanks, unfortunately the workaround didn't work and produced the same error. I installed Ubuntu 24.04.1LS on an old intel macbook. Initially this worked fine and I managed to create some .xml files with text included on the same machine and with the same code.

Maybe some security/authorization issue is causing the error? I just noticed in system > Users that my account locks down and requires authentication randomly (see screenshot, 'some settings are locked'). I now suspect that my setup or something else on my end is causing the error, not the Loghi script.

Screenshot from 2025-01-08 14-24-16

@rvankoert
Copy link
Collaborator

If it's linux on intel it should just work. The fact that some settings are locked is normal. It might be something in your install, but I have some doubts. We could try a teams meeting on Friday to make it a bit easier to track down the cause.

@rvankoert
Copy link
Collaborator

one final thing to try: could you try with the latest version? 2.2.0 was released this morning. You only need to download inference-pipeline.sh and change the same things as earlier. I don't think it will provide a fix, but it is worth a shot.

@Tommytom28
Copy link
Author

I've tried 2.2.0, but unfortunately I encountered the same problem (see log attached). It would be wonderful if you could have a look at it over a teams meeting on Friday or some other day, just let me know what time suits you.

log.txt

@rvankoert
Copy link
Collaborator

After some investigation we found the cause: the default inference-pipeline.sh script does not work correctly if used in conjunction with docker installed via snap. Some extra file system isolation is caused by snap. If Docker is installed via regular methods (e.g.: apt / rpm /yum) there is no problem.
There are two workarounds available:

  1. install docker via something other than snap (best)
  2. replace line ~73:
    tmpdir=$(mktemp -d)
    with
    tmpdir=$(mktemp -d -p ~/)
    and make sure all required files are found within a (sub-) dir of your home directory. This second method is currently not preferred.

We will look into changing the inference script separately so later versions do work out of the box with docker installs via snap.

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

2 participants