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

[BUG] PermissionError: [WinError 5] Access is denied with Docker or Kubernetes #4603

Closed
4 of 23 tasks
OSobky opened this issue Jul 26, 2021 · 1 comment
Closed
4 of 23 tasks
Labels
area/docker Docker use anywhere, such as MLprojects and MLmodels area/projects MLproject format, project running backends area/windows Issue is unique to windows. bug Something isn't working

Comments

@OSobky
Copy link
Contributor

OSobky commented Jul 26, 2021

Thank you for submitting an issue. Please refer to our issue policy for additional information about bug reports. For help with debugging your code, please refer to Stack Overflow.

Please fill in this bug report template to ensure a timely and thorough response.

Willingness to contribute

The MLflow Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the MLflow code base?

  • Yes. I can contribute a fix for this bug independently.
  • Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.
  • No. I cannot contribute a bug fix at this time.

System information

  • Have I written custom code (as opposed to using a stock example script provided in MLflow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • MLflow installed from (source or binary): pip
  • MLflow version (run mlflow --version): 1.18.0
  • Python version: 3.7.10
  • npm version, if running the dev UI:
  • Exact command to reproduce: mlflow run examples/docker -P alpha=0.5 or mlflow run examples/docker -P alpha=0.5 --backend kubernetes --backend-config kubernetes_config.json

Describe the problem

Describe the problem clearly here. Include descriptions of the expected behavior and the actual behavior.

I work on my company laptop which may be the reason this bug happened. I have been trying to use MLflow projects in Docker environment or with Kubernetes as backend. However when I try to run it, it produces PermissionError. The error is produced whenever MLflow tries to remove the temp directory it created in _create_docker_build_ctx function. this is the exact line that produces the error

shutil.rmtree(directory)

Code to reproduce issue

Provide a reproducible test case that is the bare minimum necessary to generate the problem.

Clone MLflow repository and try to run the docker container with the following commands:

  • mlflow run examples/docker -P alpha=0.5
  • mlflow run examples/docker -P alpha=0.5 --backend kubernetes --backend-config kubernetes_config.json

Other info / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

Traceback (most recent call last):

File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\xx\Anaconda3\envs\mlflow-projects\Scripts\mlflow.exe_main
.py", line 7, in
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\click\core.py", line 1137, in call
return self.main(*args, **kwargs)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\click\core.py", line 763, in invoke
return callback(*args, **kwargs)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\cli.py", line 181, in run
run_id=run_id,
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\projects_init
.py", line 304, in run
synchronous=synchronous,
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\projects_init
.py", line 99, in _run
experiment_id,
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\projects\backend\local.py", line 76, in run
run_id=active_run.info.run_id,
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\projects\docker.py", line 65, in build_docker_image
build_ctx_path = _create_docker_build_ctx(work_dir, dockerfile)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\site-packages\mlflow\projects\docker.py", line 137, in _create_docker_build_ctx
shutil.rmtree(directory)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 516, in rmtree
return _rmtree_unsafe(path, onerror)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 395, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 395, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 395, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
[Previous line repeated 1 more time]
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 400, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "c:\users\xx\anaconda3\envs\mlflow-projects\lib\shutil.py", line 398, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\Users\xxx\AppData\Local\Temp\tmpzm3h9gtc\mlflow-project-contents\.git\objects\01\901b5494e36bbb8c92437dd4d69853a6d70469'

What component(s), interfaces, languages, and integrations does this bug affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: Local serving, model deployment tools, spark UDFs
  • area/server-infra: MLflow server, JavaScript dev server
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, JavaScript, plotting
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations
@OSobky OSobky added the bug Something isn't working label Jul 26, 2021
@github-actions github-actions bot added area/docker Docker use anywhere, such as MLprojects and MLmodels area/projects MLproject format, project running backends area/windows Issue is unique to windows. labels Jul 26, 2021
harupy added a commit that referenced this issue Dec 7, 2021
* Solved the access error

Signed-off-by: osobky <omar_sobky@hotmail.com>

* use more conservative function

Signed-off-by: harupy <hkawamura0130@gmail.com>

* comment

Signed-off-by: harupy <hkawamura0130@gmail.com>

* add test

Signed-off-by: harupy <hkawamura0130@gmail.com>

* fix test

Signed-off-by: harupy <hkawamura0130@gmail.com>

* rename variables

Signed-off-by: harupy <hkawamura0130@gmail.com>

* remove unused imports

Signed-off-by: harupy <hkawamura0130@gmail.com>

* lint

Signed-off-by: harupy <hkawamura0130@gmail.com>

* update docstring

Signed-off-by: harupy <hkawamura0130@gmail.com>

Co-authored-by: harupy <hkawamura0130@gmail.com>
@harupy
Copy link
Member

harupy commented Dec 7, 2021

fixed by #4604

@harupy harupy closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docker Docker use anywhere, such as MLprojects and MLmodels area/projects MLproject format, project running backends area/windows Issue is unique to windows. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants