473,508 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

module error in Vista -- works as administrator

First, I'm new to Python. I'm getting and error when I run Python
2.5.2 as a regular user in Vista but not when I run Python as an
administrator.

For example, if I type "import numpy" after I launch python from an
adminstrator-privileged command window it loads fine. However, from a
regular-user command window I get:
>>import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy

Thanks in advance for your help.

Reg
Jun 27 '08 #1
5 1958
sawilla wrote:
First, I'm new to Python. I'm getting and error when I run Python
2.5.2 as a regular user in Vista but not when I run Python as an
administrator.

For example, if I type "import numpy" after I launch python from an
adminstrator-privileged command window it loads fine. However, from a
regular-user command window I get:
>>>import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
Log on as administrator, start python in command window and do this:

import sys
sys.path # shows where python is looking for importables
import numpy
import os.path
print os.path.abspath(numpy.__file__) # shows where it found numpy

Log on as ordinary user, start python in command window and do this:

import sys
sys.path
# check how this is different from the admin's sys.path

If you can't see what to do after that, come back here with the output
from those steps.

HTH,
John
Jun 27 '08 #2
On Apr 21, 5:42 pm, John Machin <sjmac...@lexicon.netwrote:
Log on as administrator, start python in command window and do this:

import sys
sys.path # shows where python is looking for importables
import numpy
import os.path
print os.path.abspath(numpy.__file__) # shows where it found numpy

Log on as ordinary user, start python in command window and do this:

import sys
sys.path
# check how this is different from the admin's sys.path

If you can't see what to do after that, come back here with the output
from those steps.

HTH,
John
That was a great help, thank you. I now see what is causing the
problem but I don't know how to fix it. I used easy_install to install
several packages. When I run Python from an administrator command
window all of the directories in C:\Program Files\Python25\Lib\site-
packages\easy-install.pth are added to the sys.path. When I run it as
a regular user, those directories are not added to the sys.path and so
Python can't find the modules.

I know how to manually add those directories to Python's search path
but then I'll need to update the path every time I install something.
How do I get Python to automatically load the easy-install.pth file
for the regular user account?

Reg
Jun 27 '08 #3
sawilla wrote:
On Apr 21, 5:42 pm, John Machin <sjmac...@lexicon.netwrote:
>Log on as administrator, start python in command window and do this:

import sys
sys.path # shows where python is looking for importables
import numpy
import os.path
print os.path.abspath(numpy.__file__) # shows where it found numpy

Log on as ordinary user, start python in command window and do this:

import sys
sys.path
# check how this is different from the admin's sys.path

If you can't see what to do after that, come back here with the output
from those steps.

HTH,
John

That was a great help, thank you. I now see what is causing the
problem but I don't know how to fix it. I used easy_install to install
several packages. When I run Python from an administrator command
window all of the directories in C:\Program Files\Python25\Lib\site-
packages\easy-install.pth are added to the sys.path. When I run it as
a regular user, those directories are not added to the sys.path and so
Python can't find the modules.

I know how to manually add those directories to Python's search path
but then I'll need to update the path every time I install something.
How do I get Python to automatically load the easy-install.pth file
for the regular user account?

Reg
"""
If you can't see what to do after that, come back here with the output
from those steps.
"""
in particular what is in sys.path for the non-admin user.
Also what are the access rights to the easy-install.pth file?

Jun 27 '08 #4
The access writes to easy-install.pth for regular users is read and
execute.

