Eloi Torrents
Eloi Torrents6mo ago

Python env packages

How to setup a virtual environment? I have a simple notebook in a test folder
import tensorflow
import tensorflow
I'm on linux, I have marimo installed in the system (not in a virtual environment) I created a virtual environment in the same directory as the notebook:
python -m venv --system-site-packages venv
python -m venv --system-site-packages venv
But running marimo in the test folder doesn't seem to see the venv in the test/venv folder... I also tried running
. ./venv/bin/activate
. ./venv/bin/activate
Before running marimo but I have the same problem. The error that I get
Missing packages

The following packages were not found:

tensorflow

If you set up a virtual environment, marimo can install these packages for you.
Missing packages

The following packages were not found:

tensorflow

If you set up a virtual environment, marimo can install these packages for you.
Is not very helpful...
7 Replies
dmad
dmad6mo ago
Did you activate the environment and then install Tensorflow? You can also manually add to PYTHONPATH, but that's not recommended
Eloi Torrents
Eloi TorrentsOP6mo ago
Yes, I did. then I opened marimo while inside the environment
dmad
dmad6mo ago
What happens when you run:
import sys

sys.path
import sys

sys.path
in a cell?
Akshay
Akshay6mo ago
We have some logic for detecting whether marimo is running in a virtual environment. Looks like it’s not exhaustive.
Akshay
Akshay6mo ago
GitHub
marimo/marimo/_runtime/packages/utils.py at main · marimo-team/marimo
A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git. - marimo-team/marimo
Eloi Torrents
Eloi TorrentsOP5mo ago
I get the current working directory plus: 1: "/usr/bin" 2: "/usr/lib/python312.zip" 3: "/usr/lib/python3.12" 4: "/usr/lib/python3.12/lib-dynload" 5: "/usr/lib/python3.12/site-packages"
Akshay
Akshay5mo ago
Can you also print sys.prefix, sys.real_prefix, and sys.base_prefix?