4

I am trying to create a virtualenv on my external hard drive that I use for both my Ubuntu and my Windows installation (I have a SSD and use 2TB external hard drive for anything but PC games).

When I navigate to the place and try to create it with the commands that work on the standard Ubuntu home drive, I get the following:

nebelhom@nebelhom-desktop:/media/extHDD/virt_folder$ virtualenv MyFolder
New python executable in /media/nebelhom/extHDD/virt_folder/MyFolder/bin/python
ERROR: The executable /media/nebelhom/extHDD/virt_folder/MyFolder/bin/python could not be run: [Errno 13] Permission denied

Running the same with "sudo" did not help either and gave the same error as above.

What I tried next is indicating the python version

nebelhom@nebelhom-desktop:/media/nebelhom/extHDD/virt_folder$ sudo virtualenv -p python2.7 MyFolder
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /media/nebelhom/extHDD/virt_folder/MyFolder/bin/python2.7
Not overwriting existing python script /media/nebelhom/extHDD/virt_folder/MyFolder/bin/python (you must use /media/nebelhom/extHDD/virt_folder/MyFolder/bin/python2.7)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2332, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 924, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1369, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 17] File exists

And now I am stuck :/ . Has anyone of you tried something like this before and succeeded? I am really out of ideas here...

I tried to search for a solution previously, but for this particular problem I did not find anything useful. I will carry on looking and post any link that I can find that might be remotely related.

Thanks in advance for any help you can offer. It is much appreciated.

Nebelhom
  • 3,783
  • 4
  • 21
  • 22

2 Answers2

2

I think its happening because of filesystem on your external HDD. From your question I can guess that you use your external hard disk with both windows and linux, and its file system might be NTFS.

File permissions don't exist on NTFS and all the usual linux things like chown and chmod, that can be the reason why you are having these problems.

I would suggest, that you try to create a new partition on your ext HDD using a linux based filesystem like ext4. Then try to create a virtual environment.

I have tried creating python virtual environment on a removable disk, worked like a charm, only the FS was ext4.

abhishek_M
  • 1,110
  • 11
  • 19
  • Hi abishek_M, in this case I will most buy a small external harddrive for ubuntu like files only. I am not in need of too much space (a couple of gig). I do not feel comfortable using GParted on the external hard drive. Too many bad experiences ;) Thanks a lot for your effort though. I will check if it works with this one once I have it and then accept your answer if it works. Thanks! – Nebelhom Aug 11 '16 at 17:18
  • All the best! , let me know if you face any issues :) – abhishek_M Aug 11 '16 at 18:27
  • @abishek_M Got myself a cheap extHDD and it worked as you said. Thx! – Nebelhom Aug 12 '16 at 20:04
  • @Nebelhom Cool ! Glad I could help :) – abhishek_M Aug 12 '16 at 20:11
0

Seems like Python is having trouble with permission on that folder.

Try giving root permission on the folder using this command:

sudo chown root:root -R /media/nebelhom/extHDD/virt_folder/MyFolder

Then run this command to create the virtualenv:

sudo virtualenv /media/nebelhom/extHDD/virt_folder/MyFolder
DoubleOZ
  • 128
  • 11
  • Hi, I tried your approach, but unfortunately it does not work :( Still getting the same permission denied Errno13. Thanks a lot though for making the effort. – Nebelhom Aug 11 '16 at 17:16