Serverless-python-requirements: Installing required Python packages step hangs

Created on 25 Oct 2017  路  4Comments  路  Source: UnitedIncome/serverless-python-requirements

Hi there,

Not sure why or how this happened but now when I run sls deploy the command hangs on the
Installing required Python packages with python3.6... step.

I tried reverting back to a commit where I know the project was working because I deploy it yesterday and I am still having this issue so this makes me think this has nothing to do with the changes I made (which is weird).

Any help would be much appreciated.

I am using serverless-python-requirements v3.0.7 and this is my serverless.yml (before the changes):

service: calculate-match-score                                                                                                                                                                                     

provider:                                                                                                                                                                                                          
  name: aws                                                                                                                                                                                                        
  runtime: python3.6                                                                                                                                                                                               
  stage: dev                                                                                                                                                                                                       
  region: eu-west-1                                                                                                                                                                                                
  timeout: 180                                                                                                                                                                                                     
  iamRoleStatements:                                                                                                                                                                                               
    - Effect: Allow                                                                                                                                                                                                
      Action:                                                                                                                                                                                                      
        - "dynamodb:DescribeStream"                                                                                                                                                                                
        - "dynamodb:GetRecords"                                                                                                                                                                                    
        - "dynamodb:GetShardIterator"                                                                                                                                                                              
        - "dynamodb:ListStreams"                                                                                                                                                                                   
        - "dynamodb:UpdateItem"                                                                                                                                                                                    
      Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_MATCH_SCORES_TABLE_NAME}"                                                                       

  environment:                                                                                                                                                                                                     
    DB_HOST: ${file(./env.yml):DB_HOST.${opt:stage, self:provider.stage}}                                                                                                                                          
    DYNAMODB_MATCH_SCORES_TABLE_NAME: match-scores-${opt:stage, self:provider.stage}                                                                                                                               

plugins:                                                                                                                                                                                                           
  - serverless-python-requirements                                                                                                                                                                                 

custom:                                                                                                                                                                                                            
  pythonRequirements:                                                                                                                                                                                              
    zip: true                                                                                                                                                                                                      

package:                                                                                                                                                                                                           
  exclude:                                                                                                                                                                                                         
    - .git/                                                                                                                                                                                                        
    - venv/                                                                                                                                                                                                        
    - event.json                                                                                                                                                                                                   
  include:                                                                                                                                                                                                         
    - requirements.txt                                                                                                                                                                                             
    - modules/                                                                                                                                                                                                     
    - src/                                                                                                                                                                                                         

functions:                                                                                                                                                                                                         
  calculate-match-score:                                                                                                                                                                                           
    handler: handler.handler                                                                                                                                                                                       
    name: calculate-match-score-${opt:stage, self:provider.stage}                                                                                                                                                  
    events:                                                                                                                                                                                                        
      - stream:                                                                                                                                                                                                    
          arn: <redacted ARN>                                                                                              
          batchSize: 5                                                                                                                                                                                             
    tags:                                                                                                                                                                                                          
      process: match-scores
bug

All 4 comments

What OS and what's in your requirements.txt?

requirements.txt:

click==6.7
fuzzywuzzy==0.15.1
nltk==3.2.5
numpy==1.13.3
pandas==0.20.3
pymongo==3.5.1
python-dateutil==2.6.1
python-dotenv==0.7.1
python-Levenshtein==0.12.0
pytz==2017.2
six==1.11.0
textblob==0.13.0

and I am working on Ubuntu 16.04

Thanks for the extra info, I'll review this when I have some time.

In case it helps I have found that this is the line that hangs
const res = spawnSync(cmd, options, {cwd: this.servicePath});

https://github.com/UnitedIncome/serverless-python-requirements/blob/master/lib/pip.js#L57

EDIT: After doing some more digging it seems that even when running pip install -r requirements.txt on my machine the command hangs when trying to install python-dotenv.

I now got it to work by adding the --no-cache-dir to the pipCmdExtraArgs options :+1: leaving the issue open so you can decide whether this is something worth looking into

Was this page helpful?
0 / 5 - 0 ratings