6

I do not have admin rights on my work laptop. Have got python and pip installed on my machine, version numbers as below:

C:\Users\banand\AppData\Local\Programs\Python\Python36\Scripts>python --version
Python 3.6.1

C:\Users\banand\AppData\Local\Programs\Python\Python36\Scripts>pip --version
pip 9.0.1 from c:\users\banand\appdata\local\programs\python\python36\lib\site-packages (python 3.6)

I need a way to make use of various python modules available online. An example is - colorama

As per the instructions, I tried the below command without any success:

C:\Users\banand\AppData\Local\Programs\Python\Python36\Scripts>pip install colorama --user
Collecting colorama
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D431204F28>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/colorama/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D431204A58>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/colorama/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D431204780>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/colorama/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D431204BA8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/colorama/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D431204898>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/colorama/
  Could not find a version that satisfies the requirement colorama (from versions: )
No matching distribution found for colorama

I believe that this has something to do either with the fact that - a. I do not have admin rights, OR b. I am behind a firewall and hence some sort of block is being exercised

I want to find out the exact issue here and then answer the question - is there a way to circumvent around these limitation and have a repeatable method to install python modules.

Kindly note that I am in an corporate laptop and learning to Python out of interest, so I do not want to go ahead and request Admin rights nor want to get into any trouble because I tried to do something which was not supposed to be experimented on my laptop.

Any help is greatly appreciated.

Bharat Anand
  • 464
  • 1
  • 6
  • 14
  • 2
    Have you tried downloading the wheel (.whl) file listed on [the package download page](https://pypi.org/project/colorama/#files) and then `pip install -U colorama-0.3.9-py2.py3-none-any.whl --user`? From the logs you posted it looks like some kind of connectivity issue, perhaps caused by some Windows Firewall setting – metatoaster Jul 24 '18 at 05:07
  • @metatoaster, I have tried installing using the command line and also by downloading a zipped package file. I came across the wheel file today, have downloaded it but not yet tried, will try this later tonight and update – Bharat Anand Jul 24 '18 at 06:34
  • You may also need to see what other packages pip has collected; it is likely that getting your system administrator to approve `pip` or `python` as one of the applications permitted to access to Internet would be the most convenient outcome. – metatoaster Jul 24 '18 at 06:37
  • 1
    FYI, there is no reason for a `--user` install in your case. You already have a per-user installation in `%LocalAppData%`, which should have added its "Scripts" directory to `PATH`. `--user` installs use the *roaming* `%AppData%` directory instead, and the corresponding "Scripts" directory is not added to `PATH`. – Eryk Sun Jul 24 '18 at 07:20
  • 1
    You may want to take a course like this: https://www.codecademy.com/learn/learn-python It's free and all the python is done in a browser, it's a good place to start – sniperd Jul 24 '18 at 13:34
  • @sniperd, thanks for the suggestion. I have already done that part few months ago. Now I am venturing outside their structured environment and setting up an environment of my own where I can import other libraries and do more. Eventually I intend to learn and build some arcade-style games. I am now following programarcadegames.com and find it very interesting – Bharat Anand Jul 24 '18 at 23:42
  • @eryksun, among other things this was a missing piece. I have now added Scripts directory to the PATH. This was slowing me down with my experimentation. Thank you! – Bharat Anand Jul 24 '18 at 23:44
  • @metatoaster, wheel file worked. Yippee! I created separate folders for each of the modules (\colorama, \pygame, etc) in a local folder and downloaded respective wheel files in corresponding folders. Next, on the command prompt, navigated to the colorama folder and issued `pip install colorama` (thanks @eryksun suggesting the `PATH` fix). Magic happened! Now I am wondering how does the 'import colorama' pick up the modules/functions. Does it still need the wheel file or those modules have been updated into my python installation? – Bharat Anand Jul 24 '18 at 23:57
  • I think I have found the answer - I can see the colorama and pygames folders created under the C:\Users\banand\AppData\Local\Programs\Python\Python36\Lib\site-packages – Bharat Anand Jul 25 '18 at 00:01

3 Answers3

6

The post is 7 months old, but this can help others. This worked for me on Windows 10 Pro without admin privileges: python.exe -m pip install

Meziane
  • 1,586
  • 1
  • 12
  • 22
4
  1. Install Anaconda (Don't need admin rights) ->
  2. Open Spyder ->
  3. Goto Terminal and type ->
import sys

!{sys.executable} -m pip install pandas
Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
0

I tried right on Jupiter notebook and it worked perfectly:

code:

import sys

!{sys.executable} -m pip install xarray

sysmtem answer:

Collecting xarray
  Using cached https://files.pythonhosted.org/packages/10/6f/9aa15b1f9001593d51a0e417a8ad2127ef384d08129a0720b3599133c1ed/xarray-0.16.2-py3-none-any.whl
Requirement already satisfied: setuptools>=38.4 in c:\anaconda3\lib\site-packages (from xarray) (41.0.1)
Requirement already satisfied: numpy>=1.15 in c:\anaconda3\lib\site-packages (from xarray) (1.16.4)
Requirement already satisfied: pandas>=0.25 in c:\anaconda3\lib\site-packages (from xarray) (1.2.1)
Requirement already satisfied: pytz>=2017.3 in c:\anaconda3\lib\site-packages (from pandas>=0.25->xarray) (2019.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\anaconda3\lib\site-packages (from pandas>=0.25->xarray) (2.8.0)
Requirement already satisfied: six>=1.5 in c:\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas>=0.25->xarray) (1.12.0)
Installing collected packages: xarray
Successfully installed xarray-0.16.2
Mahyar Mottaghi Zadeh
  • 1,178
  • 6
  • 18
  • 31