Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to create a python source package, but it fails when creating hard links for files.

$ python setup.py sdist

running sdist
running check
reading manifest template 'MANIFEST.in'
writing manifest file 'MANIFEST'
making hard links in foo-0.1...
hard linking README.txt -> foo-0.1
error: Operation not permitted

I've tried running the command with sudo, but it produces the same error.

This also produces the same error:

ln foo bar

I'm using vbox to run a virtual instance of ubuntu, which is probably where the problem comes from. Is there a way round using hard links when creating source distributions?

System information:

Ubuntu server 11.04; VirtualBox 4.14; osx 10.6.6; python 2.7.1;

share|improve this question
    
what OS / python version are you using? –  Foo Bah Oct 10 '11 at 22:48
    
I'm running Ubuntu server 11.04. Python 2.7.1 –  rlayte Oct 10 '11 at 22:53
    
I had the same thing happen on a Mac, while trying to build a python project being accessed through a samba shared folder. –  Christian Oudard Nov 14 '12 at 3:33

4 Answers 4

up vote 4 down vote accepted

It is unclear from your question what step is failing. Might be the hard linking right before the error. You can try strace to see what system call is failing. That should give a better picture of the problem at least.

This python bug report looks like they're not going to fix this until distutils2. Someone did supply a patch that might be useful to you. You might also be able to mount a directory over NFS and build there. I believe that NFS allows hard linking.

share|improve this answer
    
I've added the output from the final call to the post. –  rlayte Oct 10 '11 at 23:24
    
What kind of filesystem are you running this on? It might not support hard links. –  Kurt Stutsman Oct 10 '11 at 23:49
    
That seems to be it. If I run ln foo bar I get the same error. Is there a way round this? I'm running ubuntu through vbox on an osx host so I assume it has something to do with not being able to create hard links on a virtual drive. –  rlayte Oct 11 '11 at 10:15
    
I found this python bug report that looks like they're not going to fix this until distutils2. Someone did supply a patch that might be useful to you. You might also be able to mount a directory over NFS and build there. I believe that NFS allows hard linking. –  Kurt Stutsman Oct 11 '11 at 12:21
    
Doesn't work using NFS mounting in Vbox for me, at least. –  Cody A. Ray Nov 4 '13 at 15:11

I ran into the same issues. I was able to get it working by moving the python sources from the virtual box shared folder to my debian home folder. No error on sdist anymore.

I hope it helps.

share|improve this answer
1  
This worked for me - you can't create hard links on some mounted volumes, I guess. –  Mark Theunissen May 15 '12 at 22:13
    
This also worked for me. Thanks a lot. –  Louis Aug 21 '12 at 20:41
    
It's due to this issue: virtualbox.org/ticket/10085 –  Mark Birbeck Feb 20 '13 at 16:54

Same issue. I am using vagrant, my host OS is Windows while the Gust OS is Ubuntu. I am not a vim fan, so @simo's answer does not help me much because I really rely on virtual box shared folders to sync changes made by sublime editor to the Ubuntu virtual machine.

Thanks to Fabian Kochem, he found a quick and dirty workaround: post

# if you are not using vagrant, just delete os.link directly,
# The hard link only saves a little disk space, so you should not care
if os.environ.get('USER','') == 'vagrant':
    del os.link
share|improve this answer

Same here, more information on these links,

https://www.virtualbox.org/ticket/818

http://bugs.python.org/issue8876

Finally got it working using @Leonardo.Z work-around. Thanks!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.