Installing packages into an Enthought Python (EDM-installed) environment

The following instructions all assume that you have opened a Command Prompt or Terminal, and have activated the Python environment into which you want to install the packages. A simple way to activate a specific edm-installed environment at a command line is:

edm shell -e <environment-name>

Packages should be installed using edm whenever possible (i.e. whenever they are available in the Enthought package repositories).

edm install <package name>

Using pip to install packages not available with edm

If the desired package is not available in Enthought's package repositories, or you require a more recent version, then the following command will often work:

python -m pip install --no-dependencies <package name>

This command does not install any of the package's dependencies, so if these are not already installed in your environment, then the package will not be usable as is. 

The most robust approach to this potential problem is to determine, in advance, all the dependencies of your desired package, and then install as many of these as possible, using edm, before running pip to install your desired package. (If the dependency itself is not available via edm, then first install it via pip following these same guidelines -- a recursive problem.)

The easiest way to determine these dependencies is by creating a minimal throwaway edm environment, and experimenting there, typically starting with python -m pip install <package name>

Possible fragility of a pip install

If a dependency that was installed by edm is not a compatible/expected version for your pip-installed package, then the pip-installed package might not work as expected.

But if you try to work around this by using pip to install a package which is available via edm (in a different version in this case), 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 from Enthought. 

To reduce the effort of such a trial-and-error approach, you may wish to learn in advance the dependencies of a particular Enthought-provided package. For this, use edm's list-dependencies command with its -r (recursive) option. The following forms are most commonly used, in order of increasing specificity:

edm list-dependencies -r <packagename>
edm list-dependencies -r <packagename^=version.number>
edm list-dependencies -r <packagename==version.number-buildnumber> 

Listing both edm-installed and externally-installed packages

While packages installed by pip can be imported (used) in your Python programs, they will not show in edm list, which only shows the packages that edm itself installed in the environment.

To see a list of all the packages installed into the environment by normal means (whether edm or pip), you can type the following:

python -m 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

Powered by Zendesk