Upgrading to Python3.6 throws an error

aws

#1

We are using virtualenv for python. We tried to upgrade from Python2.7 to 3.6, and we get the below error.

We are using nodeenv and plugins like serverless-python-requirements

Serverless: Parsing Python requirements.txt
Serverless: Installing required Python packages for runtime python3.6…

Type Error ---------------------------------------------

Cannot read property ‘toString’ of null

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Stack Trace --------------------------------------------

TypeError: Cannot read property ‘toString’ of null
at BbPromise (/home/ecofit/serverless2/serverless-installer-api/node_modules/serverless-python-requirements/index.js:98:30)
at ServerlessPythonRequirements.installRequirements (/home/ecofit/serverless2/serverless-installer-api/node_modules/serverless-python-requirements/index.js:86:12)
at ServerlessPythonRequirements.packRequirements (/home/ecofit/serverless2/serverless-installer-api/node_modules/serverless-python-requirements/index.js:135:17)
From previous event:
at PluginManager.invoke (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/classes/PluginManager.js:242:22)
at PluginManager.spawn (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/classes/PluginManager.js:254:17)
at Deploy.BbPromise.bind.then.then (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:101:50)
From previous event:
at Object.before:deploy:deploy [as hook] (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:99:10)
at BbPromise.reduce (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/classes/PluginManager.js:242:55)
From previous event:
at PluginManager.invoke (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/classes/PluginManager.js:242:22)
at PluginManager.run (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/classes/PluginManager.js:261:17)
at variables.populateService.then (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
From previous event:
at Serverless.run (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/home/ecofit/.virtualenvs/serverless2/lib/node_modules/serverless/bin/serverless:39:50)
at

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless

Your Environment Information -----------------------------
OS: linux
Node Version: 8.4.0
Serverless Version: 1.20.2


#2

I figured it out. It was because of my default version of Python 3.5 on ubuntu.

I upgraded to python3.6 on ubuntu and then created virtualenv for python3.6.
It fixed the problem