Installing packages into Canopy 2 User Python from the OS command line

Whenever possible, packages should be installed using Canopy's Package Manager or equivalently at the command-line in a Canopy Command Prompt (Windows) or Canopy Terminal (Mac or Linux):

edm install <package name>

If the package is not available in Enthought's package repositories, or you require a more recent version, please see the following steps.

Standard quick steps

1) From the Canopy Tools menu, open a Canopy Command Prompt or Canopy Terminal. 

2) Type the following command:

pip install <package name>

Note that while the newly installed package can be imported (used) in your Python programs, it will not show in the Package Manager, nor in edm's list of installed packages, which are mostly equivalent; these only include the packages that they have installed themselves.

Possible fragility of a pip install

If the "pip install <package name>" also installed any dependent packages which would have been available (though perhaps in a different version) in the Package Manager / edm, then it is possible that your environment would be corrupted because of conflict between the versions that pip installed and the version that is available in the Package Manager.

As a simple workaround, you can determine all the dependencies of your package in advance, and then install as many of these as possible the Package Manager / edm before running pip. The easiest way to do this by creating and experimenting in a minimal throwaway edm environment. (EDM is always available in a Canopy Command Prompt / Terminal). This solution does not, however, ensure the overall consistency of your Python environment.

A much more robust and scalable solution is to build but not install the package and any new dependencies with pip, then repack these using the Enthought Deployment Manager (EDM), then make them available for installation from the Enthought Deployment Server. This ensures the overall consistency of the Python environment.

 

Listing both Canopy-installed and externally-installed packages

To see a list of all the packages installed into Canopy User Python by normal means (whether Package Manager, edm, egginst, pip, or easy_install), you can type the following at a Canopy Command Prompt / Terminal:

pip list

Please do not enter support requests in article comments

Please use article comments for suggestions to improve the article. See "How to submit Enthought Canopy/EPD support requests".

Have more questions? Submit a request

Comments

Powered by Zendesk