installing openpyxl on windows without admin rights

1,368 views
Skip to first unread message

Alex M

unread,
Sep 9, 2015, 8:59:10 AM9/9/15
to openpyxl-users
Hello,

I`m attempting to install openpyxl on a machine where I do not have open user rights.
I can only use one folder (c:\Localdata) so the installer fails to create the required folder.


copying openpyxl\workbook\names\__init__.py -> build\lib\openpyxl\workbook\names

copying openpyxl\.constants.json -> build\lib\openpyxl
creating C:\Program Files (x86)\python27\Lib\site-packages\openpyxl
error: could not create 'C:\Program Files (x86)\python27\Lib\site-packages\openp
yxl': Access is denied

So... my question is : can I just copy the files from \lib\  and continue installation manually ?

Charlie Clark

unread,
Sep 9, 2015, 9:12:14 AM9/9/15
to openpyx...@googlegroups.com
Am .09.2015, 14:59 Uhr, schrieb Alex M <a.m...@gmail.com>:

> So... my question is : can I just copy the files from \lib\ and continue
> installation manually ?

The best solution is to create a virtual environment that will let you
install whatever you want. You may need admin permissions to install the
necessary infrastructure to do this.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Adam Morris

unread,
Sep 9, 2015, 9:13:39 AM9/9/15
to openpyxl-users
In python you can create a local site-package folder, and install there. Try:


# 1. Open the cmd prompt, and create a local package directory
mkdir c
:\Localdata\local-packages

# 2. Install to new location
pip install
--target c:\Localdata\local-packages openpyxl

#3. Add c:\Localdata\local-packages to your PYTHONPATH env
SET PYTHONPATH
=%PYTHONPATH%;c:\Localdata\local-packages

Alex Motiu

unread,
Sep 9, 2015, 9:53:46 AM9/9/15
to openpyx...@googlegroups.com
Thank you Adam, sounds like a good plan.
Only thing is that installing PIP also requires me to have admin rights:

Microsoft Windows [Version 6.1.7601]
  File "C:\Program Files (x86)\python27\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 5] Access is denied: 'C:\\Program Files (x86)\\python27\\Lib\\site-packages\\pip'


Any other suggestions ?
I also tried the regular installer with --target, no luck so far:

C:\Localdata\QPR\openpyxl-2.3.0-b2>setup.py install --install-dir
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --install-dir not recognized

C:\Localdata\QPR\openpyxl-2.3.0-b2>setup.py install --target C:\Localdata\QPR\lib\openpyxl
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --target not recognized


Alex


--
You received this message because you are subscribed to a topic in the Google Groups "openpyxl-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpyxl-users/zSB4vyobIIA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpyxl-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Charlie Clark

unread,
Sep 9, 2015, 10:32:51 AM9/9/15
to openpyx...@googlegroups.com
Am .09.2015, 15:53 Uhr, schrieb Alex Motiu <a.m...@gmail.com>:

> Thank you Adam, sounds like a good plan.
> Only thing is that installing PIP also requires me to have admin rights:

pip should now be part of Python 2.7.10

Otherwise you can probably manually setup a virtualenv, but this is likely
to be tricky.

Adam Morris

unread,
Sep 9, 2015, 12:04:24 PM9/9/15
to openpyxl-users
For setup.py, I think the flag you want is --prefix.

Try:

setup.py install --prefix=C:\Localdata\QPR\lib\openpyxl

Adam Morris

unread,
Sep 9, 2015, 12:11:37 PM9/9/15
to openpyxl-users
Note - this will install to c:\LocalData\QPR\lib\openpyxl\Lib\site-packages, which would need to be added to your PYTHONPATH.  I think what you want is:

set PYTHONPATH=%PYTHONPATH%;C:\Localdata\QPR\Lib\site-packages
setup
.py install --prefix=C:\Localdata\QPR

Alex Motiu

unread,
Sep 15, 2015, 5:35:15 AM9/15/15
to openpyx...@googlegroups.com
IT WORKED !Thank you !

I installed in %appdata%, but I did have to make some extra folders due to the setup.py file.

C:\Localdata\QPR\openpyxl-2.3.0-b2>set PYTHONPATH=%PYTHONPATH% ; %appdata%\Python\Python27\site-packages\lib\site-packages
C:\Localdata\QPR\openpyxl-2.3.0-b2>python setup.py install --prefix=%appdata%\Python\Python27\site-packages\lib\site-packages

The last two (\lib\site-packages) are "extra".

Alex

Charlie Clark

unread,
Sep 15, 2015, 5:51:20 AM9/15/15
to openpyx...@googlegroups.com
Am .09.2015, 11:34 Uhr, schrieb Alex Motiu <a.m...@gmail.com>:

> IT WORKED !Thank you !
> I installed in %appdata%, but I did have to make some extra folders due
> to
> the setup.py file.

Great that it worked. Could you write up exactly what you did so that we
can add it to the documentation?

Alex Motiu

unread,
Sep 15, 2015, 4:11:16 PM9/15/15
to openpyx...@googlegroups.com
1. add %appdata% to PYTHONPATH
C:\Localdata\openpyxl-2.3.0-b2set PYTHONPATH=%PYTHONPATH% ; %appdata%\Python\Python27\site-packages\lib\site-packages

2. attempt install in %appdata%
C:\Localdata\openpyxl-2.3.0-b2>python setup.py install --prefix=%appdata%\Python\Python27\site-packages
=> error due to missing subfolders in above address : \lib\site-packages

3. create subfolders \lib\site-packages\
new structure : %appdata%\Python\Python27\site-packages\lib\site-packages

4. re-attempt install => success !

NOTE: open a windows explorer and type %appdata% to find out your exact folder address

Reply all
Reply to author
Forward
0 new messages