Slow virtualenv activation in terminal
See original GitHub issueIssue Type: Bug
When opening a terminal, the source .venv/bin/activate
command is issued too late. Most times I’m already writing another command and the result is:
- Venv activation not done.
- My command fails.
- Frustration.
- This is very rare but hypotetically possible: that I execute a command I didn’t want, and something breaks.
A video to understand it:
https://user-images.githubusercontent.com/973709/111748457-77b1c180-8888-11eb-815c-70783b9764a7.mp4
Extension version: 2021.3.658691958 VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T10:55:24.277Z) OS version: Linux x64 5.10.23-200.fc33.x86_64
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-9750H CPU @ 2.60GHz (12 x 4000) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: disabled_off opengl: enabled_on protected_video_decode: unavailable_off rasterization: disabled_software skia_renderer: enabled_on video_decode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | 1, 1, 1 |
Memory (System) | 15.47GB (1.76GB free) |
Process Argv | –no-sandbox --unity-launch --crash-reporter-id 1b07b1f6-f187-42fc-aa9e-516fd1a4c83e |
Screen Reader | no |
VM | 0% |
DESKTOP_SESSION | gnome |
XDG_CURRENT_DESKTOP | GNOME |
XDG_SESSION_DESKTOP | gnome |
XDG_SESSION_TYPE | x11 |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30259475
pythontb:30265425
vscoresta800cf:30276762
vspre833:30267464
vsdfh931:30275552
vshan820:30276952
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Python virtualenv is very slow - django - Stack Overflow
I've just created the same virtualenv with exactly the same libs installed inside from a fresh Ubuntu 12.04 (live CD) and everything works...
Read more >Python virtualenv and venv dos and don'ts - InfoWorld
Another common mistake people make with virtual environments is forgetting to activate them, or not activating the right one. Before a virtual ...
Read more >run virtualenv in new terminal tab automatically - Ask Ubuntu
Automatically running a command on creation of a new terminal tab ... if [[ -f .venv/bin/activate ]] ; then source .venv/bin/activate fi.
Read more >Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and ... Create and activate a Python virtual environment ......
Read more >Elegantly activating a virtualenv in a Dockerfile - Python⇒Speed
Since you're using a virtualenv , you need to activate it—but if you're just getting started with Dockerfiles, the naive way doesn't work....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Yajo @firvida @aleuyX there is alternative hack:
Put it in settings.json: “python.terminal.activateEnvironment”: false, “terminal.integrated.env.osx”: {“VENV_PATH”: “.venv/bin/activate”,}
and in END of ~./zshrc:
if [[ -n $VENV_PATH ]]; then echo “Activating venv $VENV_PATH” source $VENV_PATH fi
Now venv is activating immediately when vscode terminal is open =)
PS: if you use windows or linux, use another terminal.integrated.env.* method. PSS: if you use bash instead zsh, use .bachrc
Have the exact same behavior in my computer, I can’t see how this is a duplicated if #11039.
OS: Opensuse Leap 15.3 / Centos 8 / Manjaro VSCode: 1.57.0 Extension version: v2021.7.992362372-dev