- Newest
- Most votes
- Most comments
unix:/tmp/gunicorn.sock failed (2: No such file or directory) may indicate Gunicorn was not started properly.
If you could search log for other errors related to Gunicorn, you may be able to identify the root cause.
Also, you could host the endpoint locally in your device or SageMaker Notebook Instance, where you could login to the container to further debug the issue. Local Mode details https://sagemaker.readthedocs.io/en/stable/overview.html#local-mode
Hi,
I agree it seems some packages are missing based on the error messages. I did not use SKLearn with sagemaker personally, but I just reviewed a few examples of sagemaker SDK for SKLearn.
That’s just my two cents - maybe try to remove the source_dir
in deploy.py and try again.
Thanks,
thanks for answering Jady - I put in the 'source_dir' for that function because that's the directory where the requirements.txt file sits, which contains the list of packages that needs to be installed for deployment. Unfortunately, if I removed it, the model would not train properly on sagemaker and thus i can't take it out - i ran into that issue before.
Checking out quickly your code, I can see a couple of issues with it that would definitely be raising errors.
The way that you are doing the deployment (calling the .deploy() method) you are neither passing the requirements file nor your custom inference script. Therefore, my guess is that when SageMaker tried to unpickle your model it encounters an error that it could not unpickle your LemmaTokenizer and/or nltk package not found.
Therefore, instead of your https://github.com/abhinavGirish/newsy/blob/083c88668f972b2c6d8fd35c9d511f40de682221/deploy.py#L28 you want to do something like:
my_model = SKLearnModel(
entry_point="inference.py", # "aws_training.py" in your case
source_dir="code_location", # "./" for you, a directory that contains your inference script and your requirements.txt file
...
)
my_model.deploy(...)
I think requirements.txt should be passed with the parameter dependencies, which is an optional list my only concern, is according to source code docs (link below), it specifies exact folders, and doesn't specify that it will install packages inside requirements.txt link - https://github.com/aws/sagemaker-python-sdk/blob/e5ccfa72eec5b039813b59b62f5332e7b03489d4/src/sagemaker/model.py#L1312:~:text=chain.-,dependencies,-(list%5Bstr%5D)%3A%20A
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
thanks for your response. I tried hosting the endpoint locally, and I run into another error involving an missing module 'yaml': " sagemaker_session = LocalSession() File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/local/local_session.py", line 513, in init super(LocalSession, self).init(boto_session) File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/session.py", line 131, in init sagemaker_featurestore_runtime_client=sagemaker_featurestore_runtime_client, File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/local/local_session.py", line 560, in _initialize raise e File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/local/local_session.py", line 557, in _initialize import yaml ModuleNotFoundError: No module named 'yaml'"
After searching for a bit online, (including https://github.com/yaml/pyyaml/issues/291) , I've tried re-installing the library multiple ways: pip install pyyaml python3 -m pip install pyyaml sudo easy_install pip sudo python -m pip install pyyaml pip install pyyaml==5.1.0
I checked and made sure that the 'import yaml' statement works in my Mac's python interpreter. Anything else I could try? perhaps it works only for interpreter version 3.8 and not 3.6 (called above). Thanks!
^^^ anyone know how to fix the above issue? trying to fix my original issue i posted about while running in 'LocalSession' mode but no luck yet- for some reason, the pyyaml module is installed for the version 3.9 of python (what normally gets pulled up when i open the python interpreter in a terminal), but when I run the script for a local session in PyCharm, it ends up running python version 3.6. not finding too many relevant answers on stackoverflow.
I have the script available to deploy locally on github here: https://github.com/abhinavGirish/newsy/blob/main/deploy_local.py. Here's the exact error message as well:
Failed to import yaml. Local mode features will be impaired or broken. Please run "pip install 'sagemaker[local]'" to install all required dependencies. Traceback (most recent call last): File "/Users/abhinavgirish/Documents/2021-2022/Newsy/deploy_local.py", line 4, in <module> sagemaker_session = LocalSession() File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/local/local_session.py", line 513, in init super(LocalSession, self).init(boto_session) File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sagemaker/session.py", line 131, in init sagemaker_featurestore_runtime_client=sagemaker_featurestore_runtime_client, File "/Users/abhinavgirish/.local/share/virtualenvs/NewsClassifierProject/lib/python3.6/site-packages/sag
running "pip install 'sagemaker[local]' " as the error message suggests doesn't work either, FYI
update - it looks like I got docker to run after running my local deploy script - now the issue is that the nginx server for the endpoint isn't launching properly. After looking through stack overflow posts online it seems there's some problem with the configuration of nginx when attempting to launch the endpoint:
fphpsiduo3-algo-1-knq70 | 2023/02/07 18:22:38 [crit] 25#25: *39 connect() to unix:/tmp/gunicorn.sock failed (2: No such file or directory) while connecting to upstream, client: 172.18.0.1, server: , request: "GET /ping HTTP/1.1", upstream: "http://unix:/tmp/gunicorn.sock:/ping", host: "localhost:8080"
does anyone know if there's a way to resolve this through the aws management console? I don't have any docker files or nginx config in my repo (see link i posted above) so I'm not sure there's some settings I need to fix on my AWS account or if it's something else. Any help is much appreciated - thanks again!