pip2pi
pip2pi copied to clipboard
dir2pi on Windows: OSError symbolic link privilege not held
Running dir2pi (or pip2pi) on Windows results in a OSError: symbolic link priviledge not held.
Steps to reproduce:
D:\>mkdir LocalPyPi
D:\>pip2pi .\LocalPyPi pytest
You are using pip version 6.1.1, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pytest
Downloading pytest-2.8.1-py2.py3-none-any.whl (148kB)
100% |################################| 151kB 1.7MB/s
Saved d:\localpypi\pytest-2.8.1-py2.py3-none-any.whl
Collecting py>=1.4.29 (from pytest)
Downloading py-1.4.30-py2.py3-none-any.whl (81kB)
100% |################################| 86kB 1.1MB/s
Saved d:\localpypi\py-1.4.30-py2.py3-none-any.whl
Collecting colorama (from pytest)
Downloading colorama-0.3.3.tar.gz
Saved d:\localpypi\colorama-0.3.3.tar.gz
Successfully downloaded pytest py colorama
Done. 3 new archives currently saved in 'D:\\LocalPyPi'.
Traceback (most recent call last):
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\Scripts\pip2pi.exe\__main__.py", line 9, in <module>
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\site-packages\libpip2pi\commands.py", line 510, in pip2pi
res = _dir2pi(option, subcmd_argv)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\site-packages\libpip2pi\commands.py", line 305, in _dir2pi
os.symlink(symlink_source, symlink_target)
OSError: symbolic link privilege not held
Running dir2pi:
D:\>dir2pi .\LocalPyPi
Traceback (most recent call last):
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\Scripts\dir2pi.exe\__main__.py", line 9, in <module>
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\site-packages\libpip2pi\commands.py", line 268, in dir2pi
return _dir2pi(option, argv)
File "D:\WinPython\WinPython-32bit-3.4.3.3\python-3.4.3\lib\site-packages\libpip2pi\commands.py", line 305, in _dir2pi
os.symlink(symlink_source, symlink_target)
OSError: symbolic link privilege not held
My quick-fix solution to this problem would be to add a note to the readme that on windows the -S, --no-symlink option must be used. I just found out that this works without any errors.
Ah interesting… right now I'm checking to see whether the host supports symlinks using hasattr(os, "symlink"), but I guess newer versions of windows do partially support it?
I'd be happy to fix that behavior if there's a better way of detecting whether symlinks are supported.
The symlinks where created when runinng dir2pi on Win10 with admin privileges. The main problem for me is that when using the package index in offline mode the symlinks don't seem to work with pip (again, on Win10), so I had to run it with -S.
use admin on windows platform