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

PyO3 error #9719

Closed
LukasJerabek opened this issue Oct 13, 2023 · 7 comments
Closed

PyO3 error #9719

LukasJerabek opened this issue Oct 13, 2023 · 7 comments

Comments

@LukasJerabek
Copy link

I had to downgrade back to 40.0.2 version because in newer versions I got these errors when running tests with pytest. Is PyO3 some dependency? What could be the problem? Dunno how make newer versions work.

   BROKEN  .tests.integ.iadmin.modules.use_cases.test_aggregated_payments
ImportError while importing test module '/home/vagrant/pack/tests/integ/iadmin/modules/use_cases/test_aggregated_payments.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../.pyenv/versions/3.8.18/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/integ/iadmin/modules/use_cases/test_aggregated_payments.py:7: in <module>
    from iadmin.modules.use_cases.aggregated_payments import (
iadmin/modules/use_cases/aggregated_payments.py:5: in <module>
    from aukce.modules.auction import Auction as LegacyAuction
aukce/modules/auction.py:10: in <module>
    from shared_globals.modules.legacy_document import Document
shared_globals/modules/legacy_document.py:17: in <module>
    from shared_globals.use_cases.invoice_status import add_new_invoice_statuses
shared_globals/use_cases/invoice_status.py:3: in <module>
    from shared_globals.celery.hooks_tasks.notify_invoice_status_hooks import (
shared_globals/celery/hooks_tasks/notify_invoice_status_hooks.py:1: in <module>
    from partner_api.modules.use_cases.hooks import (
partner_api/modules/use_cases/hooks.py:8: in <module>
    from shared_globals.use_cases.hooks import (
shared_globals/use_cases/hooks.py:11: in <module>
    from shared_globals.jws_security import generate_jws
shared_globals/jws_security.py:4: in <module>
    from cryptography.hazmat.primitives import hashes
../venv/pack/lib/python3.8/site-packages/cryptography/hazmat/primitives/hashes.py:10: in <module>
    from cryptography.hazmat.bindings._rust import openssl as rust_openssl
E   ImportError: PyO3 modules may only be initialized once per interpreter process
@alex
Copy link
Member

alex commented Oct 13, 2023

Are you able to reproduce this if you install from git? I think this may have been fixed by PyO3/pyo3#3446, which was just incorporated yesterday.

@LukasJerabek
Copy link
Author

I have centos7, I have installed Rust, cargo and newer openssl version according to:
https://gist.github.com/Bill-tran/5e2ab062a9028bf693c934146249e68c

I am trying with:

pip install git+https://github.com/pyca/cryptography.git

but I now get:

   BROKEN  .tests.unit.iadmin.modules.adapters.form.test_edit_invoice
ImportError while importing test module '/home/vagrant/pack/tests/unit/iadmin/modules/adapters/form/test_edit_invoice.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../.pyenv/versions/3.8.18/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
.
.
.
    from cryptography.hazmat.primitives import hashes
../venv/pack/lib/python3.8/site-packages/cryptography/hazmat/primitives/hashes.py:9: in <module>
    from cryptography.hazmat.bindings._rust import openssl as rust_openssl
E   ImportError: /home/vagrant/venv/pack/lib/python3.8/site-packages/cryptography/hazmat/bindings/_rust.abi3.so: undefined symbol: DSA_set0_key

So I am not sure if I installed it right...

@LukasJerabek
Copy link
Author

Btw when I installed the pip package I have got confirmation:
Successfully installed cryptography-42.0.0.dev1

@LukasJerabek
Copy link
Author

However my suspicion has turned to python-cov package now. In case you are interested, since I am still not sure, which package exactly causes it (python-cov or both jsonschema and cryptography), you can check out the reproducer here pytest-dev/pytest-cov#614.

@alex
Copy link
Member

alex commented Oct 16, 2023

We use pytest-cov in our own tests, so I doubt that. However, do you have other pytest plugins that may be involved?

@LukasJerabek
Copy link
Author

Just pytest-cov

@alex
Copy link
Member

alex commented Nov 1, 2023

I believe this is a duplicate of #9016

@alex alex closed this as completed Nov 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants