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
Raster Calculator panics (Permission error) #202
Comments
I have not used docker, so I don't know why docker behaves differently than a regular installation using conda. You can check the file permission of the WhiteboxTools binary in the following path and change the permission
The whitebox python package should handle the permission during installation. Not sure why it does not work with docker. https://github.com/giswqs/whitebox-python/blob/master/whitebox/download_wbt.py#L101
|
Hello. Thanks for the quick answer. I have just checked this one again and made sure that all files in "/usr/local/lib/python3.8/dist-packages/whitebox" have the permission 0755. My Docker build does nothing else then installing whitebox from Pypi, then calling a Python script that imports the whitebox tools (and by this triggering the latest binary download). But unfortunately I get the same permission error:
I have no problems running other whitebox tools in the same Docker container. Right now I solved my issue with calling the in_place_multiply & subtract tools, but I come to my limits and would need some kind of raster calculation logic. Looking at the code in whitebox-tools-app/src/tools/mod.rs:1258:26,
I wonder if this OS Error 13 might be a rust issue and that the arguments to this command are not properly passed? |
Do you mean that all WBT tools work with Python except |
Yes. Exactly. I use probably ~15 tools I call in a larger Python script (having some other non-related thematical issues still), but none of them throw an error. The raster calculator is the only one panicking. |
Then this is probably an issue related to the WBT backend rather than the Python frontend. |
I use Docker via WSL2 on Windows. Seems I am not the only one who experienced this issue. |
Anything I could do here? |
Have you tried it directly on Windows without using WSL2? |
Sorry for my late replay. I tried directly with a Python 3.8 on Windows 10 and it works as it should. I tried on a vanilla Ubuntu with Python 3.8 in WSL and it failed with a similar error:
|
It looks like your WBT folder is currently in a directory that you do not have write privileges for. The WhiteboxTools executable will attempt to write to the settings.json file contained in the WBT directory when you run a tool. |
The command being executed is:
My observations is that both on a WSL Linux as well as in Docker linux container the default install of Whitebox tools as Python package (Download of the tool) creates a problematic permission. Seems I need to execute my script as root. The WD for instance is the default WD: /usr/local/lib/python3.8/dist-packages/whitebox |
That means the package was incorrectly installed to a system directory rather than a user directory. That's probably the way how docker or WSL was set up. You need to make sure the package is installed to a directory you have write permission to. |
@giswqs, agreed! |
I think I found the issue. I had set my Docker image build script to even set the permissions to 0777 to the folder /usr/local/lib/python3.8/dist-packages/whitebox. The result can be seen here:
But I kept on getting the same problem, despite giving all permission possible in the Docker build to the correct folder. When opening a shell to my running container afterwards, I found that I still had folders being created after my Docker image was build. This is how it looks in the running container:
Because the new folders where missing at build time the correct permissions were never set on them and I got the permission error and panic error again. So far I initialised the Docker image with the following script to make sure the whitebox binary is downloaded already on Docker build time:
I need to find out how to get the additional files and folders being created on in the docker image at build time. |
Solution:
This downloads all files and when additionally setting the permissions, I have no permission errors/panics in my container later on. |
Thanks for all your fast feedback and help. Very much appreciated! |
In reference to #197 I experience the same issue with a dockerized Python install. For me the raster_calculator results in the same failure and backtrace. I find it a pity that the raster calculator doesn't work out of the box with a Python install and would hope the Python would get fixed.
By the way, thanks for the great work on these tools!
The text was updated successfully, but these errors were encountered: