user3451660
user3451660

Reputation: 477

Creating an offline package folder for Anaconda

I have updated the anaconda packages for the python program I was working on. I now want to install these new packages on computers that are offline.

I have generated a list of the installed packages using the following command:

>conda list -e > packagelist.txt

I want to be able to update the packages on the offline computers using something like this:

>conda install --file (location of 'packagelist') --channel file://(location of the folder where the packages are located)

So my question is: how do I easily make a folder, "pkgs", that contains all the package files indicated in my package list?

Can I simply just use the entire "pkgs" folder that is located in my current Anaconda installation location ? Or are the packages in my package list not necessarily installed inside there?

I apologize if the question is 'nooby', I honestly don't know how to. Looking forward to any help.

Upvotes: 4

Views: 8181

Answers (1)

user3451660
user3451660

Reputation: 477

If anyone else is struggling with this, these are the steps I took:

  1. Create a file containing the names of all the packages installed in the current environment. One way to do this(already shown in question) is by typing the following on a command prompt (run as admin):

    conda list -e > packagelist.txt

  2. Go to the "pkgs" folder that is located in your Anaconda installation directory. Copy all the zipped packages there (only the ones that have a ".tar.bz2" file extension), and paste them inside another folder somewhere, lets call it "pkgs2".

  3. Compare the packages in the "packagelist" text file you created with the packages inside the the new folder you created, "pkgs2". Delete older package versions.For example, there might be two different numpy versions in your "pkgs2" folder. Delete the outdated one if necessarily.

  4. Create index and repodata files. I'm not entirely sure why. The important one is the "repodata.json.bz2" file. You can create this by typing the following in command prompt (obviously your "pkgs2" might be located somewhere else, so adjust accordingly):

    conda index C:\Users\myName\Desktop\pkgs2

    If you get the following error:

    Indexing a copy of the Anaconda conda package channel is neither necessary nor supported. If you which to add your own packages, you can do so by adding them to a separate channel.

    then you have to go to your "pkgs2" folder and delete the "_license" package.I don't know why it works but it does (saw the solution to the error from a google search).

    You should see that 3 new files were added to the "pkgs2" folder after the indexing was completed. They are called ".index.json", "repodata.json" and "repodata.json.bz2".

  5. You can now transfer the "pkgs2" folder and the "packagelist.txt" to another computer. You can also include a setup file for installing anaconda if the computer doesn't already have it installed. To install the new/updated packages offline, enter the following in a command prompt on the offline computer that has anaconda installed (once again, obliviously adjust the file names and locations accordingly) :

    conda install --file C:\Users\myName\Desktop\OfflineInstall\packagelist.txt --channel file://C:\Users\myName\Desktop\OfflineInstall\pkgs2

  6. If all went well, you should see something like this in your command prompt: screenshotcmd. And once the new packages are installed, you are done!

You might however, run into the following problem during Step 5 (this is just an example):

UnsatisfiableError: The following specifications were found to be in conflict:
  - matplotlib 1.4.3 np19py27_1 -> pyparsing 2.0.3
  - pyparsing 2.2.0 py27_0
Use "conda info <package>" to see the dependencies for each package.

Adjust your packages accordingly, either deleting conflicting ones you don't need, or updating the ones shown. Repeat from Step 4 and you should be ok at the end.

Hope this helps someone !

Upvotes: 9

Related Questions