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

Using uv leads to a failed ipykernel installation #3093

Open
jthomasmock opened this issue May 10, 2024 · 5 comments
Open

Using uv leads to a failed ipykernel installation #3093

jthomasmock opened this issue May 10, 2024 · 5 comments
Labels
bug Something isn't working investigate Needs initial, limited investigation to prioritize lang: python

Comments

@jthomasmock
Copy link
Contributor

jthomasmock commented May 10, 2024

Positron Version: 2024.05.0 (Universal) build 1160
Code - OSS Version: 1.89.0
Commit: 5024068
Date: 2024-05-08T03:21:09.376Z
Electron: 28.2.8
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0

Steps to reproduce the issue:

  1. Install the uv tool
  2. Create a new project/folder and navigate to it.
  3. $ uv venv to create a new virtual environment.
  4. This will prompt Positron to ask you to use the .venv as the default for the workspace. Select yes which will also attempt to install ipykernel and select Yes.
  5. Because uv doesn't include pip in the .venv, the pip install ipykernel will fail as it needs to be uv pip install ipykernel instead

What did you expect to happen?

It would be nice if Positron could work with uv to install packages.

Were there any error messages in the output or Developer Tools console?

@jthomasmock jthomasmock added bug Something isn't working lang: python labels May 10, 2024
@petetronic petetronic added this to the Future milestone May 13, 2024
@jthomasmock
Copy link
Contributor Author

Cross-posting: https://dev.to/astrojuanlu/python-packaging-is-great-now-uv-is-all-you-need-4i2d

Using:

uv init
uv add ipykernel

Creates a .venv and installs ipykernel, but Positron has a popup to prefer this .venv and tries to install ipykernel with pip directly, then throws an error.

@dmi3kno
Copy link

dmi3kno commented Sep 26, 2024

I think Positron should support uv in the project creation phase. If uv is detected, it should appear under this dropdown (along with venv and conda)

image

I also scratch my head trying to develop a workflow which would allow me to use Positron projects with uv-managed environments.

@juliasilge
Copy link
Contributor

juliasilge commented Jan 18, 2025

In #6020 we are adding support for installing pip when it is missing (in order to install ipykernel). This is going to feel real bad to uv users, so when we add support for detecting uv environments and correctly installing into them, we should also confirm we are never installing pip into uv environments.

cc @samclark2015

@austin3dickey
Copy link
Contributor

Note that you can use uv venv --seed to workaround this issue, because the --seed flag installs pip for you.

@juliasilge juliasilge added the investigate Needs initial, limited investigation to prioritize label Jan 22, 2025
@jthomasmock
Copy link
Contributor Author

jthomasmock commented Jan 22, 2025

I'll also note that it looks like uv encodes some metadata into the pyenv.cfg and we could sniff that to use uv pip install ipykernel but I'm not sure if all the different methods of managing Python will also add that metadata:

#! pyenv.cfg
home = /Users/thomasmock/.pyenv/versions/3.12.0/bin
implementation = CPython
uv = 0.2.37 #<<-- uv version info
version_info = 3.12.0
include-system-site-packages = false
relocatable = false
prompt = uv-testing

@juliasilge juliasilge modified the milestones: Future, Release Candidate Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigate Needs initial, limited investigation to prioritize lang: python
Projects
None yet
Development

No branches or pull requests

5 participants