473,750 Members | 2,527 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 1971
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...@lexic on.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...@lexic on.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\\netwo rkx-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\\matpl otlib-0.91.2-
py2.5-win32.
egg', 'C:\\Program Files\\Python25 \\lib\\site-packages\\dot2t ex-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\\pypar sing-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...@lexic on.netwrote:
sawillawrote:
On Apr 21, 5:42 pm, John Machin <sjmac...@lexic on.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\\netwo rkx-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\\matpl otlib-0.91.2-
py2.5-win32.
egg', 'C:\\Program Files\\Python25 \\lib\\site-packages\\dot2t ex-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\\pypar sing-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...@lexic on.netwrote:
sawillawrote:
On Apr 21, 5:42 pm, John Machin <sjmac...@lexic on.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
3078
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 Vista Release Candidate 1 (IIS 7). The below line pcProps.Value = strPath;
37
3742
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 Access 2007 installed. It does *not* work under Windows Vista Ultimate. After running Access 2007, when you open an earlier version of Access, no code works, because the references are fouled up. And Access 97 does not work at all. Access should...
6
4502
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 physical file <Path to MDF>. Operating system error 5: '''5(Error not found)'''. (Microsoft SQL Server, Error: 5120)
11
20224
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 Vista? DETAILS: My setup: Dell Inspiron notebook with Vista Business edition My CD: Office 97 Professional (Service Release 1) Upgrade
2
2002
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 right-clicking and picking "Run as Administrator" it works (if UAC is enabled), but neither option is ideal. I suppose really I want UAC to pop up it's "do you want to allow this to happen" box when my code does its thing. Can anyone point me in the...
6
5748
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 to do instead? just clicking the setup.py-file never works.
11
1927
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 the UI) on Vista. It works fine on XP. In a nutshell: - user makes a selection on the UI - System.Reflection.MethodInfo.Invoke() calls into one of our .NET library dlls - Inside the library dll, System.Activator.CreateInstance() is called
14
3807
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 ActivePython? ---------------------
1
3497
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 (Vista Ultimate). I'm running my sites on IIS instead of the ASP.NET server. If I call my site using http://localhost in the browser, it works fine. However, as soon as I run it from within Visual Studio 2008 in
0
9001
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8265
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6811
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4894
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2227
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.