-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python 3.11, 3.12 and Debian Bullseye compatibility (#178)
- Debian Bullseye and pyenv was picking up old web3-ethereum-defi version - Create a Docker script to check installation on Debian Bullseye - This did not then use the correct version of [safe-pysha3](https://github.com/5afe/pysha3), but picked up the old pysha3 package - Make `pyproject.toml` to say we are compatible all they way to Python 3.12 - [pkgutil compatibility fixes](https://stackoverflow.com/questions/77364550/attributeerror-module-pkgutil-has-no-attribute-impimporter-did-you-mean). - [Upgrade to Pandas 2.x](pandas-dev/pandas#53665), needed for Python 3.12 compatibility - Upgrade to the latest Web3.py 6.x version - Python 3.12 changes `ast` module and this has breaking changes with `eth_trace` library. Workaround them. - Disable `test_fallback_double_fault` because new Web3.py does not like `MagicMock` results - Bump to `zope.dottedname` 6.0 needed [for Python 3.11 compatibility](https://pypi.org/project/zope.dottedname/)
- Loading branch information
Showing
10 changed files
with
1,466 additions
and
1,265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM debian:bullseye | ||
RUN apt-get update | ||
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev | ||
RUN apt-get install -y curl git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Check installations issues on Debian Bullseye | ||
|
||
- Debian Bullseye | ||
- Python 3.11 | ||
- pyenv | ||
- pysha3 installation issue | ||
- See [safe-pysha3 replacing pysha3](https://github.com/5afe/pysha3) | ||
|
||
|
||
## Running | ||
|
||
Create image: | ||
|
||
```shell | ||
docker build --no-cache -t pysha3-test . | ||
``` | ||
|
||
Run the shell script within the image: | ||
|
||
|
||
```shell | ||
docker run -v `pwd`:`pwd` -w `pwd` --entrypoint `pwd`/check-install.sh pysha3-test | ||
``` | ||
|
||
## Manual inspection of running Debian Bullseye | ||
|
||
Map source tree as we so we can do direct install from local source for trials. | ||
|
||
```shell | ||
docker run -it -v `pwd`:`pwd` -v $(realpath $PWD/../..):`pwd`/web3-ethereum-defi -w `pwd` --entrypoint /bin/bash pysha3-test | ||
``` | ||
|
||
Then run the script: | ||
|
||
```shell | ||
./check-install.sh | ||
``` | ||
|
||
Or to active Python environment: | ||
|
||
```shell | ||
/root/.pyenv/bin/pyenv global 3.12 | ||
|
||
``` | ||
|
||
## pysha3 error | ||
|
||
``` | ||
Using cached netaddr-0.9.0-py3-none-any.whl (2.2 MB) | ||
Building wheels for collected packages: pysha3 | ||
Building wheel for pysha3 (pyproject.toml) ... error | ||
error: subprocess-exited-with-error | ||
× Building wheel for pysha3 (pyproject.toml) did not run successfully. | ||
│ exit code: 1 | ||
╰─> [18 lines of output] | ||
running bdist_wheel | ||
running build | ||
running build_py | ||
creating build | ||
creating build/lib.linux-x86_64-cpython-311 | ||
copying sha3.py -> build/lib.linux-x86_64-cpython-311 | ||
running build_ext | ||
building '_pysha3' extension | ||
creating build/temp.linux-x86_64-cpython-311 | ||
creating build/temp.linux-x86_64-cpython-311/Modules | ||
creating build/temp.linux-x86_64-cpython-311/Modules/_sha3 | ||
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_WITH_KECCAK=1 -I/home/user/.pyenv/versions/3.11.4/include/python3.11 -c Modules/_sha3/sha3module.c -o build/temp.linux-x86_64-cpython-311/Modules/_sha3/sha3module.o | ||
In file included from Modules/_sha3/sha3module.c:20: | ||
Modules/_sha3/backport.inc:78:10: fatal error: pystrhex.h: No such file or directory | ||
78 | #include "pystrhex.h" | ||
| ^~~~~~~~~~~~ | ||
compilation terminated. | ||
error: command '/usr/bin/gcc' failed with exit code 1 | ||
[end of output] | ||
note: This error originates from a subprocess, and is likely not a problem with pip. | ||
ERROR: Failed building wheel for pysha3 | ||
Failed to build pysha3 | ||
ERROR: Could not build wheels for pysha3, which is required to install pyproject.toml-based projects | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Taken from https://raw.githubusercontent.com/SCBuergel/SEQS/main/install-scripts/python_appVM.sh | ||
# | ||
|
||
set -e | ||
set -u | ||
|
||
echo "I am $(whoami)" | ||
|
||
echo "Installing Python on appVM" | ||
curl https://pyenv.run | bash | ||
|
||
echo "setting .profile..." | ||
echo -e "\ | ||
export PYENV_ROOT=\"\$HOME/.pyenv\"\n\ | ||
command -v pyenv >/dev/null || export PATH=\"\$PYENV_ROOT/bin:\$PATH\"\n\ | ||
eval \"\$(pyenv init -)\"" >> ~/.profile | ||
|
||
echo "reloading .profile twice..." | ||
source ~/.profile | ||
source ~/.profile | ||
|
||
echo "setting .bashrc..." | ||
echo "eval \"\$(/root/.pyenv/bin/pyenv virtualenv-init -)\"" >> ~/.bashrc | ||
|
||
echo "installing latest python..." | ||
pyenv install 3.12 | ||
|
||
echo "setting symlink..." | ||
ln -f -s /usr/bin/python3 /usr/local/bin/python | ||
|
||
echo "setting global python version..." | ||
pyenv global 3.12 | ||
|
||
echo "installing virtualenv..." | ||
pip install virtualenv | ||
|
||
echo "updating pip..." | ||
pip install --upgrade pip | ||
|
||
echo "Pip is $(which pip)" | ||
echo "Python is $(which python)" | ||
pip --version | ||
pip install safe-pysha3 | ||
pip install -e web3-ethereum-defi | ||
|
||
# Set up poetry | ||
curl -sSL https://install.python-poetry.org | python3 - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters