4

I want to CLONE Python and ALL installed packages into virtual environment using virtualenv.

there are couple of answers here on Stackoverflow (How to create a virtualenv by cloning the current local environment?) - they recommend doing the pip freeze > 1.txt in local environment. And after this in virtual environment pip install -r 1.txt. But this way doesn't work. After running "pip install -r 1.txt" it says that "Requirement already satisfied: asn1crypto==0.22.0 in c:\python34\lib\site-packages" and points to LOCAL packages. So, if I delete or upgrade LOCAL packages they will be changed in VIRTUAL one too.

I also tried to use options --always-copy --system-site-packages. No success. see the printscreen: enter image description here

Even after ALL these steps my Virtual env is 17,6 Mb, but local is 290 Mb. I want the virtualenv to be 290 Mb too (or close to it) - an ABSOLUTE copy.

So, the question - how to do a FULL absolute copy of Python and ALL installed packages for the given moment using virtualenv? (OS - Windows) Or may be you know some other way - not with virtualenv.

Thanks a lot.

User New
  • 404
  • 7
  • 23

2 Answers2

0

This is sort of a question to see if I fully understand, but it might be the answer too.

In the first virtual environment venv_1 you create the requirements.txt file. (venv_1 is activated)

Then you deactivate venv_1 and create a second virtual environment venv_2

You activate venv_2

source ./path/to/venv/bin/activate

and then,

pip install -r requirements.txt

So, are you activating the second virtual environment and installing into it?

I hope this is useful.

[UPDATE]... Sorry, I misunderstood a bit. I didn't realise you did not start from a virtualenv. So, I have tried this on my Mac and I did have some problems with Matplotlib and something else BUT, I upgraded all my packages and then did a pip freeze > requirements.txt, then created a virtual environment and installed from the requirements file into the virtual environment and it worked. Sorry I can't help other than to say that it did work for me on mac. Good luck.

johnr
  • 46
  • 4
  • 1
    hi. No. there is NO first and second virtual environments. There is Python (LOCAL, usual Python with many modules) and I want to create ONE virtual environment which will be a FULL copy of Python that is installed on my PC (with ALL modules). – User New Sep 30 '17 at 16:10
0

Maybe Your environment already has all the libs that you are trying to install from your .txt file.

Because I got the same "requirement already satisfied" error and turned out that i was trying to installing the .txt file in the same env i clonned it from ;P

Nerdcore
  • 23
  • 5