How to copy the executable?#

So, the Python developers knew about this and documented this deep within the docs. Here you will see all the usage of venv. We are interested in --copies flag. As per the doc, this flag serves: “Try to use copies rather than symlinks, even when symlinks are the default for the platform.”

Now the modified command to create a venv from a Conda venv without symlinks becomes:

python3 -m venv --copies /path/to/new/virtualenv

I tested this on a new python venv:

(modulus_pysdf) [s.1915438@sl1(sunbird) s.1915438]$ python3 -m venv --copies /scratch/s.1915438/temp1/
(modulus_pysdf) [s.1915438@sl1(sunbird) s.1915438]$ deactivate
[s.1915438@sl2(sunbird) s.1915438]$ cd temp1
[s.1915438@sl2(sunbird) temp1]$ ls -l bin/ | grep python3
-rwxr-xr-x. 1 s.1915438 s.1915438 15035704 Feb 15 12:53 python3
[s.1915438@sl2(sunbird) temp1]$ ls -l bin/ | grep python
-rwxr-xr-x. 1 s.1915438 s.1915438 15035704 Feb 15 12:53 python
-rwxr-xr-x. 1 s.1915438 s.1915438 15035704 Feb 15 12:53 python3

See no simlinks. This endeavours took me 3-4 hours and thanks to ChatGPT to save my time.