Unable to import package over NFS in solaris

Jeff McNeil jeff at jmcneil.net
Wed Sep 23 18:49:10 CEST 2009

On Sep 23, 12:15 pm, Ashok <asho... at gmail.com> wrote:
> Hi,
> I have sqlalchemy package installed on the server. However I want to
> run a script on the client that uses the sqlalchemy package. Hence I
> shared the directory containing the sqlalchemy unsing NFS. Then I
> added the NFS pathname to the sqlalchemy packege in the client
> program. Now when I import sqlalchemy in the client program it throws
> the following error.
> Traceback (most recent call last):
>   File "/net/sqlhost/ashok/send.py", line 9, in ?
>     from sqlalchemy import *
> ImportError: No module named sqlalchemy
> I have added the NFS path to the PYTHONPATH as folllows in my program.
> #!/usr/bin/python
> import os,commands,sys
> os.environ['PYTHONPATH']='/net/sqlhost/usr/lib/python2.4/site-packages/
> SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy'
> sys.path.append('/net/sqlhost/usr/lib/python2.4/site-packages/
> SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy')
> from sqlalchemy import *
> Contents of the directory shared under NFS in Solaris.
> bash-3.00# ls /usr/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
> py2.4.egg/sqlalchemy/
> __init__.py      engine           ext              log.py
> pool.py          queue.pyc        sql              topological.pyc
> util.py
> __init__.pyc     exc.py           interfaces.py    log.pyc
> pool.pyc         schema.py        test             types.py
> util.pyc
> databases        exc.pyc          interfaces.pyc   orm
> queue.py         schema.pyc       topological.py   types.pyc
> Please let me know what went wrong?
> thx,
> ~Ashok.

You don't need the additional 'sqlalchemy' after the '/net/sqlhost/usr/
SQLAlchemy-0.5.6-py2.4.egg/' path.  Using your configuration, Python
is looking for:


As an example, see below.  Note that this is in a virtual environment
that is not part of sys.path by default (I didn't run bin/activate).

[jeff at marvin ~]$ export PYTHONPATH=/home/jeff/Work/hostapi/lib/
[jeff at marvin ~]$ python -c 'import sqlalchemy'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sqlalchemy
[jeff at marvin ~]$ export PYTHONPATH=/home/jeff/Work/hostapi/lib/
[jeff at marvin ~]$ python -c 'import sqlalchemy'
[jeff at marvin ~]$



More information about the Python-list mailing list