Installing packages into Canopy User Python from the OS command line

(updated May 28, 2015: updates re setuptools and pip, remove obsolete material)

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.5.1 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>

 

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
    Michael Roberge

    As a new user(free canopy express) I found it a little strange that external installed pkgs where are not tracked and listed as having been installed in the canopy pkg manager. I needed pyVISA and it didn't come with canopy express, although it was listed as being part of canopy. But when I asked the canopy pkg manager to install, it wanted me to subscribe(pay) for next level of canopy. So I installed manual and was able to access and use it from inside python canopy. But I was dissapointed that pyVISA wasn't listed in canopy pkg manager as having been installed. It would be nice it canopy manager would at least acknowledge that it was installed. I would even be willing to tell the canopy pkg manager what had been installed if it would track it in the future. 

  • Avatar
    Brett Murphy

    Thank you for the input Michael. An update to the package manager is on our short list of things to do for Canopy.

  • Avatar
    Ming Mao

    Regarding the incompatibility with setuptools, is it still true with Canopy 1.3?

  • Avatar
    Jonathan March

    @mingmao: The setuptools situation has not changed in Canopy 1.3. To be reiterate, the incompatibility is not with setuptools per se, but with versions of setuptools newer than 0.6. Setuptools 0.6 is effectively included (via distribute).

  • Avatar
    Ming Mao

    @Jonathan, thanks for the reply.

     

    And does canopy have any plans to solve the issue, i.e., support higher version of setuptools?

  • Avatar
    Abinaya Manimaran

    I want patsy module to be installed. I downloaded it from  https://pypi.python.org/pypi/patsy.

    when i try to run the setup.py i get this error.

    Warning (from warnings module):

    File "C:\Program Files\Enthought\Canopy32\App\appdata\canopy-1.3.0.1715.win-x86\lib\distutils\dist.py", line 267

    warnings.warn(msg)

    UserWarning: Unknown distribution option: 'install_requires' 

     

    please provide me the detailed step to install patsy. its urgent. I use enthought canopy (Version: 1.3.0.1715 ) for win 32

  • Avatar
    M Szenk

    Community packages are freely available online- why do I have to pay $200 to upgrade to be able install them through the package manager?

  • Avatar
    Jonathan March

    @mszenk. Virtually all packages in the Canopy repo (not just community packages) are free and open source. What a Basic subscriber is paying for is the huge amount of time that went into building and packaging them (and testing, in the case of the main repo). Please feel free to build any package yourself in Canopy Python as described in this article.

  • Avatar
    Apostolos Vergos

    Hi,

    I am trying to install a package using pip and I was following the instructions here:

    I have canopy 1.3 and sys.prefix returns c:\users\myname\appdata\local\enthought\canopy\user which seems correct but when I run easy_install pip I get the following error: invalid command 'easy_install'

    I deleted a previous installation of pythonxy (or at least everything I could find) so I think this is not causing the problem.

    The following are in my Pathvariable:

    c:\users\myname\appdata\local\enthought\canopy\user\scripts;

    c:\users\myname\appdata\local\enthought\canopy\user\scripts;

    C:\Users\myname\AppData\Local\Enthought\Canopy32\User\Scripts;

    C:\Users\myname\AppData\Local\Enthought\Canopy\User;

    C:\Users\myname\AppData\Local\Enthought\Canopy\User\Scripts

    Can you please help,

    Thanks

     

  • Avatar
    Jonathan March

    @Apostolos - Sorry for the trouble; we are investigating.

  • Avatar
    Apostolos Vergos

    Thanks for the reply Jonathan, no trouble at all.

    I have the same problem at my laptop with a fresh windows 7 installation. Enthought Canopy is the only Python distribution I have installed.

    The paths in this case are:

    c:\users\myname\appdata\local\enthought\canopy\user\scripts

    C:\Users\myname\AppData\Local\Enthought\Canopy\User

    C:\Users\myname\AppData\Local\Enthought\Canopy\User\Scripts

    Also some more details that apply in both cases that might help:

    • I installed Canopy for all users and I am the administrator of the system.
    • I am using Windows 7 x64

    Thanks

     

  • Avatar
    M Szenk

    Thought it worth mentioning that I am using the same setup and have the same issue as Apostolos.

  • Avatar
    Jon Moore

    I also have this problem.  Please reach out if help is needed with reproduction or testing fixes.  

  • Avatar
    Jonathan March

    @mszenk, @Apostolos, @Jon: following up by individual support tickets

  • Avatar
    Jonathan March

    The workaround, until Canopy 1.4 is released, is (from a Canopy Command Prompt window) to begin with:

    pip install --upgrade setuptools

  • Avatar
    Siva Aduri

    Hi Jonathan, Canopy command prompt doesn't seem to recognize the command. can help me. Thanks

  • Avatar
    Erick Litswa

    On windows i run the command in the following format pip-script.py install --upgrade setuptools and it worked for me

  • Avatar
    Jonathan March

    @Siva: The "Canopy Command Prompt" does not mean the Python prompt within Canopy. Rather, it is a terminal window opened from the Windows Start Menu. Sorry for the confusion, clarifying article now.

  • Avatar
    Siva Aduri

    Thanks Jonathan and Eric appreciate it.

  • Avatar
    Sérgio Rodrigues

    This post helped me install pytagcloud. I was getting an error after 'pip install -U pytagcloud'. But as soon as I updated setuptools as this posted shown, I could get pip running like a charm.

  • Avatar
    Liora Braunstain

    Hi,

    I am rather new to the whole wold of edp,

    I have installed canopy 1.4 on my 64 bit windows machine,

    When i try to install a package (sparsesvd to be exact) with the following comnmand:

    in C:\Users\liorab\AppData\Local\Enthought\Canopy\User\Scripts pip install -U sparsesvd , 

    I get the error that he can't find the Microsoft visual studio,

    Yet I have installed mingw and it is on my PATH variable.

    Yet two weeks before i installed other packages that worked fine (numpy, gensim...)

    Does someone know how to solve this?

     

    Thank you!

  • Avatar
    Jonathan March

    Hi Liora, Your question is an excellent one but is a general python build question (a huge subject), and as such is outside the scope of this article, which is about how to ensure that Canopy is set up so that you can do installations/builds. A question on Stack Overflow (tagged python and enthought) might be productive. I will add, though, that building C-based packages in Windows can be tricky. As a general rule, since CPythons 2.x (including Canopy Python) on Windows are usually build with Visual C++ 2008, then C-based packages should also be built with Visual C++ 2008. This related article may also help: https://support.enthought.com/entries/26864394-Windows-Unable-to-find-vcvarsall-bat . BTW, presumably you did not need to build numpy in Canopy, since Canopy provides numpy pre-built, so that installing it in Canopy is as simple as using the Package Manager or the enpkg utility to install from the already-built numpy "egg" file provided.

  • Avatar
    Jonathan March

    Brief new section in article "Listing both Canopy-installed and externally-installed packages"

  • Avatar
    Bennett Brown

    Open a Canopy Command prompt by selecting Tools>Canopy Command Prompt. At the prompt, cd to the directory containing the package to install. Use pip help to familiarize yourself with pip. Use pip freeze to list all packages. Use pip install packagename to install packages. (The packages thus installed might not be reflected in the Package Manager, noting Enthought is working on enhancing that in an upcoming release.)

  • Avatar
    Chris Spidle

    "follow standard Python installation procedures from the OS command line"

    Where are these???  The FAQ's are sending me in an infinite loop.

  • Avatar
    Jonathan March

    @Chris,  We assume that anyone who wishes to install a 3rd party package has access to the corresponding installation instructions. By far the most common technique is "pip install package_name", but it really depends on the instructions provided for a particular package (Python packaging is still something of a Wild West). If you have particular questions about how to install a particular package, please ask a question on Stack Overflow, as described at the end of this article (or for paid subscribers, submit a support ticket to us.)

  • Avatar
    Alina Zugg

    This was AWFUL. Points 1 and 2 went well enough. I was really glad that I didn't have to mess with paths and the default pythons, and you told me I could run the terminal from Canopy. This was useful. But then in 3 it was completely unclear under which circumstances the setup tools were to be downloaded, and the warning "conveniently" shows up several lines later. Great. So now I don't know if I corrupted my installer. And the part about "follow standard Python installation procedures from the OS command line" is just delightful. Like the other person says, I am now in an infinite loop. I have tried easy_install with my package (astrolibpy), that returns an error message, and I have no idea whether that's because I corrupted my installer or because the package is somehow not compatible (it's a one-person project, who knows). 

    Basically, the whole thing reads "do this, unless you have this, in which case absolutely don't do it, but if you absolutely have to do it, then don't do that other thing, do the default instead". Why am I not surprised it didn't work?.. 

  • Avatar
    Jonathan March

    Article much simplified, mostly due to the fact that the current version of setuptools is now available in the Canopy repository.

Please sign in to leave a comment.