Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Startup Error: AttributeError: module 'rlp' has no attribute 'Serializable' #857

Closed
anoduck opened this issue Jul 6, 2022 · 18 comments · Fixed by #891
Closed

Docker Startup Error: AttributeError: module 'rlp' has no attribute 'Serializable' #857

anoduck opened this issue Jul 6, 2022 · 18 comments · Fixed by #891
Assignees
Labels
category: bug Something isn't working size: 3 pieces Moderately challenging, well-defined, may require a bit of research

Comments

@anoduck
Copy link

anoduck commented Jul 6, 2022

Literally followed the instructions for docker installation verbatim, and recieved the error: AttributeError: module 'rlp' has no attribute 'Serializable'. Attached to the tty, and ran the command pip3 install eth-ape[recommended-plugins] AND pip3 install -U eth-ape[recommended-plugins] everything came up installed both times. Looked for more documentation on performing a docker installation, and found the same information contained in the README.md. Kinda lost as to what to do now.

I will try to remember to return later and provide the full output.

@fubuloubu fubuloubu added the category: bug Something isn't working label Jul 6, 2022
@fubuloubu
Copy link
Member

This seems like some sort of dependency issue w/ py-rlp

Will look into it!

@sabotagebeats sabotagebeats added the size: 3 pieces Moderately challenging, well-defined, may require a bit of research label Jul 8, 2022
@sabotagebeats
Copy link
Contributor

sabotagebeats commented Jul 8, 2022

Sprint 3: Still researching!

@antazoey
Copy link
Contributor

@anoduck Can you include OS information?

@anoduck
Copy link
Author

anoduck commented Jul 12, 2022

@unparalleled-js host OS is Kali Linux, but running docker not as root, but as unprivileged "normal" user. So, basically same as Debian unstable.

Full command executed: docker run --volume $HOME/.ape:/root/.ape --volume $HOME/.vvm:/root/.vvm --volume $HOME/.solcx:/root/.solcx --volume $PWD:/root/project --workdir /root/project apeworx/ape compile

Full output of error that followed:

