Zappa
Zappa copied to clipboard
Zappa is not invoking the right Virtual env correctly while deploy
I am trying to deploy a Django app with Zappa using. I have created virtualenv using pyenv.
Context
Following commands confirms the correct virtualenv
▶ pyenv which zappa
/Users/****/.pyenv/versions/zappa/bin/zappa
▶ pyenv which python
/Users/****/.pyenv/versions/zappa/bin/python
But when I am trying to deploy the application using zappa deploy dev following error is thrown
▶ zappa deploy dev
(pip 18.1 (/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages), Requirement.parse('pip>=20.1'), {'pip-tools'})
Calling deploy for stage dev..
Oh no! An error occurred! :(
==============
Traceback (most recent call last):
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 2778, in handle
sys.exit(cli.handle())
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 512, in handle
self.dispatch_command(self.command, stage)
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 549, in dispatch_command
self.deploy(self.vargs['zip'])
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 723, in deploy
self.create_package()
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 2264, in create_package
disable_progress=self.disable_progress
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/core.py", line 627, in create_lambda_zip
copytree(site_packages, temp_package_path, metadata=False, symlinks=False, ignore=shutil.ignore_patterns(*excludes))
File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/utilities.py", line 54, in copytree
lst = os.listdir(src)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/****/mydir/zappa/env/lib/python3.6/site-packages'
==============
Expected Behavior
- Zappa Should fetch packages from pyenv virtualenv
Actual Behavior
- You can see the line at which error is thrown is different where virtualenv is installed. I don't know why
Zappa deploy
is looking for the site-packages here.
Possible Fix
Steps to Reproduce
- Create Virtual env from pyenv 3.6.9
- Install zappa and Django
- deploy zappa application
Your Environment
- Zappa version used: 0.52.0
- Operating System and Python version: Mac and python 3.6.9 (installed from pyenv)
- The output of
pip freeze
:
argcomplete==1.12.2
asgiref==3.3.1
boto3==1.17.0
botocore==1.20.0
certifi==2020.12.5
cfn-flip==1.2.3
chardet==4.0.0
click==7.1.2
Django==3.1.6
durationpy==0.5
future==0.18.2
hjson==3.0.2
idna==2.10
importlib-metadata==3.4.0
jmespath==0.10.0
kappa==0.6.0
pip-tools==5.5.0
placebo==0.9.0
python-dateutil==2.8.1
python-slugify==4.0.1
pytz==2021.1
PyYAML==5.4.1
requests==2.25.1
s3transfer==0.3.4
six==1.15.0
sqlparse==0.4.1
text-unidecode==1.3
toml==0.10.2
tqdm==4.56.0
troposphere==2.6.3
typing-extensions==3.7.4.3
urllib3==1.26.3
Werkzeug==0.16.1
wsgi-request-logger==0.4.6
zappa==0.52.0
zipp==3.4.0
- Link to your project (optional):
- Your
zappa_settings.json
:
▶ brew cleanup
{
"dev": {
"django_settings": "myproject.settings",
"profile_name": "zappa",
"project_name": "zappa",
"runtime": "python3.6",
"s3_bucket": "nd-zappa",
"aws_region": "ap-south-1"
}
}
same issue, did you got any solution
Same!