Search code examples
pippython-packagingpython-venvrequirements.txt

How to transfer venv from Windows 10 to Ubuntu


I have venv created in Windows with all dependencies for my project, but when transfered whole project from Windows 10 to Ubuntu, my usual way to activate venv does not work:
venv\Scripts\activate

My question is:

Do I have to re-create new venv in Ubuntu and use requirements.txt to install all dependencies for my project, or is it possible to use my old venv and if so how?


Solution

  • You need to recreate the virtual environment. These commands can help you get the list of dependencies installed in the existing environment:

    • python -m pip freeze > requirements.txt

    and then install these dependencies in the new environment:

    • python -m pip install --requirement requirements.txt

    There is info about this topic here: