libnfs installation error

229 views
Skip to first unread message

Suchitra P

unread,
Apr 16, 2021, 9:34:28 AM4/16/21
to libnfs
Hi ,
I am very new to Python . I wanted to use libnfs module to access a nfs volume and perform operations.I directly downloaded libnfs tar and put it in /usr/lib64/python2.7/site-packages location since pip install was giving error .Now when I run the below code

//code
import libnfs 
nfs = libnfs.NFS('nfs://host-ip/nfsmnt') 
a = nfs.open('/foo-test', mode='w+') a.write("Test string") a.close() 
print nfs.open('/foo-test', mode='r').read()

//I get 

File "sample.py", line 1, in <module>
import libnfs File "/usr/lib64/python2.7/site-packages/libnfs/__init__.py", line 19, in <module> 
from .libnfs import * File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 28, in <module> 
_libnfs = swig_import_helper() File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 20, in swig_import_helper import _libnfs 
ImportError: No module named _libnfs.

I serioulsy dont know how to proceed.Please let me know how can I solve this issue.

Thanks ,
Suchitra

ronnie sahlberg

unread,
Apr 20, 2021, 2:47:23 AM4/20/21
to lib...@googlegroups.com
On Fri, Apr 16, 2021 at 11:34 PM Suchitra P <susiq...@gmail.com> wrote:
>
> Hi ,
> I am very new to Python . I wanted to use libnfs module to access a nfs volume and perform operations.I directly downloaded libnfs tar and put it in /usr/lib64/python2.7/site-packages location since pip install was giving error .Now when I run the below code

You can't just untar the package into site-packages. You have to build
both libnfs itself as well as the swig wrapper and then install it.

The process to do that is basically:
This module depends on and provides bindings for libnfs, a userspace NFS
library hosted at https://github.com/sahlberg/libnfs

Before you can build this module you must first install the latest version
of libnfs.

Building and installing
=======================
cd libnfs
make
cd ..
sudo python setup.py install




>
> //code
> import libnfs
> nfs = libnfs.NFS('nfs://host-ip/nfsmnt')
> a = nfs.open('/foo-test', mode='w+') a.write("Test string") a.close()
> print nfs.open('/foo-test', mode='r').read()
>
> //I get
>
> File "sample.py", line 1, in <module>
> import libnfs File "/usr/lib64/python2.7/site-packages/libnfs/__init__.py", line 19, in <module>
> from .libnfs import * File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 28, in <module>
> _libnfs = swig_import_helper() File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 20, in swig_import_helper import _libnfs
> ImportError: No module named _libnfs.
>
> I serioulsy dont know how to proceed.Please let me know how can I solve this issue.
>
> Thanks ,
> Suchitra
>
> --
> You received this message because you are subscribed to the Google Groups "libnfs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to libnfs+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/libnfs/df3421ac-5a4d-4307-b95f-586c5c7f628fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages