1,552 questions
0
votes
1
answer
53
views
Python venv command failing on MacOS with Homebrew
I've been happily using python with venv for at least the last year. It now no longer works:
python -m venv .
returns the error:
Error: Command '['/Users/sejaques/bin/python3.13', '-m', 'ensurepip', '...
Advice
0
votes
4
replies
133
views
python3.14 returns error but output is still correct
I had a python program that I could not get to work until I put it in a virtual environment. Since I use it a lot, I put the following in a zsh script:
python3 -m venv ~/bin/pypath/venv
source ~/bin/...
0
votes
2
answers
125
views
PyCharm keeps using a non-existent Python 3.14 interpreter even after removing it from the system
I’m on Windows 11 and originally had two Python installations: 3.14 and 3.9.
Both were installed and added to the PATH.
After setting up PyCharm 2025.2.4, I started getting this error when creating a ...
3
votes
3
answers
114
views
Python requests.request returning garbage
Calling an api. For almost all calls the response comes clean but for a few there is garbage in the returned json. Executing the garbage one in the Firefox browser with the same parameters returns ...
Advice
0
votes
7
replies
115
views
Is it possible to auto select a Python venv without using the terminal or VSCode?
Ok so I am the only technical person at a non-technical company. I am writing some scripts that I will be disseminating to my team. My goal is for everyone else on the team to be able to right click ...
1
vote
0
answers
198
views
Jupyter/VSCode does not recognize pip from .venv despite being properly installed
EDIT: the issue is resolved (kinda). Check GitHub discussion. It turns out that there are possibly two problematic factors. First (my case), the newest version of Jupyter extension. When I switched ...
1
vote
0
answers
45
views
Python virtual environment activated with incorrect path windows
I created a Python virtual environment on Windows, but when the virtual environment is activated, my Python path still references my global Python.
PS C:\PATH_TO_PROJECT> cmd
Microsoft Windows [...
1
vote
2
answers
178
views
How can I create a Python venv within a Bash script and then activate it immediately, all from a VS Code profile's settings.json?
I have this profile settings.json:
{
"terminal.integrated.profiles.osx": {
"python-venv": {
"path": "/opt/homebrew/bin/bash",
...
0
votes
1
answer
121
views
Pycharm 2025.2 pro WSL interpreter not running [closed]
I have created a venv interpreter using python -m venv venv and another using poetry
I pointed pycharm to these interpreters (separately), and it claims to see them
Then, running the simplest program ...
0
votes
1
answer
69
views
How can one python script launch another python script using a different virtual environment?
I have researched this question and found Running subprocess within different virtualenv with python, but my situation is a little different.
I have an astrophotography application which I run on ...
1
vote
1
answer
131
views
Import "llama_index.llms.ollama" could not be resolved
I have the following imports for a python file thats meant to be a multi llm agent soon. I wanted to use llama_index and I found a nice video from Tech with Tim which explains everything very well. I ...
0
votes
1
answer
87
views
conda activate venv is not working on vscode
I have installed vscode and miniconda(python version 3.13.5). Also I have created my virtual environment by the command "conda create" where python version is 3.10.1.
I am facing an issue ...
0
votes
0
answers
373
views
ERROR: Will not install to the user site because it will lack sys.path precedence ... using venv inside docker
I am having troubles building docker from ubuntu:24.04, Python version 3.12.3 and pip 25.1.1.
Since the recent (I think) defualt pip behavior throwing
error: externally-managed-environment
when ...
0
votes
0
answers
229
views
VS Code doesn't open Python virtual environment
I'm using Python 3.13.5 with VS Code 1.102.0 on Ubuntu 24.04.2. With VS Code updates, there were often problems with opening venv environment, but usually reloading VS Code was sufficient to make it ...
3
votes
1
answer
3k
views
Activate 'uv' environment - 'venv' mismatch
I am trying to set up an environment in Visual Studio Code for a Python project using uv on Ubuntu.
I have tried different sequences of actions, but without success. Here is the latest one:
uv init
uv ...
0
votes
2
answers
226
views
How to prevent VS Code from importing global Python env site-packages when using pixi venv?
situation
I created a new Python project with pixi venv.
I have this isolated venv, including Python.
I installed pandas etc.
I didn't install plotly etc.
I have Python installed globally.
The ...
-5
votes
3
answers
6k
views
How to install uv when I already need an virtual environment to install it?
I want to set up a new Python project and use uv for package management. I don't have it installed on my global system, so I can't initialize an virtual env with
uv venv
The only solution I see now ...
1
vote
1
answer
115
views
How do I install a python-based CLI from a venv globally?
I'm developing a CLI application with Python and I can install it with pip install -e . for an editable install, however this installs it only in the virtual environment.
I can't access the CLI from ...
0
votes
1
answer
65
views
Running NetBox from a venv in VS Code Debugger not handling --insecure
I'm trying to run NetBox in a remote installation of VS Code Server on a Ubuntu VM. I have a venv activated, and in VS Code I'm pointing to venv/bin/python as the the interpreter. Despite all of this, ...
1
vote
1
answer
325
views
How can I use Python packages installed with apt-get in a Python interpreter installed with pyenv?
I need help to install a package using apt install in the Raspberry Pi using the Python version I installed using pyenv. I already tried using pip, but the installation fails. The specific package I ...
0
votes
0
answers
79
views
Cannot import 'WebClient' and 'SlackApiError' from slack_sdk in Python
I'm trying to send a message to Slack using Python and the slack_sdk library, but I'm getting an import error.
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
The IDE (VS ...
0
votes
0
answers
372
views
pixi how to exit the venv shell in vscode?
I'm using pixi for Python in vscode.
In a normal terminal I can run pixi shell and exit, just like .venv\Scripts\activate & deactivate to enter or leave the venv.
But in vscode, I am forced to ...
2
votes
0
answers
176
views
Creating Venv fails due to ModuleNotFoundError: No module named 'torch'
I have cloned this Github repo into VSCode in order to start a new project. While trying to create a virtual environment with venv, VSCode detected the requirements.txt and asked me for permission to ...
2
votes
1
answer
108
views
When switching from pyenv to venv, what replaces pyenv's version management?
The native Python package venv is "recommended for creating virtual environments". I read that as saying that the Python Foundation wants users to switch from third party solutions like ...
0
votes
0
answers
91
views
Can't deactivate python venv on vscode after recent update
I've recently updated vscode to the most recent version, and whenever I open up a new shell or cmd it activates the venv in that directory, and that's fine and expected as before.
But now it doesn't ...
-2
votes
1
answer
175
views
How can I efficiently set up Python virtual environments for 200+ student submissions?
I am working on a grading automation tool for programming assignments. Each student submission is run in its own isolated virtual environment (venv), and dependencies are installed from a requirements....
0
votes
0
answers
28
views
Navigate to a different file from terminal
I am debugging my package written in python from venv.
Such that the repo source files, where the changes the the source appear are different from the source files installed in venv.
Is it somehow ...
0
votes
0
answers
261
views
vscode (vscodium) - Python cannot import packages from venv
I want to use Jupyter Notebook feature. My virtual environment can run an ipykernel without issues (on code as well).
When I try importing a package, it acts as if the package doesn't exist.
e.g.
...
0
votes
1
answer
100
views
running scripts with venv or npm disabled in visual-studio-code
Following is the error received while trying to set python-venv or npm-init in visual-studio-code.
cannot be loaded because running scripts is disabled on this system.
For more information, see ...
2
votes
0
answers
49
views
`.venv/lib` gets deleted just after creation on MacOS
I’ve been working on a project for a while but all of a sudden my .venv broke. Initially it created duplicates of a bunch of files inside .venv/lib, (e.g. file, file 2, file 3, ...), so I deleted the ...
4
votes
5
answers
336
views
How to use Jupyter notebooks or IPython for development without polluting the venv?
Best practice for Python is to use venv to isolate to the imports you really need. I use python -m venv.
For development, it's very convenient to use IPython and notebooks for exploring code ...
0
votes
1
answer
74
views
When using venv, packages I'm building suddenly disappear when others are installed
This is more of a where in pip could this be happening, not a question about the repos/packages.
I'm building several pytorch related repos using their setup.py scripts. For example, https://github....
-1
votes
1
answer
48
views
Why does a python script find the win32api - but not when run as a subprocess from another script? [duplicate]
I've got a script which when called via
(.venv) PS D:\Users\user4\MyPython\AllDiscs> py -m list_discs_with_folders dlist.txt
works as desired, but fails when called as a subprocess from another ...
0
votes
0
answers
19
views
No local python in Conda venv
I am using a M2 Macbook Pro. conda 24.9.2. Python 3.12. Why the command "python" is not "localized"?
conda create -n f5-tts python=3.10
conda activate f5-tts
which pip => /opt/...
1
vote
1
answer
455
views
How to avoid a Torch error with Open WebUI/Ollama
I'd like to get Open WebUI working with Ollama on Ubuntu 24.10, but installing it using pip and venv leads me to a torch error.
Firstly, Ollama (0.6.2) is working: I can type /path/to/ollama list and ...
2
votes
0
answers
44
views
Automatically switch VSC venv/interpreter depending on selected folder
My query is while switching projects how we change python interpreter to that specific project .venv shown in bottom right & the (.venv) in terminal?
Situation
I have project1 with .env1 as venv
I ...
-1
votes
2
answers
272
views
VSCode terminal uses global pip instead of venv pip
So yesterday i noticed that the vscode terminal was using the global pip instead of the pip in my virtual environment when trying to use pip or package commands. Running the python file is no problem. ...
0
votes
0
answers
130
views
Getting "externally-managed-environment" error even in a virtual environment
I am trying to write a Python script on an Ubuntu box. I had it working fine on another box, but now I cannot get it to install some libraries. I keep getting the "externally-managed-environment&...
1
vote
3
answers
273
views
How to make Vim's :python3 command use a virtual environment?
My system has Vim preinstalled although I also installed it with homebrew.
I noticed when I run the following command in Vim:
:py3 import sys; print(sys.executable)
it gives an output of /opt/...
0
votes
2
answers
957
views
Why is my virtual environment not working?
I have a Python virtual environment (created with venv) kept in a directory in my project. I created it and sourced the activate script. I am sure that it worked, because my terminal prompt starts ...
0
votes
0
answers
15
views
Debug a dead kernel using ipykernel kernel --debug
I just added a new kernel to Juypter Notebook using:
python -m ipykernel install --user --name=venv3.12
and edited the path of Python to the Python executable at a venv folder. The contents of the ...
0
votes
0
answers
73
views
VS Code Terminal Prepends Virtual Environment Name to Username in Zsh on macOS
When I create a virtual environment using Venv in Visual Studio Code--either using Cmd + Shift + P or via the command line--I notice the following prompt in the integrated Zsh terminal:
.venvusername@...
0
votes
1
answer
630
views
"Failed to import the required Python library (firewall)", using a venv with Galaxy Collections inside it
I have an Ansible playbook using a role that should do some basic Linux setup tasks.
OS: Oracle Linux 9.5 (so, basically RHEL)
Ansible 2.14
ansible.posix 1.5.4 (hard dependency)
Python 3.9
Ansible ...
2
votes
0
answers
125
views
Cross-platform command to activate venv
Is there a way to activate a Python venv with one command that works on Windows and Unix?
The standard commands are:
Windows: venv\Scripts\Activate.ps1
Unix: source venv/activate
(There's a handy ...
0
votes
1
answer
169
views
Unable to install tensorflow-federated on M2 Macbook
I am currently facing a really frustrating problem with installing tensorflow federated. I am on M2 Macbook Air, using virtual env, no conda.
I was following this tutorial, and did the following:
...
0
votes
2
answers
221
views
too many redirects error, mod_wsgi apache and django (python-venv)
I have a problem, with django and apache (mod_wsgi), I get the browser error "too many redirects".
Here my files and apache configuration
project tree
├── db.sqlite3
├── djangoProject
│ ├──...
0
votes
1
answer
72
views
Python Venv won't connect to virtual environment
I'm trying to install any packages to venv, but the pip install command's target directory is always /opt/homebrew/lib/python3.12/site-packages/, but I'd expect it to be something under venv.
Here is ...
-1
votes
2
answers
72
views
Python: import mysql fails outside venv
I get the ModuleNotFoundError: no module named 'mysql' error when I run a Python script.
I am a novice to Python programming. The mysql-connector was installed via environment (python3 -m venv env). ...
0
votes
0
answers
50
views
problem locating file in resources folder in python project inside docker
I wrote a python script initialized using poetry to connect to Gdrive API and dockerized it using this Dockerfile :
# First stage: build the application
FROM python:3.10.2-slim as builder
# Set the ...
8
votes
2
answers
6k
views
Can I have different virtual environments in a project managed by uv?
On a Windows machine, I'm developing a Python project that I manage using uv. I run the unit tests with uv run pytest, and uv automatically creates a virtual environment in .venv. So far, so good.
But ...