combine icon indicating copy to clipboard operation
combine copied to clipboard

virtualenv venv OSError: [Errno 95] Operation not supported

Open gagarin42 opened this issue 7 years ago • 5 comments

After following the install instructions virtualenv venv on Ubuntu 16.04.4 leading to this issue:

"Running virtualenv with interpreter /usr/bin/python2
New python executable in /mnt/hgfs/VM_share/combine/venv/bin/python2
Also creating executable in /mnt/hgfs/VM_share/combine/venv/bin/python
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module>
    main()
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main
    symlink=options.symlink)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 942, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 1400, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 95] Operation not supported"

Problems of Python 2 and 3? Any help is greatly appreciated.

gagarin42 avatar Mar 23 '18 10:03 gagarin42

Here is my guess: your Ubuntu 16.04.4 is running in a VM. You are trying to set up the virtualenv into a shared folder. That shared folder is shared with a Windows VM, and the filesystem of that share does not support symlinks.

The fix would be: create your virtualenv within Ubuntu 16.04.4 not in /mnt/hgfs/VM_share, but somewhere else on the / filesystem (like /opt/ or ~/).

decidedlygray avatar May 23 '18 21:05 decidedlygray

@decidedlygray Oddly I have a very similar issue. I have mounted a myCloud drive to an Ubuntu 16.04 vm. This VM is actually sitting on top of a macOS (ie..host machine). The macOS is not sharing or accessing this mount point. I get the same error when I try to repo init on this mount. This is a 4TB cloud drive that I'd love to develop on. Thoughts?

johnsodd avatar Jul 09 '18 06:07 johnsodd

@johnsodd If it is that exact same error message, my first thought would be - the myCloud, for compatibility, probably came formatted as FAT or NTFS, neither of which support symlinks. Disk Utility on your mac, or the lsblk -f command in Ubuntu should be able to tell you the filesystem of the drive.

I would suggest taking everything you want to keep off of the myCloud drive, and reformatting it as ext4. If you also want macOS to read/write to the drive, there are some compatibility issues to consider first though. As far as I remember, macOS cannot read ext4 without additional software installed. So if you are going to want your mac to be able to use the drive, you'll want to do one of the following:

  1. Format the drive as HFS+, then install sudo apt install hfsprogs in Ubuntu so it can read/write to the HFS+ drive. I think the symlinks should work fine, but you'll want to test that. This link should help with the HFS+ reformat using the mac, it's old, but I don't think Disk Utility has changed much - http://osxdaily.com/2012/01/04/format-an-external-hard-drive-or-usb-flash-drive-for-mac-os-x/ and this link should help with the hfsprogs install in Ubuntu and mounting the drive: https://askubuntu.com/questions/332315/how-to-read-and-write-hfs-journaled-external-hdd-in-ubuntu-without-access-to-os
  2. Format the drive as ext4, then on your mac install something like extFS (cost is $40). There is also a FOSS package here that has similar capabilities. If you want to go the FOSS route, you'll want to install the latest release from that link, then look into installing the Ext package, details here

Dealer's choice on which way you want to go. Personally, I'd probably opt for option 1 personally because it's less complicated to set up, assuming symlinks work as expected.

decidedlygray avatar Jul 09 '18 15:07 decidedlygray

To use pipenv to manage Python virtual environments, which is also recommended by Python officially. Pipenv stores environmental files in user's home folder. This avoids the file system problems with shared folders.

alphacodinghub avatar Nov 03 '20 16:11 alphacodinghub

I created myproject folder manually in my HOME then ran sudo python3 -m venv myproject to create virtual env successfully

KirpaD avatar Sep 23 '22 05:09 KirpaD