Installing packages into Canopy User Python from the OS command line

Whenever possible, packages should be installed using Canopy's Package Manager or equivalently at the command-line:

enpkg <package name>

If the package is not available or you require a more recent version, please see the following steps.

Standard quick steps

1) Update to the latest version of Canopy. If you are running Canopy version 1.6.2 or earlier, see this article.

2) Be sure that you are logged in on the Canopy Welcome Screen.

3) In the Canopy Package Manager, update the setuptools and pip packages. Alternatively, these can be updated from the command line, see (5).

4) From the Canopy Tools menu, open a Canopy Command Prompt (Windows) or Canopy Terminal (Mac or Linux). Use this in the following steps.

5) If you skipped (3), then type the following commands:

enpkg setuptools
enpkg pip

6) Type the following command:

pip install <package name>

7) 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 enpkg's list of installed packages, which are mostly equivalent; these only include the packages that they have installed themselves. 

 

Background and problem cases: 

You can install additional packages (either external or from the Canopy / EPD repository) into Canopy User Python in a Windows command prompt window or Mac/Linux terminal window.

1. The key point is that you must install into the Canopy User Python environment, not into Canopy's Core or System Python environments. 

Ensure that Canopy User Python is on the shell PATH, i.e. that typing `python` at the prompt starts Canopy User Python, not another python. The easiest way to ensure this is to work in a Canopy Command Prompt (Windows) or a Canopy Terminal (Mac or Linux), available from the Canopy Tools menu in Canopy 1.4 and above.

Otherwise, see this article for details on setting PATH, and see this article for more information about the difference between Canopy User Python and other Canopy Pythons, which you should not use directly.

2. To install a package which is not available in the Canopy / EPD repository, follow standard Python installation procedures from the OS command line. In most cases, all you need to do is:

pip install <package name>

3. Packages which include C-language extensions are more difficult to build on Windows. See this article for details. In many cases, you may find it easiest to download a Windows binary package from Chris Gohlke's "Unofficial Windows Binaries for Python Extension Packages" page, then:

pip install <downloaded filename.whl>

4.  If you are not installing a new package, but updating a package that is already in Canopy, to a version that is not yet available in the Canopy repository, please note this article.

5. With the PATH set as just described, you may also use the EPD/Canopy `enpkg` utility from the OS command line, in lieu of the Canopy package manager.

6. As of April 2015, the Canopy package repository includes an updated version of setuptools (16.0). Install it from the Canopy Package Manager or at the command line as described above. Do not install setuptools with pip or using other non-Canopy methods.

Packages installed using pip or other non-Enthought installers will not be listed in the Package Manager, but they will be fully installed into, and usable in, Enthought Canopy User Python. We are reviewing options for listing them in the Package Manager in future versions of Canopy.

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, enpkg, 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. For individual support requests, please follow these guidelines.

Have more questions? Submit a request

Comments

  • Avatar
    Maria Stone

    Hi, actually when I put

    pip install

    it did not work, I had to remove the <> around the package name

    thank you for the article

Powered by Zendesk