question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileNotFoundError when running mlflow sagemaker deploy

See original GitHub issue

I run the following command:

mlflow sagemaker deploy --app-name xformer -m mlruns/6/2172c74308064a98bb0fcfe124ef66a8/artifacts/rf_model --execution-role-arn arn:aws:iam::354640567064:role/hb_mlflow --image-url 354640567064.dkr.ecr.us-east-1.amazonaws.com/mlflow-pyfunc:1.27.0 --region-name us-east-1 --mode create`
And receive the error:
`Traceback (most recent call last):
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\Scripts\mlflow.exe\__main__.py", line 7, in <module>
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\mlflow\sagemaker\cli.py", line 160, in deploy
    timeout_seconds=timeout,
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\mlflow\sagemaker\__init__.py", line 368, in deploy
    **assume_role_credentials,
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\mlflow\sagemaker\__init__.py", line 1220, in _upload_s3
    _make_tarfile(model_data_file, local_model_path)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\site-packages\mlflow\sagemaker\__init__.py", line 1202, in _make_tarfile
    tar.add(os.path.join(source_dir, f), arcname=f)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\tarfile.py", line 1951, in add
    recursive, filter=filter)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\tarfile.py", line 1951, in add
    recursive, filter=filter)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\tarfile.py", line 1951, in add
    recursive, filter=filter)
  [Previous line repeated 1 more time]
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\tarfile.py", line 1928, in add
    tarinfo = self.gettarinfo(name, arcname)
  File "C:\Users\bakerh\Anaconda3\envs\env_py3.7\lib\tarfile.py", line 1807, in gettarinfo
    statres = os.lstat(name)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\bakerh\\OneDrive\\Documents\\Projects\\audit-risk-model\\mlruns\\6\\2172c74308064a98bb0fcfe124ef66a8\\artifacts\\rf_model\\sparkml\\stages\\1_RandomForestRegressor_84bd4fc3b124\\data\\.part-00000-6027ef68-fad1-422e-8c17-fe45116bdfbb-c000.snappy.parquet.crc'

My current conda env looks like:

# Name                    Version                   Build  Channel
alembic                   1.8.0                    pypi_0    pypi
boto3                     1.24.27                  pypi_0    pypi
ca-certificates           2022.4.26            haa95532_0
certifi                   2022.6.15        py37haa95532_0
charset-normalizer        2.1.0                    pypi_0    pypi
click                     8.1.3                    pypi_0    pypi
cloudpickle               2.1.0                    pypi_0    pypi
databricks-cli            0.17.0                   pypi_0    pypi
docker                    5.0.3                    pypi_0    pypi
entrypoints               0.4                      pypi_0    pypi
flask                     2.1.2                    pypi_0    pypi
gitdb                     4.0.9                    pypi_0    pypi
gitpython                 3.1.27                   pypi_0    pypi
greenlet                  1.1.2                    pypi_0    pypi
idna                      3.3                      pypi_0    pypi
importlib-metadata        4.12.0                   pypi_0    pypi
importlib-resources       5.8.0                    pypi_0    pypi
itsdangerous              2.1.2                    pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
joblib                    1.1.0                    pypi_0    pypi
mako                      1.2.1                    pypi_0    pypi
markupsafe                2.1.1                    pypi_0    pypi
mlflow                    1.27.0                   pypi_0    pypi
numpy                     1.21.6                   pypi_0    pypi
oauthlib                  3.2.0                    pypi_0    pypi
openssl                   1.1.1q               h2bbff1b_0
packaging                 21.3                     pypi_0    pypi
pandas                    1.3.5                    pypi_0    pypi
pip                       22.1.2           py37haa95532_0
prometheus-client         0.14.1                   pypi_0    pypi
prometheus-flask-exporter 0.20.2                   pypi_0    pypi
protobuf                  4.21.2                   pypi_0    pypi
pyjwt                     2.4.0                    pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
python                    3.7.13               h6244533_0
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2022.1                   pypi_0    pypi
pywin32                   227                      pypi_0    pypi
pyyaml                    6.0                      pypi_0    pypi
querystring-parser        1.2.4                    pypi_0    pypi
requests                  2.28.1                   pypi_0    pypi
scikit-learn              1.0.2                    pypi_0    pypi
scipy                     1.7.3                    pypi_0    pypi
setuptools                61.2.0           py37haa95532_0
six                       1.16.0                   pypi_0    pypi
smmap                     5.0.0                    pypi_0    pypi
sqlalchemy                1.4.39                   pypi_0    pypi
sqlite                    3.38.5               h2bbff1b_0
sqlparse                  0.4.2                    pypi_0    pypi
tabulate                  0.8.10                   pypi_0    pypi
threadpoolctl             3.1.0                    pypi_0    pypi
typing-extensions         4.3.0                    pypi_0    pypi
urllib3                   1.26.10                  pypi_0    pypi
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
waitress                  2.1.2                    pypi_0    pypi
websocket-client          1.3.3                    pypi_0    pypi
werkzeug                  2.1.2                    pypi_0    pypi
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py37haa95532_2
zipp                      3.8.0                    pypi_0    pypi

I’ve researched online but no luck, anybody know the issue? Also to note my current pipeline is as follows: build a docker env with two main services pyspark and mlflow ui (in the docker compose file) . Start up jupyter lab from within the pyspark cli, open the mlflow ui in the browser. Run the relative notebooks where metrics and the model is logged etc. The models artifact then appears in the mlflow ui. After this stage, I create a separate conda env with the necessary packages(listed above) to run: mlflow sagemaker build-and-push-container cd into the mlruns/6/217…/artifacts/rf_model

After this the ECR service looks like: image I then continue to run: mlfllow sagemaker deploy.. The command that is causes the above error.

For more context on this approach I took, I followed this tutorial but rather than creating a conda env in the first step, I create a docker env https://github.com/vb100/deploy-ml-mlflow-aws/blob/main/README.md

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
hollytbcommented, Jul 15, 2022

@harupy that worked thank you! it was the length of the file path

Read more comments on GitHub >

github_iconTop Results From Across the Web

cmd: mlflow sagemaker build-and-push-container gives ...
amazon web services - cmd: mlflow sagemaker build-and-push-container gives FileNotFoundError: - Stack Overflow. Collectives™ on Stack Overflow ...
Read more >
mlflow.sagemaker — MLflow 2.0.1 documentation
Deploy an MLflow model on AWS SageMaker. The currently active AWS account must have correct permissions set up. This function creates a SageMaker...
Read more >
How to deploy a databricks managed workspace model to ...
Open source MLFlow implementation is working fine but I am getting error while running mlflow sagemaker command on top of databricks notebooks.
Read more >
Find Answers to AWS Questions about Amazon SageMaker | AWS ...
Hi, I want to deploy an MLflow image to an AWS Sagemaker endpoint that ... time was in December) but I've been using...
Read more >
mlflow.sagemaker — MLflow 1.29.0 documentation
mlflow.sagemaker. from mlflow.deployments import get_deploy_client vpc_config = { 'SecurityGroupIds': [ 'sg-123456abc', ], 'Subnets': [ 'subnet-123456abc', ] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found