Open AlanSwenson opened 5 years ago
Figured it out. there is no manylinux wheels for bcrypt 3.1.5 which apparently came out the same day I submitted this. Downgraded to 3.1.4 and now it works again.
another solution that allows using the current bcrypt version is compiling your own packages by adding "use_precompiled_packages": false
to your zappa_settings.json
this compiles the packages on your machine (or ci environment) and does not use the old versions from Miserlou/lambda-packages
make sure to compile the stuff on a suitable python version and with glibc, musl libc didn't work for me...
It appears bcrypt 3.1.5 and above does not provide pre-compiled wheels for manylinux
/Python3.6. I had the same issue, and had to revert bcrypt back to 3.1.4 :-/
See:
I had pinned bcrypt to 3.1.4 but this came up again... Not sure why.
Still having this problem, even with bcrypt 3.1.4
I've just updated a previously working python3.6 zappa deployment to python3.7 with the latest zappa and i'm now getting this error too... i'm assuming the version of bcrypt packaged has been updated and we will need to pin a different version
My solution was to use a dockerized env to deploy from... This way I don't need to pin packages anymore.
@charlax that seems more like a workaround than a fix, but I may have to do that. What docker image did you use?
You're right, but I'm not sure providing prebuilt up-to-date packages is a core feature of Zappa, so it might make sense anyway, depending on your needs.
I've spent hours trying to configure Docker to work seamlessly and efficiently with Zappa. The current implementation by Zappa is a hack at best, making it unreasonable to use. Really wanted Zappa to just work instead of causing more headaches than its worth 👎
Fails lambda runtime = python3.7
Python 3.7.3
with pipenv
zappa==0.48.2
tried
bcrypt==3.1.3
bcrypt==3.1.4
bcrypt==3.1.5
bcrypt==3.1.6
Works lambda runtime = python3.6 <-- python3.7 fails
Python 3.6.8
with pipenv
zappa==0.48.2
bcrypt==3.1.4
Finally got an implementation that I'm satisfied with using Docker and PyCharm. It creates the virtual environment outside of the bind mount because I was having issues whenever the container was killed while the virtual environment was still running. This alleviates those headaches, and all the other headaches I've been running into quite frankly.
Dockerfile:
FROM lambci/lambda:build-python3.7
WORKDIR /var/task
# Fancy prompt to remind you are in zappashell
RUN echo 'export PS1="\[\e[36m\]zappa>\[\e[m\] "' >> /root/.bashrc
# Additional RUN commands here
# RUN yum clean all && \
# yum -y install <stuff>
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
SHELL ["/bin/bash", "-c"]
ENTRYPOINT source /entrypoint.sh
entrypoint.sh:
#!/usr/bin/env bash
# Enter the virtual environment
echo "CREATING VIRTUAL ENVIRONMENT... PLEASE WAIT..."
python -m venv /var/env
source /var/env/bin/activate
# Install required Python packages (via pip)
echo "INSTALLING PIP PACKAGES..."
pip install -r requirements.txt
# Add source to bash
echo 'source /var/env/bin/activate' >> /root/.bashrc
# Start a new shell
$SHELL
still have the same error. anyone found any solution?
Finally got an implementation that I'm satisfied with using Docker and PyCharm. It creates the virtual environment outside of the bind mount because I was having issues whenever the container was killed while the virtual environment was still running. This alleviates those headaches, and all the other headaches I've been running into quite frankly.
Dockerfile:
FROM lambci/lambda:build-python3.7 WORKDIR /var/task # Fancy prompt to remind you are in zappashell RUN echo 'export PS1="\[\e[36m\]zappa>\[\e[m\] "' >> /root/.bashrc # Additional RUN commands here # RUN yum clean all && \ # yum -y install <stuff> COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh SHELL ["/bin/bash", "-c"] ENTRYPOINT source /entrypoint.sh
entrypoint.sh:
#!/usr/bin/env bash # Enter the virtual environment echo "CREATING VIRTUAL ENVIRONMENT... PLEASE WAIT..." python -m venv /var/env source /var/env/bin/activate # Install required Python packages (via pip) echo "INSTALLING PIP PACKAGES..." pip install -r requirements.txt # Add source to bash echo 'source /var/env/bin/activate' >> /root/.bashrc # Start a new shell $SHELL
I have tried this solution but when I run my docker image I get the following error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
although I do have the file in the directory.
Context
ran zappa update in which the only thing I changed was adding "cors": true to zappa_Settings.json and now im getting invalid ELF header because of Bcrypt? causing the deployment to fail
Expected Behavior
normal update
Actual Behavior
[1545000508959] Instancing.. [1545000512152] bcrypt is required to use Flask-Bcrypt [1545000512153] /var/task/bcrypt/_bcrypt.abi3.so: invalid ELF header: ImportError
Steps to Reproduce
Your Environment
Things I've tried
removing the offending "cors": true undeploying and deploying adding bcrypt to my pipfile