Python Forum

Full Version: Amazon AWS - how to install the library chatterbot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

Thanks in advance for the help!

So, I´m trying to install the library chatterbot on Amazon AWS but is too heavy and I was not able to do it.

I tried to zip and upload the layers but did not accept and I also tried, upload on S3 and use on lambda layers, but return the message: size of 262144000 bytes.
After you have intstalled Anaconda use this command to install :
pip install chatterbot
Hi satyashetty ,

In my computer, I installed with success and I already create my code for the chatbot, what I´m trying is use my code in AWS Lambda where I´m not able to install the library.

Did you use AWS Lambda?

Thank you very much!
hi,
you can use git to clone,, then install it.
but, it depends on SpaCy for it's nlp which you should install it first.
also SpaCy requires some language models which should be installed.
Hi brighteningeyes

I´m in the first steps...

Would you mind explain how can I do itin Lambda Aws?
"you can use git to clone,, then install it "

Thank you
hi,
do the following:
git clone https://github.com/gunthercox/chatterbot.git ./chatterbot
cd ./chatterbot
pip install -r requirements.txt
python -m spacy download en
python setup.py install
this should install it along with spaCy's language model.
Hi brighteningeyes, once againg, thank you very much for your help.

I installed okay, and upload to AWS Lambda, but see below the message from AWS.

START RequestId: 7531991b-8d49-4547-ae66-c94ba254b6c2 Version: $LATEST
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'chatterbot'
END RequestId: 7531991b-8d49-4547-ae66-c94ba254b6c2
REPORT RequestId: 7531991b-8d49-4547-ae66-c94ba254b6c2 Duration: 1.71 ms Billed Duration: 100 ms Memory Size: 3008 MB Max Memory Used: 59 MB Init Duration: 129.21 ms

Look the complete message

Resultado da execução: com falha(logs)
Detalhes
A área abaixo mostra o resultado retornado após a execução da função. Saiba mais sobre os resultados retornados por sua função.
{
"errorMessage": "Unable to import module 'lambda_function'"
}
Resumo
Código SHA-256
4fqvLEZDLTe3ljfrf8TREQL7HKfXF4tvJZycwotXA5M=
ID da solicitação
526923f6-6791-44ed-a2f4-1ac1ea455ae8
Duração
0.33 ms
Período cobrado
100 ms
Recursos configurados
128 MB
Memória máxima usada
51 MB Init Duration: 1.57 ms
Resultado de saída do log
A seção abaixo mostra as chamadas de registro em log no seu código. Elas são representadas por uma única linha no grupo de logs do CloudWatch que correspondem a esta função do Lambda. Clique aqui para visualizar o grupo de log do CloudWatch.
START RequestId: 526923f6-6791-44ed-a2f4-1ac1ea455ae8 Version: $LATEST
Unable to import module 'lambda_function': No module named 'chatterbot'

END RequestId: 526923f6-6791-44ed-a2f4-1ac1ea455ae8
REPORT RequestId: 526923f6-6791-44ed-a2f4-1ac1ea455ae8 Duration: 0.33 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 51 MB Init Duration: 1.57 ms
hi again,
so, you need to put the package in s3, then upload it into lambda
this might seem useful.
Hi brighteningeye,

Yes, I did it, as for an example I did the process with the requests library and it works and with the chatterbot, I got the message:

{
"errorMessage": "Unable to import module 'lambda_function'"
}

START RequestId: d2ab6a92-a2d4-459a-9715-4384f9648d69 Version: $LATEST
Unable to import module 'lambda_function': No module named 'chatterbot'

END RequestId: d2ab6a92-a2d4-459a-9715-4384f9648d69
REPORT RequestId: d2ab6a92-a2d4-459a-9715-4384f9648d69 Duration: 0.42 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 61 MB
hi,
so, you can copy chatterbot's files directly, instead of setting it up with setup.py.
this might work then.