Traceback (most recent call last):
  File "/usr/local/bin/ape", line 5, in <module>
    from ape._cli import cli
  File "/usr/local/lib/python3.8/dist-packages/ape/__init__.py", line 7, in <module>
    from ape.managers.project import ProjectManager as Project
  File "/usr/local/lib/python3.8/dist-packages/ape/managers/__init__.py", line 3, in <module>
    from ape.plugins import PluginManager
  File "/usr/local/lib/python3.8/dist-packages/ape/plugins/__init__.py", line 9, in <module>
    from .account import AccountPlugin
  File "/usr/local/lib/python3.8/dist-packages/ape/plugins/account.py", line 3, in <module>
    from ape.api.accounts import AccountAPI, AccountContainerAPI
  File "/usr/local/lib/python3.8/dist-packages/ape/api/__init__.py", line 1, in <module>
    from .accounts import (
  File "/usr/local/lib/python3.8/dist-packages/ape/api/accounts.py", line 5, in <module>
    from eth_account import Account
  File "/usr/local/lib/python3.8/dist-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import (
  File "/usr/local/lib/python3.8/dist-packages/eth_account/account.py", line 35, in <module>
    from eth_account._utils.legacy_transactions import (
  File "/usr/local/lib/python3.8/dist-packages/eth_account/_utils/legacy_transactions.py", line 13, in <module>
    from eth_rlp import (
  File "/usr/local/lib/python3.8/dist-packages/eth_rlp/__init__.py", line 1, in <module>
    from .main import (  # noqa: F401
  File "/usr/local/lib/python3.8/dist-packages/eth_rlp/main.py", line 13, in <module>
    class HashableRLP(rlp.Serializable):
AttributeError: module 'rlp' has no attribute 'Serializable'

@fubuloubu
Copy link
Member

are you using stable or latest docker tag? (or an older version)

@anoduck
Copy link
Author

anoduck commented Jul 12, 2022

are you using stable or latest docker tag? (or an older version)

Using @latest, of course.

@fubuloubu
Copy link
Member

are you using stable or latest docker tag? (or an older version)

Using @latest, of course.

Just for sanity check, can you try @stable?

@anoduck
Copy link
Author

anoduck commented Jul 13, 2022

are you using stable or latest docker tag? (or an older version)

Using @latest, of course.

Just for sanity check, can you try @stable?

No difference between running @latest & @stable. Both resulted in the same error.

cmd: docker run --volume $HOME/.ape:/root/.ape --volume $HOME/.vvm:/root/.vvm --volume $HOME/.solcx:/root/.solcx --volume $PWD:/root/project --workdir /root/project apeworx/ape:stable compile

output:

Traceback (most recent call last):
  File "/usr/local/bin/ape", line 5, in <module>
    from ape._cli import cli
  File "/usr/local/lib/python3.8/dist-packages/ape/__init__.py", line 7, in <module>
    from ape.managers.project import ProjectManager as Project
  File "/usr/local/lib/python3.8/dist-packages/ape/managers/__init__.py", line 3, in <module>
    from ape.plugins import PluginManager
  File "/usr/local/lib/python3.8/dist-packages/ape/plugins/__init__.py", line 9, in <module>
    from .account import AccountPlugin
  File "/usr/local/lib/python3.8/dist-packages/ape/plugins/account.py", line 3, in <module>
    from ape.api.accounts import AccountAPI, AccountContainerAPI
  File "/usr/local/lib/python3.8/dist-packages/ape/api/__init__.py", line 1, in <module>
    from .accounts import (
  File "/usr/local/lib/python3.8/dist-packages/ape/api/accounts.py", line 5, in <module>
    from eth_account import Account
  File "/usr/local/lib/python3.8/dist-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import (
  File "/usr/local/lib/python3.8/dist-packages/eth_account/account.py", line 35, in <module>
    from eth_account._utils.legacy_transactions import (
  File "/usr/local/lib/python3.8/dist-packages/eth_account/_utils/legacy_transactions.py", line 13, in <module>
    from eth_rlp import (
  File "/usr/local/lib/python3.8/dist-packages/eth_rlp/__init__.py", line 1, in <module>
    from .main import (  # noqa: F401
  File "/usr/local/lib/python3.8/dist-packages/eth_rlp/main.py", line 13, in <module>
    class HashableRLP(rlp.Serializable):
AttributeError: module 'rlp' has no attribute 'Serializable'

@sabotagebeats
Copy link
Contributor

sabotagebeats commented Jul 13, 2022

I'm able to recreate the error on the latest docker image on ubuntu WSL2

@anoduck
Copy link
Author

anoduck commented Jul 13, 2022

Just spouting off some observations, but it appears the error is located within the ethereum libraries and not within ape itself, particularly the eth-rlp package. So, it might be Ethereum's problem to fix.

The documentation that refers to the module creating the error can be found here: https://eth-rlp.readthedocs.io/en/latest/eth_rlp.html#eth_rlp.main.HashableRLP.from_bytes

@sabotagebeats
Copy link
Contributor

After doing some research it seems the error is coming from this file:
https://github.com/ethereum/eth-rlp/blob/master/eth_rlp/main.py

that file imports this library also: https://github.com/ethereum/pyrlp
however I still haven't found where this breaking change occurs

I was able to try an older version of the ape docker image and it works to compile but the latest version does not.

@sabotagebeats
Copy link
Contributor

with these changes to the dockerfile it seems to work. I'm exploring which of the changes it is specifically.

FROM ubuntu:22.04
RUN apt-get update && apt-get upgrade --yes && apt-get install git python3.10 python3-pip --yes
ADD . /code
WORKDIR /code

# need to use typing-extensions<4 to deal with issue 387 bug: Docker will not build
# TODO: Figure out a better solution or wait for it to resolve itself.
RUN pip install typing-extensions==3.10.0.2
RUN pip install .
RUN ape plugins install alchemy ens etherscan foundry hardhat infura ledger solidity template tokens trezor vyper
RUN pip install eth-rlp==0.3.0
ENTRYPOINT ["ape"]

@sabotagebeats
Copy link
Contributor

each of the changes seem necessary for one reason or another to have it working.

@anoduck
Copy link
Author

anoduck commented Jul 21, 2022

May be a little premature, but seeing there is a new docker image release, I am going to go ahead and pull @latest, and see if the issue has been taken care of. Fingers crossed.

Pulling is slower than frozen molasses.

@anoduck
Copy link
Author

anoduck commented Jul 22, 2022

Well, another update to the latest image came through, and my pull request never completed before timing out. So, I am starting the pull request all over again, at a snail's pace. Wish ATT would finish setting up fiber, the cables have been out there for almost a month now.

@anoduck
Copy link
Author

anoduck commented Jul 23, 2022

Yep, it works...now the fun begins...

@antazoey
Copy link
Contributor

antazoey commented Oct 4, 2022

If encounter this issue RLP has not attribute 'Serializble' at any other point when using the Ape, the fix is:

pip uninstall rlp --yes && pip install rlp==3.0.0

I have encountered this issue outside of docker, like when installing other libs and such, and then I have to do this again. It is odd. The init.py file for rlp changes for some reason. Maybe a bug related to having multiple installed packages named rlp.

@koeppelmann
Copy link

Thank you @unparalleled-js - came here with the same issue and this helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working size: 3 pieces Moderately challenging, well-defined, may require a bit of research
Projects
None yet
5 participants