The output of sys.path for regular users is:
['', 'C:\\Program Files\\Python25\\lib\\site-packages\
\setuptools-0.6c8-py2.5.eg
g', 'C:\\Program Files\\Python25\\python25.zip', 'C:\\Program Files\
\Python25\\D
LLs', 'C:\\Program Files\\Python25\\lib', 'C:\\Program Files\\Python25\
\lib\\pla
t-win', 'C:\\Program Files\\Python25\\lib\\lib-tk', 'C:\\Program Files\
\Python25
', 'C:\\Program Files\\Python25\\lib\\site-packages']

The output of sys.path for the admin user is:
['', 'C:\\Program Files\\Python25\\lib\\site-packages\
\setuptools-0.6c8-py2.5.eg
g', 'C:\\Program Files\\Python25\\lib\\site-packages\\networkx-0.36-
py2.5.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\numpy-1.0.4-py2.5-
win32.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\scipy-0.6.0-py2.5-
win32.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\matplotlib-0.91.2-
py2.5-win32.
egg', 'C:\\Program Files\\Python25\\lib\\site-packages\\dot2tex-2.7.0-
py2.5.egg'
, 'C:\\Program Files\\Python25\\lib\\site-packages\\pydot-1.0.2-
py2.5.egg', 'C:\
\Program Files\\Python25\\lib\\site-packages\\pyparsing-1.4.11-py2.5-
win32.egg',
'C:\\Program Files\\Python25\\python25.zip', 'C:\\Program Files\
\Python25\\DLLs
', 'C:\\Program Files\\Python25\\lib', 'C:\\Program Files\\Python25\
\lib\\plat-w
in', 'C:\\Program Files\\Python25\\lib\\lib-tk', 'C:\\Program Files\
\Python25',
'C:\\Program Files\\Python25\\lib\\site-packages']

The contents of easy-install.pth are:
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c8-py2.5.egg
./networkx-0.36-py2.5.egg
./numpy-1.0.4-py2.5-win32.egg
./scipy-0.6.0-py2.5-win32.egg
./matplotlib-0.91.2-py2.5-win32.egg
./dot2tex-2.7.0-py2.5.egg
./pydot-1.0.2-py2.5.egg
./pyparsing-1.4.11-py2.5-win32.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];
p=getattr(sys,
'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

The location where numpy is found:
>>print os.path.abspath(numpy.__file__)
C:\Program Files\Python25\lib\site-packages\numpy-1.0.4-py2.5-win32.egg
\numpy\__
init__.pyc

So I believe I need to have the easy-install.pth file executed
automatically for regular users but I don't know how to do this.

Reg


On Apr 21, 7:29*pm, John Machin <sjmac...@lexicon.netwrote:
sawillawrote:
On Apr 21, 5:42 pm, John Machin <sjmac...@lexicon.netwrote:
Log on as administrator, start python in command window and do this:
import sys
sys.path # shows where python is looking for importables
import numpy
import os.path
print os.path.abspath(numpy.__file__) # shows where it found numpy
Log on as ordinary user, start python in command window and do this:
import sys
sys.path
# check how this is different from the admin's sys.path
If you can't see what to do after that, come back here with the output
from those steps.
HTH,
John
That was a great help, thank you. I now see what is causing the
problem but I don't know how to fix it. I used easy_install to install
several packages. When I run Python from an administrator command
window all of the directories in C:\Program Files\Python25\Lib\site-
packages\easy-install.pth are added to the sys.path. When I run it as
a regular user, those directories are not added to the sys.path and so
Python can't find the modules.
I know how to manually add those directories to Python's search path
but then I'll need to update the path every time I install something.
How do I get Python to automatically load the easy-install.pth file
for the regular user account?
Reg

"""
If you can't see what to do after that, come back here with the output
from those steps.
"""
in particular what is in sys.path for the non-admin user.
Also what are the access rights to the easy-install.pth file?- Hide quotedtext -

- Show quoted text -
Jun 27 '08 #5
I've discovered the cause of the problem. At some point previously,
Windows Vista had created a copy of the site-packages directory in a
virtual store for the user account. The easy-install.pth file in the
virtual store did not contain the same path information as the easy-
install.pth that the administrator account sees. I deleted the user's
Python25 directory in the virtual store and now the user's sys.path
contains all of the necessary paths.

Reg

On Apr 25, 12:04*pm, sawilla <sawi...@gmail.comwrote:
The access writes to easy-install.pth for regular users is read and
execute.

The output of sys.path for regular users is:
['', 'C:\\Program Files\\Python25\\lib\\site-packages\
\setuptools-0.6c8-py2.5.eg
g', 'C:\\Program Files\\Python25\\python25.zip', 'C:\\Program Files\
\Python25\\D
LLs', 'C:\\Program Files\\Python25\\lib', 'C:\\Program Files\\Python25\
\lib\\pla
t-win', 'C:\\Program Files\\Python25\\lib\\lib-tk', 'C:\\Program Files\
\Python25
', 'C:\\Program Files\\Python25\\lib\\site-packages']

The output of sys.path for the admin user is:
['', 'C:\\Program Files\\Python25\\lib\\site-packages\
\setuptools-0.6c8-py2.5.eg
g', 'C:\\Program Files\\Python25\\lib\\site-packages\\networkx-0.36-
py2.5.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\numpy-1.0.4-py2.5-
win32.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\scipy-0.6.0-py2.5-
win32.egg',
'C:\\Program Files\\Python25\\lib\\site-packages\\matplotlib-0.91.2-
py2.5-win32.
egg', 'C:\\Program Files\\Python25\\lib\\site-packages\\dot2tex-2.7.0-
py2.5.egg'
, 'C:\\Program Files\\Python25\\lib\\site-packages\\pydot-1.0.2-
py2.5.egg', 'C:\
\Program Files\\Python25\\lib\\site-packages\\pyparsing-1.4.11-py2.5-
win32.egg',
*'C:\\Program Files\\Python25\\python25.zip', 'C:\\Program Files\
\Python25\\DLLs
', 'C:\\Program Files\\Python25\\lib', 'C:\\Program Files\\Python25\
\lib\\plat-w
in', 'C:\\Program Files\\Python25\\lib\\lib-tk', 'C:\\Program Files\
\Python25',
'C:\\Program Files\\Python25\\lib\\site-packages']

The contents of easy-install.pth are:
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c8-py2.5.egg
./networkx-0.36-py2.5.egg
./numpy-1.0.4-py2.5-win32.egg
./scipy-0.6.0-py2.5-win32.egg
./matplotlib-0.91.2-py2.5-win32.egg
./dot2tex-2.7.0-py2.5.egg
./pydot-1.0.2-py2.5.egg
./pyparsing-1.4.11-py2.5-win32.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];
p=getattr(sys,
'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

The location where numpy is found:>>print os.path.abspath(numpy.__file__)

C:\Program Files\Python25\lib\site-packages\numpy-1.0.4-py2.5-win32.egg
\numpy\__
init__.pyc

So I believe I need to have the easy-install.pth file executed
automatically for regular users but I don't know how to do this.

Reg

On Apr 21, 7:29*pm, John Machin <sjmac...@lexicon.netwrote:
sawillawrote:
On Apr 21, 5:42 pm, John Machin <sjmac...@lexicon.netwrote:
>Log on as administrator, start python in command window and do this:
>import sys
>sys.path # shows where python is looking for importables
>import numpy
>import os.path
>print os.path.abspath(numpy.__file__) # shows where it found numpy
>Log on as ordinary user, start python in command window and do this:
>import sys
>sys.path
># check how this is different from the admin's sys.path
>If you can't see what to do after that, come back here with the output
>from those steps.
>HTH,
>John
That was a great help, thank you. I now see what is causing the
problem but I don't know how to fix it. I used easy_install to install
several packages. When I run Python from an administrator command
window all of the directories in C:\Program Files\Python25\Lib\site-
packages\easy-install.pth are added to the sys.path. When I run it as
a regular user, those directories are not added to the sys.path and so
Python can't find the modules.
I know how to manually add those directories to Python's search path
but then I'll need to update the path every time I install something.
How do I get Python to automatically load the easy-install.pth file
for the regular user account?
Reg
"""
If you can't see what to do after that, come back here with the output
from those steps.
"""
in particular what is in sys.path for the non-admin user.
Also what are the access rights to the easy-install.pth file?- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3052
by: fredfrog22 | last post by:
The following is an extract from a C# console application that creates a Virtual Directory on IIS 5 or 6. This code works on XP, Windows 2003 Server, Windows 2000. It does not work on Windows...
37
3692
by: Allen Browne | last post by:
If you develop for others, you probably have multiple versions of Access installed so you can edit and create MDEs for clients in different versions. This works fine under Windows XP, even with...
6
4482
by: theintrepidfox | last post by:
Dear Group I've installed MSSQL 2005 STD on Vista and now can't attach my databases. I've installed SQL SP2 and the SQL Vista Beta Update. The error I'm getting is: Unable to open the...
11
20175
by: Don | last post by:
QUESTIONS: 1. Has anyone figured out how to successfully install the Office 97 Pro Service Release 2 patch in Vista? 2. Has anyone successfully installed an Office 97 Pro CD (SR2 version) in...
2
1989
by: JamesB | last post by:
Hi all. I have a Winforms app that installs a service programatically (as opposed to using InstallUtil). If UAC on Vista is disabled, it works fine. Likewise, if the program is started by...
6
5730
by: globalrev | last post by:
type "python setup.py install" that is used in most "addons" for python. well using windows vista, where the h*** am i supposed to type this? if it is not doable in windows, what do i have...
11
1903
by: idoublepress | last post by:
Hi all, I've been struggling with an issue that I hope you can comment on or provide suggestions to. Our .NET 2.0 (VS2005) based product is crashing (when the user selects a particular feature on...
14
3793
by: Trent Mick | last post by:
I'm happy to announce that ActivePython 2.6.0.0 is now available for download from: http://www.activestate.com/Products/activepython/ ActivePython 2.6.0.0 is based on Python 2.6.0. What is...
1
3477
by: mazdotnet | last post by:
Hi all, I've installed the new Microsoft URL Rewrite Module for IIS 7.0 http://www.iis.net/downloads/default.aspx?tabid=34&i=1691&g=6 on both my laptop (Vista Home Premium) and my desktop...
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.