Unable to import module 'lambda_function': No module named 'stomp'
I am new to Python and looking for some kind of help. Python Lambda function below is throwing me expected error.
Unable to import module 'lambda_function': No module named 'stomp'
Python Lambda Script:-
import time
import boto3
import stomp
kinesis_client = boto3.client('kinesis')
class Listener(stomp.ConnectionListener):
def on_error(self, headers, message):
print('received an error "%s"' % message)
def on_message(self, headers, message):
print('received a message "%s"' % message)
kinesis_client.put_record(
StreamName='inter-lambda',
Data=u'{}rn'.format(message).encode('utf-8'),
PartitionKey='0'
)
I use mac to execute command and below is the error:-
sudo pip install stompy -t /Users/kalyanbhave/Documents/stomp/
Password:
The directory '/Users/kalyanbhave/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/kalyanbhave/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting stompy
Downloading https://files.pythonhosted.org/packages/af/21/8f3bdf1f304ba65847706c29d1950525513ec11d941ed0630ee8af51b361/stompy-0.2.9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-rgmh5da6/stompy/setup.py", line 2, in <module>
from stompy import distmeta
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/__init__.py", line 1, in <module>
from stompy.stomp import Stomp, NotConnectedError
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/stomp.py", line 49
except socket.timeout, exc:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-rgmh5da6/stompy/
python python-3.x
add a comment |
I am new to Python and looking for some kind of help. Python Lambda function below is throwing me expected error.
Unable to import module 'lambda_function': No module named 'stomp'
Python Lambda Script:-
import time
import boto3
import stomp
kinesis_client = boto3.client('kinesis')
class Listener(stomp.ConnectionListener):
def on_error(self, headers, message):
print('received an error "%s"' % message)
def on_message(self, headers, message):
print('received a message "%s"' % message)
kinesis_client.put_record(
StreamName='inter-lambda',
Data=u'{}rn'.format(message).encode('utf-8'),
PartitionKey='0'
)
I use mac to execute command and below is the error:-
sudo pip install stompy -t /Users/kalyanbhave/Documents/stomp/
Password:
The directory '/Users/kalyanbhave/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/kalyanbhave/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting stompy
Downloading https://files.pythonhosted.org/packages/af/21/8f3bdf1f304ba65847706c29d1950525513ec11d941ed0630ee8af51b361/stompy-0.2.9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-rgmh5da6/stompy/setup.py", line 2, in <module>
from stompy import distmeta
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/__init__.py", line 1, in <module>
from stompy.stomp import Stomp, NotConnectedError
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/stomp.py", line 49
except socket.timeout, exc:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-rgmh5da6/stompy/
python python-3.x
add a comment |
I am new to Python and looking for some kind of help. Python Lambda function below is throwing me expected error.
Unable to import module 'lambda_function': No module named 'stomp'
Python Lambda Script:-
import time
import boto3
import stomp
kinesis_client = boto3.client('kinesis')
class Listener(stomp.ConnectionListener):
def on_error(self, headers, message):
print('received an error "%s"' % message)
def on_message(self, headers, message):
print('received a message "%s"' % message)
kinesis_client.put_record(
StreamName='inter-lambda',
Data=u'{}rn'.format(message).encode('utf-8'),
PartitionKey='0'
)
I use mac to execute command and below is the error:-
sudo pip install stompy -t /Users/kalyanbhave/Documents/stomp/
Password:
The directory '/Users/kalyanbhave/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/kalyanbhave/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting stompy
Downloading https://files.pythonhosted.org/packages/af/21/8f3bdf1f304ba65847706c29d1950525513ec11d941ed0630ee8af51b361/stompy-0.2.9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-rgmh5da6/stompy/setup.py", line 2, in <module>
from stompy import distmeta
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/__init__.py", line 1, in <module>
from stompy.stomp import Stomp, NotConnectedError
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/stomp.py", line 49
except socket.timeout, exc:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-rgmh5da6/stompy/
python python-3.x
I am new to Python and looking for some kind of help. Python Lambda function below is throwing me expected error.
Unable to import module 'lambda_function': No module named 'stomp'
Python Lambda Script:-
import time
import boto3
import stomp
kinesis_client = boto3.client('kinesis')
class Listener(stomp.ConnectionListener):
def on_error(self, headers, message):
print('received an error "%s"' % message)
def on_message(self, headers, message):
print('received a message "%s"' % message)
kinesis_client.put_record(
StreamName='inter-lambda',
Data=u'{}rn'.format(message).encode('utf-8'),
PartitionKey='0'
)
I use mac to execute command and below is the error:-
sudo pip install stompy -t /Users/kalyanbhave/Documents/stomp/
Password:
The directory '/Users/kalyanbhave/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/kalyanbhave/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting stompy
Downloading https://files.pythonhosted.org/packages/af/21/8f3bdf1f304ba65847706c29d1950525513ec11d941ed0630ee8af51b361/stompy-0.2.9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-rgmh5da6/stompy/setup.py", line 2, in <module>
from stompy import distmeta
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/__init__.py", line 1, in <module>
from stompy.stomp import Stomp, NotConnectedError
File "/private/tmp/pip-install-rgmh5da6/stompy/stompy/stomp.py", line 49
except socket.timeout, exc:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-rgmh5da6/stompy/
python python-3.x
python python-3.x
edited Nov 19 '18 at 15:01
asked Nov 19 '18 at 13:52
Tinku
357
357
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You are using AWS Lambda. The module stomp
is not included by default.
You'll need to create your own deployment package including stomp
as described here.
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try usingsudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.
– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376117%2funable-to-import-module-lambda-function-no-module-named-stomp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are using AWS Lambda. The module stomp
is not included by default.
You'll need to create your own deployment package including stomp
as described here.
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try usingsudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.
– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
|
show 4 more comments
You are using AWS Lambda. The module stomp
is not included by default.
You'll need to create your own deployment package including stomp
as described here.
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try usingsudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.
– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
|
show 4 more comments
You are using AWS Lambda. The module stomp
is not included by default.
You'll need to create your own deployment package including stomp
as described here.
You are using AWS Lambda. The module stomp
is not included by default.
You'll need to create your own deployment package including stomp
as described here.
answered Nov 19 '18 at 13:57
Rob Bricheno
2,325218
2,325218
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try usingsudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.
– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
|
show 4 more comments
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try usingsudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.
– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
Thank you. I ran into another error after following your link. Please suggest
– Tinku
Nov 19 '18 at 15:02
What happens if you try using
sudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.– Rob Bricheno
Nov 19 '18 at 15:08
What happens if you try using
sudo -H
as suggested in the error output? Also are you trying to make a Python 3 package or a Python 2 package? I think MacOS uses Python2 as default so you may need to get Python 3 via Homebrew (or similar) and start there instead of using the system python.– Rob Bricheno
Nov 19 '18 at 15:08
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
I don't want to create own deployment package because If I do so, I need to push them as a zip file. And this will be a problem if I create infrastructure via terraform. Do we have alternate solution
– Tinku
Nov 19 '18 at 17:30
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Tinku I think this is the best solution for you, the next alternative would be using a service like Elastic Beanstalk or EC2 if you want to go the AWS route, neither of which will be easier than this.
– Rob Bricheno
Nov 19 '18 at 17:53
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
@Rob-- Could you please provide me steps to do it. As the link provided to you is lil challenging for me to do the same in mac machine
– Tinku
Nov 19 '18 at 17:57
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376117%2funable-to-import-module-lambda-function-no-module-named-stomp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown