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

Issue installing with poetry #1

Closed
AdrienDart opened this issue Apr 3, 2024 · 16 comments
Closed

Issue installing with poetry #1

AdrienDart opened this issue Apr 3, 2024 · 16 comments

Comments

@AdrienDart
Copy link

Hi,

Thank you very much for your work, much appreciated!

I seem to have an issue with the installation.

"ChefBuildError

Backend 'maturin' is not available.
...
ModuleNotFoundError: No module named 'tomllib'

During the handling of the above exception, another exception occurred:

...
...\sites-packages\maturin_init_.py
import tomli as tomllib # type: ignore
ModukeNotFoundError: No module named 'tomli'
...

Note: this error originates from the build backend, and is likely not a problem with poetry but with polars-ols (0.1.1) not supporting PEP 517 builds. You can verify this by running 'pio wheel --no-cache-dir --use-pep517 "polars-ols (==0.1.1)" '
"

I have tomli installed in my poetry project.

I believe polars_ds is using a similar project architecture and I experienced no issue like that with that package.

Any help would be appreciated!

Thanks again !

@azmyrajab
Copy link
Owner

Hi Adrien, thank you for raising the issue - and glad you think this package may be useful

Happy to look into this for you - mind if I start by asking you what platform / architecture / OS you are on?

Github CI tests cover most (but not all) Linux and macOS systems but not windows yet. I can then hopefully reproduce your issue on the server and try to get it fixed

@azmyrajab
Copy link
Owner

Also if you could share your python version that would be helpful too!

@AdrienDart
Copy link
Author

Hi, thank you for your reply! I am using Python 3.9.0 from a poetry environment on a Windows machine.

@azmyrajab
Copy link
Owner

azmyrajab commented Apr 3, 2024

Hi @AdrienDart

windows support should be ready which should resolve the issue (see 6a30e8c and 7060e6c, and latest CI tests just passed)

So I'll let you know once the new pypy tag is released and you could try it out again? Will bundle in another improvement to how coefficients are outputted.

@AdrienDart
Copy link
Author

Amazing! Take your time and again, thank you for your work!

@azmyrajab
Copy link
Owner

Hi @AdrienDart can you try installing again, just released v0.2.0 which should support windows OS

Could you please let me know if this resolves your issue?

@AdrienDart
Copy link
Author

Hi, I just tried and I unfortunately got the same error message (with version 0.2.0 obviously). I'll migrate towards python 3.9.5 in a few days, maybe that will change something. Not sure what is causing this issue.

@azmyrajab
Copy link
Owner

azmyrajab commented Apr 4, 2024

Hey sorry about that, I think I have an idea what might be causing the issue now.

https://github.com/psf/black/blob/main/pyproject.toml#L70
psf/black#3447

I think its because my project has a dependency on black (the python linting tool). which itself if on 3.8 depends on this tomli your installation is complaining about.

and then in my pyproject.toml ...

[tool.black]
target-version = ["py310", "py311"]

I think if I add py38 and py39 to the target versions it should work. To confirm this, let me try adding a CI test/build for windows on python 3.8 (it currently does windows on 3.10). Let me try that and get back to you (a09349c - pending tests)

@azmyrajab
Copy link
Owner

Feel free to try again whenever you can and let me know if it works for you now. Tests here indicate py38 windows succeeds
If forever reason it doesn't, let's wait until you upgrade to 3.9 and see if that resolves it

@AdrienDart
Copy link
Author

Apologies for the confusion, I meant to upgrade from Python 3.9.0 to 3.9.5.
It currently looks like my poetry is not picking up the version 0.2.2 of the package yet, still showing the 0.2.0. I'll try tomorrow. Thanks for the help!

@AdrienDart
Copy link
Author

Hi, unfortunately, I get the same error with version 0.2.3.

@azmyrajab
Copy link
Owner

Strange. Unfortunately, I can’t reproduce on the windows test I am able to run on my side.

Whenever you could, can you please try installing manually with pip install in a new venv. And if errors copy the stack trace here. It will help us understand if this is specific to a poetry install or the specifics of your system so I can hopefully reproduce.

Sorry about this!

@AdrienDart
Copy link
Author

No worries. I tried on a new venv running python 3.9.5. I manage to install polars and polars-ds on it with pip (24.0). When trying to do polars-ols, I got the following error:

"
(...)
Preparing metadata (pyproject.toml) ... error

x Preparing metadata (pyproject.toml) did not run successfully
exit code: 1
Cargo, the Rust package manager, is not installed or not on PATH. This package requires Rust and Cargo to compile extensions. Install it though the system's package manager ot via https://rustup.rs/
Checking for Rust toolchain...

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

x Encountered error while generating package metadata.

(...)
"

@azmyrajab
Copy link
Owner

Great, this is very helpful, I think I should be able to do something about this. Leave with me and I will keep you posted

@azmyrajab
Copy link
Owner

Hi @AdrienDart

I managed to finally reproduce your issue (..on an Azure windows VM) - and specifically on py39 but on no later versions (e.g. py312).
So after some digging - I found the culprit to be this pyo3: feature flag in cargo.toml

Changing it to py38 from py310 means pyo3 (which is responsible for the rust bindings in python) must ensure wheels produced are compatible since py38+. Given my code is already backwards compatible, it made sense to change it
pyo3 = { version = "*", features = ["extension-module", "abi3-py38"] } # set > py38 supported version

After releasing to PyPI the latest version (0.2.4):
image

Closing as this should now resolve your issue, whenever you can upgrade - but please do confirm that all is smooth when you have a chance!

@AdrienDart
Copy link
Author

I can confirm that installation now works! Thank you for the package and for looking into this!

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

No branches or pull requests

2 participants