20

I'm trying to offline update xlwings in Anaconda / conda.

From https://pypi.python.org/pypi/xlwings, I downloaded the most recent package, and put it into "C:\Program Files\Anaconda2\pkgs"

From Cmd, I've tried a number of different combinations, but I can't seem to get it to update the package... For example:

1) conda install xlwings --offline
2) conda install xlwings --offline xlwings-0.10.2.tar.gz
3) conda update xlwings --offline
4) conda update xlwings --offline xlwings-0.10.2.tar.gz

Attempts 2 & 4 (I've tried using the full directory for these as well) result in unrecognized command.

Attempts 1 & 3 results in: enter image description here

Anirban Saha
  • 1,350
  • 2
  • 10
  • 38
keynesiancross
  • 3,441
  • 15
  • 47
  • 87
  • 1
    You should try using pip install instead of conda install as it is a pip package and not a conda package. – maggie Jan 11 '17 at 06:40
  • Check https://pip.pypa.io/en/latest/reference/pip_install/#id44 point 7 for details. – maggie Jan 11 '17 at 06:45
  • 1
    For usage of conda you should get the conda package from the official channel. – maggie Jan 11 '17 at 06:49
  • Please do not post terminal output in images. See here: https://unix.meta.stackexchange.com/questions/4086/psa-please-dont-post-images-of-text for why – darthbith Apr 11 '18 at 12:53

4 Answers4

29

First download the rellevant package-name.tar.bz2 file, (from anaconda repository)

Open command prompt, cd to apropiate directory and type

conda install package-name.tar.bz2

This should work.

h3h325
  • 751
  • 1
  • 9
  • 19
9

From my experience the process is:

  1. on a computer that is connected to the internet install the relevant packages.
  2. copy the relevant tar.bz2 files form the ~/anaconda3/pkgs folder
  3. in the offline computer run conda update name_of_packge.tar.bz2 --offline .

you may want to run conda index on the pkgs folder

update
Another option is to use conda pack. This allows to transfer entire environments from online to offline.

skibee
  • 1,279
  • 1
  • 17
  • 37
  • Hello I've successfully installed Wordcloud using this method. But once I import it, I got this error. `ModuleNotFoundError: No module named 'wordcloud.query_integral_image'` Integrale error generated is [here](https://www.codepile.net/pile/WAW8aEOm) – abdoulsn Sep 13 '19 at 08:27
  • I don't see `tar.bz2` files in tehe `pkgs` folder or subdirectories – user3731622 Nov 17 '20 at 20:13
  • Do you see any tar.bz2? If not what OS are you running? Try and search from the parent Anaconda folder – skibee Nov 17 '20 at 20:19
6

If you want to update/install a conda package you'll need to download the corresponding conda package (you downloaded the pip package) into your pkgs directory.

conda install xlwings --use-index-cache

Was working for me in the past. But the channel's index cache should have been updated at least once. It is possible that you still need the --offline flag but I've never used it. But you have to check the dependencies of the packages to be installed by yourself which can be pretty time consuming as you have to download all other packages manually.

You can find the conda packages in the channel you are using (https://repo.continuum.io/pkgs/free/win-32/ in my case).

If you want to install a pip package offline just use

pip install package.tar.gz

pip also comes with your anaconda distribution. If you are using conda environments, pip will be on the path of your current environment.

Mefitico
  • 816
  • 1
  • 12
  • 41
maggie
  • 3,935
  • 3
  • 27
  • 31
1

You should use a combination of both answers.

conda install opencv --use-index-cache

to let conda check for dependencies and compatibility issues.

But keep using conda (not pip) for the installation (if you don´t have serious reasons not to stay in the initial framework) [wasn´t the reason using conda as package manager because pip couldn't´t provide you those opportunities and flexibility?]

conda install opencv-3.3.0-py36_200.tar.bz2
InLaw
  • 2,537
  • 2
  • 21
  • 33
  • 1
    I just tried this by installing a package I downloaded - using this method doesn't install the dependencies along with the package. Even if you're online, but the channel the package comes from is offline, the `.tar.bz2` file doesn't contain the dependency metadata – cbcoutinho Mar 26 '18 at 13:11
  • What OS do you use? What about `conda install opencv --dry-run` and when you are offline `conda install opencv` – InLaw Mar 27 '18 at 08:54
  • The problem was the fact that I was offline of a private channel - conda error'd out to avoid upgrading the package using the wrong channel. This is apparently not a bug – cbcoutinho Mar 28 '18 at 00:32