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

ImportError #38

Closed
Sibiryakanton opened this issue Mar 22, 2023 · 10 comments
Closed

ImportError #38

Sibiryakanton opened this issue Mar 22, 2023 · 10 comments
Labels

Comments

@Sibiryakanton
Copy link

When I try to use the code with a package in the pipeline, I get an error:

project_name/modules/image_handler.py:6: in <module>
    import webp
/venv/project-env-9TtSrW0h-py3.10/lib/python3.10/site-packages/webp/__init__.py:6: in <module>
    from _webp import ffi, lib
E   ModuleNotFoundError: No module named '_webp'

How can i fix it?

@anibali
Copy link
Owner

anibali commented Mar 22, 2023

How did you install the webp package, what version did you install, and what platform are you on (Windows/Linux)?

@x2a-io
Copy link

x2a-io commented Mar 23, 2023

Running into this same issue on MacOS (12.6), Python 3.10.10, webp==0.1.5 - with the package installed via pip: pip install -U webp

Here's my error message:

>>> import webp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib/python3.10/site-packages/webp/__init__.py", line 6, in <module>
    from _webp import ffi, lib
ModuleNotFoundError: No module named '_webp'

@anibali
Copy link
Owner

anibali commented Mar 23, 2023

Unfortunately macOS is currently not supported, I've only built wheels for Windows and Linux. In theory it should be able to build from the source distribution, but it looks like that is not working based on your results.

Since I don't have access to Apple hardware it is difficult for me to provide support, but I can try to see if I can build a wheel for macOS and hopefully it just works. I'll give that a go and let you know.

@x2a-io
Copy link

x2a-io commented Mar 23, 2023

Ah, I see thanks! I could swear it was working in the past... just not sure how many versions ago though. I'll try and build on my end - but also happy to test whatever ones you build.

@x2a-io
Copy link

x2a-io commented Mar 23, 2023

Everything works fine with webp==0.1.4. It seems something changed with 0.1.5

@Sibiryakanton
Copy link
Author

  1. poetry add webp
  2. webp = "^0.1.5"
  3. Ubuntu 20.04.5 LTS

@anibali
Copy link
Owner

anibali commented Mar 23, 2023

The issue is that installing from the sdist (source tarball) is broken, and this affects all platforms. It seems that the problem started after I moved the project to Poetry. I need to fix the sdist, and then as a bonus I will provide wheels so that it's faster to install on macOS in the future.

@anibali anibali added the bug label Mar 23, 2023
@Sibiryakanton
Copy link
Author

With 0.1.4 i got the other error in lambda:
https://pastebin.com/zkMew4qf

Gone if switched to 0.1.5

@anibali
Copy link
Owner

anibali commented Mar 23, 2023

That was quite a nasty issue to get to the bottom of. It seems like the root cause was a change in Poetry related to build scripts, which broke builds from the sdist tarball: python-poetry/poetry#2740

I've now released a new version, 0.1.6, which should fix the problem. Please give that a go and let me know if it works for you.

@Sibiryakanton
Copy link
Author

Yep, it works, you are brilliant human being. :)

@anibali anibali closed this as completed Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants