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

Import error in latest version of web3.py pip package #3038

Closed
ehtec opened this issue Jul 12, 2023 · 9 comments · Fixed by #3039
Closed

Import error in latest version of web3.py pip package #3038

ehtec opened this issue Jul 12, 2023 · 9 comments · Fixed by #3039

Comments

@ehtec
Copy link

ehtec commented Jul 12, 2023

  • Version: 6.6.0
  • Python: 3.9
  • OS: Debian 11

The latest version 6.6.0 that was released about an hour ago of the web3 pip package is broken, it cannot be imported without raising an error. I noticed this because it broke our CI pipelines.

Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import web3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/elias/.local/lib/python3.9/site-packages/web3/__init__.py", line 4, in <module>
    from web3.main import (
  File "/home/elias/.local/lib/python3.9/site-packages/web3/main.py", line 4, in <module>
    from ens import (
  File "/home/elias/.local/lib/python3.9/site-packages/ens/__init__.py", line 3, in <module>
    from .async_ens import (
  File "/home/elias/.local/lib/python3.9/site-packages/ens/async_ens.py", line 35, in <module>
    from ens.base_ens import (
  File "/home/elias/.local/lib/python3.9/site-packages/ens/base_ens.py", line 18, in <module>
    from .utils import (
  File "/home/elias/.local/lib/python3.9/site-packages/ens/utils.py", line 39, in <module>
    from ._normalization import (
  File "/home/elias/.local/lib/python3.9/site-packages/ens/_normalization.py", line 57, in <module>
    with open(os.path.join(specs_dir_path, "normalization_spec.json")) as spec:
FileNotFoundError: [Errno 2] No such file or directory: '/home/elias/.local/lib/python3.9/site-packages/ens/specs/normalization_spec.json'
@Rogalek
Copy link

Rogalek commented Jul 12, 2023

I have the same issue!

@kclowes
Copy link
Collaborator

kclowes commented Jul 12, 2023

I am not able to replicate. I wonder if there is a caching issue in your CI? Can you clear your cache in CI and let me know?

@ehtec
Copy link
Author

ehtec commented Jul 12, 2023

I am not able to replicate. I wonder if there is a caching issue in your CI? Can you clear your cache in CI and let me know?

I don't believe this is a caching issue, as other people have the same issue as well, it happened right after the release of the latest verison of web3py, I could replicate it on my laptop (the screenshot above is actually from my laptop, where I upgraded web3py to test), and the locate command is telling the that the normalization_spec.json file indeed does not exist on my system.

@kclowes
Copy link
Collaborator

kclowes commented Jul 12, 2023

@ehtec How are you installing?

@ehtec
Copy link
Author

ehtec commented Jul 12, 2023

@ehtec How are you installing?

python3 -m pip install --upgrade web3

I believe that these .json files, which seem to be new according to the commit history, are not included in the pip package by default and need to be manually specified in the setup.py configuration which is currently not the case, as far as I have seen.

@kclowes
Copy link
Collaborator

kclowes commented Jul 12, 2023

Yeah, I don't see it in the tar file. Thanks for raising and troubleshooting. Will put a patch up shortly.

@fselmo
Copy link
Collaborator

fselmo commented Jul 12, 2023

@ehtec @Rogalek Patch release v6.6.1 is out now with that change in there... please let us know if that solves your issue. Thanks again for reporting!

@B2f4
Copy link

B2f4 commented Aug 19, 2023

Hi. i have the same issue using pyinstaller.
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEICqEE2v/ens/specs/normalization_spec.json'
using 6.6.0, 6.6.1 and the latest version too 6.8.0

@fselmo
Copy link
Collaborator

fselmo commented Aug 23, 2023

@B2f4 pyinstaller needs a manual addition utilizing the --add-data flag.

https://stackoverflow.com/questions/62017384/adding-json-files-to-an-exe-file-using-pyinstaller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants