-
Notifications
You must be signed in to change notification settings - Fork 27
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
When I use Poetry and Nuitka/Nuitka-Action@main, Nuitka cannot utilize the Python interpreter from the Poetry virtual environment. #55
Comments
Poetry doesn't integrate with Nuitka as a build system, but that is not attempted to be used here. Windows console mode is not a boolean, but a choice of values, if you mean to have true, that would be "force", which currently is the default. What error symptoms do you get "obtain a valid dependency environment" seems odd. The Nuitka action probably doesn't run inside a "poetry run" or so, which might be needed. I guess, it would have to use pipenv, poetry, pdm etc config files, but currently that is not implemented. I welcome PRs to do so. |
Thank you very much for your reply. I looked at the action.yml file in the repository. I was wondering if it would be possible to add a parameter to run Nuitka from a specified environment. Currently, it uses Another approach could be to provide a preceding step to install Nuitka into the specified environment. I don’t have any particularly good solutions. Yesterday, I managed to build it using pip, but it took about 45 minutes for each build. This feels too long. It might be because the CPU of the server provided by the action is too weak. I'm not sure how to speed it up; it takes about 8 minutes on my own computer. |
This might not be an issue with Nuitka, but rather a problem with Poetry installing dependencies. If Poetry could install the packages into the local environment instead of a virtual environment, the issue would be resolved. Perhaps tools like Poetry and Pipenv could be built into the action? This way, users wouldn't need to install them separately and could use them directly. From my research, it seems the problem is that when I used Poetry to install dependencies earlier, they were not installed into the local environment. |
Yes, they could and probably should be, maybe picking it up from the environment would be good. Nuitka generally would e.g. be expected to be ran like Instead, for the action, we probably could use a |
I had an issue which was related to this; I feel I should add a note here to help others with similar issues. My Python project uses a What worked for me: name: Build EXE using poetry
on:
workflow_dispatch:
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10.10'
architecture: 'x64'
- name: Install dependencies
env:
POETRY_VIRTUALENVS_CREATE: false
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --no-cache --no-interaction
- name: Debug Packages
run: |
pip list
poetry show
- name: Build Python script
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: [SCRIPT.PY]
include-module: dotenv
- name: Upload Windows Artifact
uses: actions/upload-artifact@v3
with:
name: [ARCHIVE_NAME]
path: [PATH/SCRIPT.EXE] |
I agree that it would be great to have Nuitka be able have a configuration to use a given virtual environment. The Poetry team don't encourage the use of poetry to global and for good reasons! Having the dependencies for the target encapsulated in a virtual environment, which is then used by the build process would be cleaner. Also, it would be clearer when something is going wrong; it took me a long time to work out what was going wrong with my config (I was previously using (Anyway, thank you for providing a great tool like Nuitka. I hope my comments might help the next user get up their learning curve faster!) |
This is Actions file
python -m pip list
no thingsOutput:
but poetry show output
This will result in Nuitka being unable to obtain a valid dependency environment. I also tried to install Poetry directly in the local environment, but it doesn't seem to work either.
Thank you very much if it can be resolved, otherwise I can only use pip. Perhaps there could be a parameter that can mark where to use Python from?
——Translate through Baidu
The text was updated successfully, but these errors were encountered: