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

Don't require uv build context when having no pypi-dependencies #1232

Closed
2 tasks done
fpaniagua opened this issue Apr 19, 2024 · 6 comments · Fixed by #1366
Closed
2 tasks done

Don't require uv build context when having no pypi-dependencies #1232

fpaniagua opened this issue Apr 19, 2024 · 6 comments · Fixed by #1366
Labels
bug Something isn't working uv Related to the uv integration

Comments

@fpaniagua
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

[project]
name = "pixi-example"
channels = ["conda-forge"]
platforms = ["linux-64"]

[tasks]

[dependencies]
python = "3.6.*"
FROM ghcr.io/prefix-dev/pixi:0.19.1 AS build

COPY . /app
WORKDIR /app
RUN pixi install
RUN pixi shell-hook > /shell-hook

FROM ubuntu:22.04 AS production

COPY --from=build /app/.pixi/envs/default /app/.pixi/envs/default
COPY --from=build /shell-hook /shell-hook
WORKDIR /app
EXPOSE 8000
CMD ["/bin/bash", "/shell-hook"]
 => ERROR [build 4/5] RUN pixi install                                                                                                                                                                            6.0s
------                                                                                                                                                                                                                 
 > [build 4/5] RUN pixi install:                                                                                                                                                                                       
5.753   × Querying Python at `/app/.pixi/envs/default/bin/python3.6` failed with                                                                                                                                       
5.753   │ status exit status: 1 with exit status: 1                                                                                                                                                                    
5.753   │ --- stdout:                                                                                                                                                                                                  
5.753   │                                                                                                                                                                                                              
5.753   │ --- stderr:
5.753   │ Traceback (most recent call last):
5.753   │   File "<string>", line 1, in <module>
5.753   │   File "/root/.cache/rattler/cache/uv-cache/.tmpvoF9u4/python/
5.753   │ get_interpreter_info.py", line 526, in main
5.753   │     "platform": get_operating_system_and_architecture(),
5.753   │   File "/root/.cache/rattler/cache/uv-cache/.tmpvoF9u4/
5.753   │ python/get_interpreter_info.py", line 429, in
5.753   │ get_operating_system_and_architecture
5.753   │     from .packaging._manylinux import _get_glibc_version
5.753   │   File "/root/.cache/rattler/cache/uv-cache/.tmpvoF9u4/python/packaging/
5.753   │ _manylinux.py", line 1
5.753   │     from __future__ import annotations
5.753   │     ^
5.753   │ SyntaxError: future feature annotations is not defined
5.753   │ ---
5.753 
------
Dockerfile:5
--------------------
   3 |     COPY . /app
   4 |     WORKDIR /app
   5 | >>> RUN pixi install
   6 |     RUN pixi shell-hook -e prod > /shell-hook
   7 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pixi install" did not complete successfully: exit code: 1

Issue description

increasing verbosity:

5.789 DEBUG rattler_conda_types::repo_data::topological_sort: Breaking cycle: {}
5.789  INFO pixi::environment: create prefix file: /app/.pixi/envs/default/conda-meta/pixi_env_prefix
5.789  INFO pixi::environment: Checking if history file exists: /app/.pixi/envs/default/conda-meta/history
5.789  INFO pixi::environment: Creating history file: /app/.pixi/envs/default/conda-meta/history
5.789 DEBUG uv_client::base_client: Using registry request timeout of 300s
5.789 DEBUG uv_interpreter::interpreter: Probing interpreter info for: /app/.pixi/envs/default/bin/python3.6
5.789 DEBUG validating{path=/root/.cache/rattler/cache/pkgs/tk-8.6.13-noxft_h4845f30_101}:Connection{peer=Client}: h2::codec::framed_write: send frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) }
5.789 DEBUG validating{path=/root/.cache/rattler/cache/pkgs/tk-8.6.13-noxft_h4845f30_101}:Connection{peer=Client}: h2::proto::connection: Connection::poll; connection error error=GoAway(b"", NO_ERROR, Library)
5.789 DEBUG validating{path=/root/.cache/rattler/cache/pkgs/tk-8.6.13-noxft_h4845f30_101}:Connection{peer=Client}: rustls::common_state: Sending warning alert CloseNotify    
5.789   × Querying Python at `/app/.pixi/envs/default/bin/python3.6` failed with
5.789   │ status exit status: 1 with exit status: 1
5.789   │ --- stdout:
5.789   │ 
5.789   │ --- stderr:
5.789   │ Traceback (most recent call last):
5.789   │   File "<string>", line 1, in <module>
5.789   │   File "/root/.cache/rattler/cache/uv-cache/.tmpTJGuzv/python/
5.789   │ get_interpreter_info.py", line 526, in main
5.789   │     "platform": get_operating_system_and_architecture(),
5.789   │   File "/root/.cache/rattler/cache/uv-cache/.tmpTJGuzv/
5.789   │ python/get_interpreter_info.py", line 429, in
5.789   │ get_operating_system_and_architecture
5.789   │     from .packaging._manylinux import _get_glibc_version
5.789   │   File "/root/.cache/rattler/cache/uv-cache/.tmpTJGuzv/python/packaging/
5.789   │ _manylinux.py", line 1
5.789   │     from __future__ import annotations
5.789   │     ^
5.789   │ SyntaxError: future feature annotations is not defined
5.789   │ ---
5.789 
------
Dockerfile:5
--------------------
   3 |     COPY . /app
   4 |     WORKDIR /app
   5 | >>> RUN pixi install -vvv
   6 |     RUN pixi shell-hook -e prod > /shell-hook
   7 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pixi install -vvv" did not complete successfully: exit code: 1

The error seems to be coming from switch to uv.

Using pixi v0.15.2 does not have an issue on install.

Tried from v0.15.2 - v0.19.1, with python 3.6 and python 3.5:

Pixi Version python = "3.6.*" python = "3.5.*"
v0.15.2 ✅︎ ✅︎
v0.16.0 ✅︎ ✅︎
v0.16.1 ✅︎ ✅︎
v0.17.0 ✅︎
v0.17.1 ✅︎
v0.18.0
v0.19.0
v0.19.1

Breaks occur in v0.17 and v0.18, so not entirely uv's fault.

Expected behavior

Pixi to install dependencies and setup environment successfully for python <= 3.6.*

@fpaniagua fpaniagua added the bug Something isn't working label Apr 19, 2024
@fpaniagua
Copy link
Author

Does uv need to use the environment's python?

Seems like it needs python 3.7+ to deal with SyntaxError: future feature annotations is not defined.

@fpaniagua
Copy link
Author

Looking at uv itself, even its release earliest version says:
https://github.com/astral-sh/uv/tree/0.0.5

uv supports and is tested against Python 3.8, 3.9, 3.10, 3.11, and 3.12.

So maybe now pixi is also limited to supporting python 3.8+ environments?

@ruben-arts
Copy link
Contributor

He @fpaniagua thanks for this deepdive, I wasn't aware of this myself.

We currently always create UvContext which results in these checks/errors. I guess we could allow a non pypi environment to skip using the UvContext.

I believe we added this to also do cleanup behavior. If your lock file is deleted and you don't have any pypi dependencies in your environment anymore you could potentially still need to uninstall dependencies.

@ruben-arts ruben-arts added the uv Related to the uv integration label Apr 29, 2024
@ruben-arts ruben-arts changed the title python <= 3.6 unsupported with uv Don't require uv build context when having no pypi-dependencies Apr 29, 2024
@fpaniagua
Copy link
Author

So I realize now my minimal example above excludes pypi dependencies.

My real world problem is a python 3.6 project with conda and pypi packages. (At least 1 pypi package has no conda package equivalent).

I am supporting it via downgraded pixi v0.17.1. Just upgraded locally to v0.21.0, and the lock file version has changed. So will likely keep two versions of pixi locally for now to continue maintaining the project.

Should I file a separate issue?
Unsure if its worth supporting(esp since 3.6/3.7 are EOL), maybe just need to document that only python 3.8+ supported when using pypi deps?

@gzm55
Copy link

gzm55 commented May 7, 2024

can we avoid introduce uv old python (3.6, 3.6)? when call pixi add --pypi xxx on a project with old python, it could fall back to pipi install xxx. Sometimes, we only need native python, and this limitation should be avoid.

@ruben-arts
Copy link
Contributor

We can't support pip install's but we are looking into Lifecycle hooks So you can run pip install in a task which would be linked to a install hook.

We should add a test verifying the oldest version of python we support and add it to the documentation indeed!

The initial issue still stands and we're working on a fix.

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

Successfully merging a pull request may close this issue.

3 participants