0

Have a bit of an issue here. I haven't got admin access to my work computer (working on getting it) so I can't install packages. IT has given me a temporary Admin password but Admin doesn't have internet access.

So I have to download the library itself. I went to https://github.com/scikit-learn-contrib/imbalanced-learn.git and downloaded "imbalanced-learn-master.zip"

My question now is - how do I install this on my computer locally? I can "Run as Administrator" anything from the command prompt

  • 1
    Does this answer your question? [Python Packages Offline Installation](https://stackoverflow.com/questions/11091623/python-packages-offline-installation) – stud3nt Dec 23 '19 at 12:44
  • Just a comment since this is not answering directly to your question but you can install `miniconda` and then you can manage it a user level (still require internet) without the admin rights. Then whatever package can be installed with `conda install `. – glemaitre Dec 23 '19 at 13:50

2 Answers2

1

First. How You install packages. If from command line then you can use --user switch then command will look

pip install --user imbalanced-learn

Other option is to install from wheel file. So download: https://files.pythonhosted.org/packages/eb/aa/eba717a14df36f0b6f000ebfaf24c3189cd7987130f66cc3513efead8c2a/imbalanced_learn-0.6.1-py3-none-any.whl and then

pip install imbalanced_learn-0.6.1-py3-none-any.whl 

or without admin privileges

pip install --user imbalanced_learn-0.6.1-py3-none-any.whl 

Third option is to install from source (as you asked). You need to unpack zip file and in terminal go to main folder (with setup.py) and then

pip install . 

But you also need to install package dependencies. You can found them in setup.py For current master it is

INSTALL_REQUIRES = [
    'numpy>=1.11',
    'scipy>=0.17',
    'scikit-learn>=0.22',
    'joblib>=0.11'
]
Grzegorz Bokota
  • 1,736
  • 11
  • 19
  • I've been trying the "pip install ." and this is what I see: "Processing c:\temp\imbalanced-learn-master Requirement already satisfied numpy, requirement already satisfied scipy, collecting scikit-learn". Then it tries to connect to the internet and under admin there is no internet. So is my problem, I have an outdated scikit-learn and need to update that library prior to the imbalanced library? – RawlinsCross Dec 23 '19 at 13:18
  • Or you may not have installed it. Yo may download it from https://pypi.org/project/scikit-learn/#files – Grzegorz Bokota Dec 23 '19 at 13:28
  • just checked using "pip list" and returns skikit-learn 0.21.2 – RawlinsCross Dec 23 '19 at 13:32
  • So version is to low. – Grzegorz Bokota Dec 23 '19 at 13:33
  • Yes, you need to get scikit-learn 0.22. It is available on PyPI and conda-forge. – glemaitre Dec 23 '19 at 13:51
  • I'm getting an error when I try to locally install scikit-learn 0.22. "Building wheel for scikit-learn (setup.py) ... error ERROR: Complete output from command 'C:\Users\jhalfyard\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\JHALFY~1\\AppData\\Local\\Temp\\pip-req-build-986aaels\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\JHALFY~1\AppData\Local\Temp\pip-wheel-1lx202se' --py – RawlinsCross Dec 23 '19 at 13:56
  • ERROR: Partial import of sklearn during the build process. No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils – RawlinsCross Dec 23 '19 at 13:59
  • download proper wheel files from this webpage: https://pypi.org/project/scikit-learn/#files I thintk that it will be somenting like `scikit_learn-0.22-cp36-cp36m-win_amd64.whl` where cp36 means python 3.6 and you need to check whic version of python you use. If you ask such question do not try to build python package from source if wheel (*.whl) file is available. – Grzegorz Bokota Dec 23 '19 at 14:02
  • So I have a windows machine, and a 64-bit computer so I imagine i'd use the link but this link is not functioning https://files.pythonhosted.org/packages/9d/10/1dd2e3436e13402cc2b16c61b5f7407fb2e8057dcc18461db0d8e3523202/scikit_learn-0.22-cp37-cp37m-win_amd64.whl – RawlinsCross Dec 23 '19 at 14:19
  • The file is available and I am able to download the file. – glemaitre Dec 23 '19 at 14:46
  • Talk with your administrator to check network configuration. – Grzegorz Bokota Dec 23 '19 at 16:59
0

You need to use the pip (or any package installer) through your corporate proxy.

pip install package_name --proxy=http://corporate-proxy.company_website.com:8080
jackrider
  • 11
  • 5