Python Forum
copy a virtual environment to a new system
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
copy a virtual environment to a new system
#2
Moving can go bad,as OS environment Python version ect... can be different.
The relocatable option is deprecated and generally fails to solve the problem.
The fix or how meant to be should be used is run pip freeze > requirements.txt and recreate on new system with pip install -r requirements.txt.
$ oldenv/bin/pip freeze > requirements.txt
$ python -m venv newenv
$ newenv/bin/pip install -r requirements.txt
So can just keep requirements.txt for your virtual environments and recreate on new system.
In the big picture so is venv a dependency management tool,like also pipenv is.

A level above setuptools(setup.py) to create wheels.
So a wheel contain everything dependencies,python files,can also have C binray/dependencies.
Can be moved around and installed with pip install my_wheel.whl
So PyPi is really a online a distribution of wheels(as wheel is what you upload to PyPi).

Poetry try to make this easier at higher level also it replace setup.py, requirements.txt, setup.cfg, MANIFEST.in and the newly added Pipfile.
To one file pyproject.toml
Poetry dos a good job trying to make this simpler.

In the picture is also Anaconda with there tool like pip which is conda.
So eg Miniconda is standalone and can be moved around.

So a little overview on this topic that's not so easy,but is better than it used to be Undecided
[Image: 0*7ezJOtYUkI5zyqWU.png]
Reply


Messages In This Thread
RE: copy a virtual environment to a new system - by snippsat - Sep-17-2019, 11:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  virtual environment questions Skaperen 2 1,718 May-21-2019, 08:11 PM
Last Post: Skaperen
  PyCharm virtual environment (venv) issues? j.crater 1 2,265 Aug-14-2018, 10:22 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020