• Uncategorized

About python : Create-virtual-environment-identical-to-main-Python-installation-incl-CUDA-dependencies

Question Detail

I currently work on a server of my university, where I am using Python with Tensorflow and Cuda. I built some machine learning models on my local machine and copied them onto the server, where they run fine with the basic Python installation.
However, I want to install a few additional packages and I also want to make sure that I do not have to be worried about updates of the software installed on the server that could cause problems with my code.
I do not have and cannot get admin permissions to install any programs or modules outside my personal directory, since I am only a regular user and a student above that.

Now I wondered if there is an easy way to just clone the main Python installation to a virtual environment in my home folder. I could basically create a new virtual environment and install Tensorflow etc, but I found it very frustrating when I tried to set it up with Cuda on my private computer. Moreover, I find it rather complicated to access the server (log-in credentials, vpn, 2-factor-authorisation), so I want to minimize the trial-and-error time that I often need when I try custom installation of modules.

Question Answer

Approach 1:
use “pip freeze > requirement.txt” to generate the requirements file and install all requirements using requirements file using “pip install -r requirement.txt” command.

Approach 2:
use a virtualenv-clone package to make clone of the existing environment.
https://pypi.org/project/virtualenv-clone/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.