Groups | Search | Server Info | Login | Register


Groups > gnu.emacs.help > #61045

Re: Eshell and Python venv

Path csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From Manuel Giraud <manuel@ledu-giraud.fr>
Newsgroups gnu.emacs.help
Subject Re: Eshell and Python venv
Date Sun, 11 Jan 2026 12:48:22 +0100
Organization A noiseless patient Spider
Lines 21
Message-ID <87ms2kid4p.fsf@ledu-giraud.fr> (permalink)
References <87ecnwn6h4.fsf@pm.me>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Sun, 11 Jan 2026 11:48:23 +0000 (UTC)
Injection-Info dont-email.me; posting-host="c9863ad96ca36f30dc10081397654372"; logging-data="4034544"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Xo8Yitk3P2ggtX8PfIPjr"
User-Agent Gnus/5.13 (Gnus v5.13)
Cancel-Lock sha1:ZwvsoinufTKhs8wKqDrFqL6EPVY= sha1:sYV00v6jiBSRe1dD/O1SrbxLiSE=
Xref csiph.com gnu.emacs.help:61045

Show key headers only | View raw


Rust Buckett <rsstinnett@pm.me> writes:

> Is there a way to activate a Python virtual environment in Eshell?  When
> I try `source ./.venv/bin/activate`, I get "Wrong type argument: listp,
> "["".  Obviously, this is because `source` is built into the shell
> (bash, csh, fish, eshell, etc.) and the default activate is for bash.
> So, I guess the real question is if there is already a script to
> activate the venv in eshell?  Or some other way to do it?

If you read "./.venv/bin/activate", you'll see that what it do mostly is
setting VIRTUAL_ENV to "./venv" and add "$VIRTUAL_ENV/bin" to your PATH
to access the "correct" python.

So doing the following should work:
   export VIRTUAL_ENV="/absolute/path/to/venv"
   export PATH="$VIRTUAL_ENV/bin":$PATH

But maybe you could come up with an elisp function to more easily
activate (and deactivate) those.
-- 
Manuel Giraud

Back to gnu.emacs.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Eshell and Python venv Rust Buckett <rsstinnett@pm.me> - 2026-01-10 23:00 -0500
  Re: Eshell and Python venv Manuel Giraud <manuel@ledu-giraud.fr> - 2026-01-11 12:48 +0100
    Re: Eshell and Python venv Rust Buckett <rsstinnett@pm.me> - 2026-01-11 07:05 -0500

csiph-web