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

ModuleNotFoundError: No module named 'deqr.quirc' #1

Closed
diedgarsa opened this issue Jun 12, 2023 · 4 comments
Closed

ModuleNotFoundError: No module named 'deqr.quirc' #1

diedgarsa opened this issue Jun 12, 2023 · 4 comments
Labels
bug Something isn't working confirmed packaging

Comments

@diedgarsa
Copy link

diedgarsa commented Jun 12, 2023

Traceback (most recent call last):
  ...
  File "/srv/app/src/a/b/c.py", line 18, in <module>
    from deqr import QRCode, QRdecDecoder
  File "/srv/app/venv/lib/python3.11/site-packages/deqr/__init__.py", line 13, in <module>
    from .quirc import QuircDecoder
ModuleNotFoundError: No module named 'deqr.quirc'

This error can be reproduced with Python 3.11 Docker image:

  • docker run --interactive --rm --tty python:3.11-slim bash:
    • python -m venv venv;
    • . venv/bin/activate;
    • pip install deqr;
    • python -c 'from deqr import quirc' - the error ModuleNotFoundError: No module named 'deqr.quirc' is thrown.

There are no errors with Docker images for Python 3.8 - 3.10.

This error was also observed on a server (CentOS 7) with compiled Python 3.8, while on other (Rocky Linux 8) everything is fine with the same compiled Python version.

@diedgarsa diedgarsa changed the title Error with Python 3.11: "ModuleNotFoundError: No module named 'deqr.quirc'" ModuleNotFoundError: No module named 'deqr.quirc' Jun 15, 2023
@torque
Copy link
Owner

torque commented Jun 16, 2023

Thanks for the report. Looks like maybe the 0.2.1 sdist is screwed up (even though I published 0.2.1 explicitly to fix the broken sdist in 0.2.0), since I apparently never published a bdist for Python 3.11. I did redo the build system after 0.2.1, so hopefully the sdist will actually work in future releases.

I'll take a look at updating the published packages this weekend.

@torque torque added bug Something isn't working packaging confirmed labels Jun 17, 2023
@torque
Copy link
Owner

torque commented Jun 17, 2023

It looks like this is a classic case of insufficiently pinned build dependencies. Newer versions of Poetry changed the API for using a custom build script, but my PEP-517 backend simply specified "use the latest version of poetry-core", so at some point the sdist broke because poetry did not maintain backwards compatibility.

This effectively causes the cython modules to not get compiled when the sdist build runs (but it annoyingly pretends that everything went fine, so you don't find out there was an installation problem until runtime).

The sdist should have specified an upper bound on the compatible poetry-core version, though arguably they violated semver, and being too restrictive on the version range will likely eventually create forward-compatibility problems. This is an easy problem to fix immediately, but I'm not sure what the best approach is for the long view, especially if poetry is going to go around wantonly breaking their APIs under the claim that they're "experimental" while being post-1.0.0.

Empirical testing shows that this broke at poetry-core 1.5.0, which lead me to python-poetry/poetry#7470, which is cool. It may be worthwhile complaining to the poetry maintainers about this, but I doubt it will change anything.

Anyway, looks like I will need to make a new release to fix the sdist. It seems like a good time to update quirc anyway.

see also: python-poetry/poetry#2740

@torque
Copy link
Owner

torque commented Jun 17, 2023

I believe this is fixed with the newly released 0.2.2.

Note that because it has a binary package for python 3.11 now, it will no longer try to build from the source package in the python:3.11-slim docker container. I believe your CentOS 7 server hit the other bound (I suspect it's too old to use the precompiled packages) and will need gcc/clang (and possibly other build tools?) installed in order to build from the source package. But as far as I could test, the source package does actually work now.

I'm going to close this. Feel free to comment/reopen if you hit a problem installing the new version.

@torque torque closed this as completed Jun 17, 2023
@diedgarsa
Copy link
Author

Thank you for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed packaging
Projects
None yet
Development

No branches or pull requests

2 participants