AnswerBank

PC Migration Notes No. 1: venv is Not Portable.

Change, and more Change

I've been working a lot more programming projects thanks to the new AI tools. I now have:

  • python .venv environments
  • docker containers/volumes
  • and postgresql databases

all of which complicate a computer migration.

Here is the first few short blog articles explaining how to migrate resources such as a .venv environment, postgresql databases and docker volumes.

Migrating my .venv Project

I recently upgraded to a new laptop (Ubuntu 24 -> 26).

When attempting to activate and install my python .venv project:

                        source .venv/bin/activate
                        python -m pip install -e .
                    

I got an error:

                        "No module named pip (.venv)"
                    

I learned that this was because I had moved the .venv folder from my old system to my new one, and .venv folders are not portable.

To fix this, I removed the old folder:

                        rm -rf .venv
                    

and created it anew:

                        python3 -m venv .venv
                        source .venv/bin/activate
                        python -m pip install --upgrade pip
                        python -m pip install -e .
                    

then verified:

                        which python 
                        which pip
                    

Now everything works well.