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

Magic module installation does not use same virtual environment as Marimo #2498

Closed
simonw opened this issue Oct 4, 2024 · 7 comments
Closed
Labels
bug Something isn't working upstream

Comments

@simonw
Copy link

simonw commented Oct 4, 2024

Describe the bug

I tried running this:

import llm

And then clicking the "install module" button. The first time I tried it this seemed to work but then I could not import the module. I think it was installed in the wrong virtual environment.

Worth noting that I had started Marimo using uvx marimo new, so it was not running in my system's default environment.

Environment

I ran uvx marimo env:

{
  "marimo": "0.9.1",
  "OS": "Darwin",
  "OS Version": "24.0.0",
  "Processor": "arm",
  "Python Version": "3.12.0",
  "Binaries": {
    "Browser": "129.0.6668.90",
    "Node": "v22.4.1"
  },
  "Dependencies": {
    "click": "8.1.7",
    "importlib-resources": "missing",
    "jedi": "0.19.1",
    "markdown": "3.7",
    "pygments": "2.18.0",
    "pymdown-extensions": "10.11.2",
    "ruff": "0.6.9",
    "starlette": "0.39.2",
    "tomlkit": "0.13.2",
    "typing-extensions": "missing",
    "uvicorn": "0.31.0",
    "websockets": "12.0"
  },
  "Optional Dependencies": {}
}

Code to reproduce

Run this:

uvx marimo new

Then this:

import llm
@simonw simonw added the bug Something isn't working label Oct 4, 2024
@simonw
Copy link
Author

simonw commented Oct 4, 2024

When I'm working with Jupyter notebooks I always install packages like this:

%pip install llm

Because that way it is guaranteed to use a pip that is running in the same environment as the notebook itself, which means I don't have to even think about what virtual environment that might be.

@akshayka
Copy link
Contributor

akshayka commented Oct 4, 2024

Thanks for reporting; we'll fix this.

EDIT: I also can't reproduce. uv 0.4.1.

@mscolnick
Copy link
Contributor

@simonw what version of uv are you using? this works for me, and I reported this before for uv run and they fixed it: astral-sh/uv#6543

@simonw
Copy link
Author

simonw commented Oct 4, 2024

uv --version
uv 0.4.1 (823f23e22 2024-08-30)

I'm upgrading it now:

uv pip install -U uv
uv --version
uv 0.4.18 (7b55e9790 2024-10-01)

And now:

uvx marimo new

Then:

import llm

CleanShot 2024-10-04 at 12 53 13@2x

That default pip option gave me the same problem. I tried again and this time switched to uv in that menu:

CleanShot 2024-10-04 at 12 53 13@2x

And that worked!

So there's still a problem here with the default option to use "pip", I think.

@simonw
Copy link
Author

simonw commented Oct 4, 2024

... and now I can't replicate the problem I had with pip. I tried this:

rm -rf ~/.local/share/uv/tools/marimo/
uvx marimo new

And this time when I did the import llm and then click install dance it worked as it should.

So maybe there was something broken in my uvx marimo environment which I fixed by deleting that directory in order to recreate it?

@akshayka
Copy link
Contributor

akshayka commented Oct 4, 2024

Cool, thanks for reporting back; good to hear that it's at least working now, though like the other issue, I'm not sure how it would have become broken in the first place.

I will close this issue for now, but if it shows up again let us know?

@akshayka akshayka closed this as completed Oct 4, 2024
@mscolnick
Copy link
Contributor

You probably can't install with pip if you are running in a uv venv. Maybe we could figure that out and warn you.

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

No branches or pull requests

3 participants