Score:0

do-release-upgrade broke python's virtual environment and pip

ke flag

I did a release upgrade, followed by apt upgrade no problem, everything went smooth. Except, now virtual environments don't work at all. I have various one set up for various django projects I'm working on. When I try to run django manage.py runserver I get:

ModuleNotFoundError: No module named 'django'

OK, weird, so I'll try to install django again

ModuleNotFoundError: No module named 'pip'

And I cannot run pip outside the virtual environment, as explained here.

So what is the practice now? Do I need to recreate my virtual environments?

Update:
If I create a new environment (mkvirtualenv new_env) pip works fine.

Edit: Sorry, I forgot to add. I've updated from mainstream Ubuntu 22.10 to mainstream Ubuntu 23.04

David avatar
cn flag
Upgrade from what to what?
ke flag
Sorry, I took that for granted, and I shouldn't have. I've updated from mainstream Ubuntu 23.10 to mainstream Ubuntu 23.04 I added that to my question.
Raffa avatar
jp flag
You might need to run `pip3 install -U django` ... etc. ... Please see for example: [python3.8 and pip after upgrading to 22.04.2](https://askubuntu.com/q/1456669)
David avatar
cn flag
23.10 does not even exist yet. Will not be out till Oct. that makes this off topic.
ke flag
Sorry... it is Ubuntu 22.10, of course.
Score:0
ke flag

I've tried @Raffa's solution but then I see that pip is not installed. Following that hint I found in another thread how to fix that:

python -m ensurepip --default-pip

After that I needed to install the packages again though.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.