top of page
thirdringseckedaco

Python Easy Install



easy_install, now deprecated, was released in 2004 as part of setuptools.It was notable at the time for installing packages fromPyPI using requirement specifiers, andautomatically installing dependencies.




python easy install



Note that easy_install normally works by downloading files from theinternet. If you are behind an NTLM-based firewall that prevents Pythonprograms from accessing the net directly, you may wish to first install and usethe APS proxy server, which lets you get past suchfirewalls in the same way that your web browser(s) do.


If EasyInstall/setuptools appears to install correctly, and you can run theeasy_install command but it fails with an ImportError, the most likelycause is that you installed to a location other than site-packages,without taking any of the steps described in the Custom InstallationLocations section below. Please see that section and follow the steps tomake sure that your custom location will work correctly. Then re-install.


Installing setuptools will provide an easy_install command according tothe techniques described in Executables and Launchers. If theeasy_install command is not available after installation, that sectionprovides details on how to configure Windows to make the commands available.


Example 7. (New in 0.6a1) Find a source distribution or Subversioncheckout URL for a package, and extract it or check it out to/projects/sqlobject (the name will always be in all-lowercase), where itcan be examined or edited. (The package will not be installed, but it caneasily be installed with easy_install /projects/sqlobject. See Editingand Viewing Source Packages below for more info.):


When downloading or processing downloaded files, Easy Install recognizesdistutils source distribution files with extensions of .tgz, .tar, .tar.gz,.tar.bz2, or .zip. And of course it handles already-built .eggdistributions as well as .win32.exe installers built using distutils.


Installed packages are added to an easy-install.pth file in the installdirectory, so that Python will always use the most-recently-installed versionof the package. If you would like to be able to select which version to use atruntime, you should use the -m or --multi-version option.


Where 1.2.3 is replaced by the exact version number you wish to switch to.If a package matching the requested name and version is not already installedin a directory on sys.path, it will be located via PyPI and installed.


This will activate the latest installed version. (Note: if you have set anyfind_links via distutils configuration files, those download pages will bechecked for the latest available version of the package, and it will bedownloaded and installed if it is newer than your current version.)


Whenever you install, upgrade, or change versions of a package, EasyInstallautomatically installs the scripts for the selected package version, unlessyou tell it not to with -x or --exclude-scripts. If any scripts inthe script directory have the same name, they are overwritten.


Thus, you do not normally need to manually delete scripts for older versions ofa package, unless the newer version of the package does not include a scriptof the same name. However, if you are completely uninstalling a package, youmay wish to manually delete its scripts.


Regardless of the technique used, the script(s) will be installed to a Scriptsdirectory (by default in the Python installation directory). It is recommendedfor EasyInstall that you ensure this directory is in the PATH environmentvariable. The easiest way to ensure the Scripts directory is in the PATH isto run Tools\Scripts\win_add2path.py from the Python directory.


EasyInstall installs itself under two names:easy_install and easy_install-N.N, where N.N is the Python versionused to install it. Thus, if you install EasyInstall for both Python 3.2 and2.7, you can use the easy_install-3.2 or easy_install-2.7 scripts toinstall packages for the respective Python version.


You can do this with both index page URLs and direct download URLs. As longas any HTML pages read by easy_install use relative links to point to thedownloads, the same user ID and password will be used to do the downloading.


In additional to supplying credentials in the URL, easy_install will alsohonor credentials if present in the .pypirc file. Teams maintaining a privaterepository of packages may already have defined access credentials foruploading packages according to the distutils documentation. easy_installwill attempt to honor those if present. Refer to the distutils documentationfor Python 2.5 or later for details on the syntax.


EasyInstall respects standard distutils Configuration Files, so you can usethem to configure build options for packages that it installs from source. Forexample, if you are on Windows using the MinGW compiler, you can configure thedefault compiler by putting something like this:


Note that using --editable stops EasyInstall from actually building orinstalling the package; it just finds, obtains, and possibly unpacks it foryou. This allows you to make changes to the package if necessary, and toeither install it in development mode using setup.py develop (if thepackage uses setuptools, that is), or by running easy_install projectdir(where projectdir is the subdirectory EasyInstall created for thedownloaded package.


(NOTE: As of 0.6a11, this section is obsolete; it is retained here only so thatpeople using older versions of EasyInstall can consult it. As of version0.6a11, installation conflicts are handled automatically without deleting theold or system-installed packages, and without ignoring the issue. Instead,eggs are automatically shifted to the front of sys.path using specialcode added to the easy-install.pth file. So, if you are using version0.6a11 or better of setuptools, you do not need to worry about conflicts,and the following issues do not apply to you.)


As a result, if you are using EasyInstall to upgrade an existing package, orto install a package with the same name as an existing package, EasyInstallwill warn you of the conflict. (This is an improvement over setup.pyinstall, because the distutils just install new packages on top of oldones, possibly combining two unrelated packages or leaving behind modules thathave been deleted in the newer version of the package.)


As of version 0.5a9, EasyInstall analyzes packages to determine whether theycan be safely installed as a zipfile, and then acts on its analysis. (Previousversions would not install a package as a zipfile unless you used the--zip-ok option.)


If any of the above are found in the package being installed, EasyInstall willassume that the package cannot be safely run from a zipfile, and unzip it toa directory instead. You can override this analysis with the -zip-ok flag,which will tell EasyInstall to install the package as a zipfile anyway. Or,you can use the --always-unzip flag, in which case EasyInstall will alwaysunzip, even if its analysis says the package is safe to run as a zipfile.


Notice that easy_install will use the setup.cfg from the currentworking directory only if it was triggered from setup.py through theinstall_requires option. The standalone command will not use that file.


which will put the latest installed version of the specified packages onsys.path for you. (For more advanced uses, like selecting specificversions and enabling optional dependencies, see the pkg_resources APIdoc.)


(New in 0.4a2) If this option is not directly specified on the command lineor in a distutils configuration file, the distutils default installationlocation is used. Normally, this would be the site-packages directory,but if you are using distutils configuration files, setting things likeprefix or install_lib, then those settings are taken intoaccount when computing the default installation directory, as is the--prefix option.


Only find and download source distributions for the specified projects,unpacking them to subdirectories of the specified --build-directory.EasyInstall will not actually build or install the requested projects ortheir dependencies; it will just find and extract them for you. SeeEditing and Viewing Source Packages above for more details.


This option is most useful in combination with the --editable option,which forces EasyInstall to only find and extract (but not build andinstall) source distributions. See Editing and Viewing Source Packages,above, for more information.


Restrict downloading and spidering to hosts matching the specified globpatterns. E.g. -H *.python.org restricts web access so that onlypackages listed and downloadable from machines in the python.orgdomain. The glob patterns must match the entire user/host/port section ofthe target URL(s). For example, *.python.org will NOT accept a URLlike or :8080/.Multiple patterns can be specified by separating them with commas. Thedefault pattern is *, which matches anything.


Use the specified directory as a base for computing the defaultinstallation and script directories. On Windows, the resulting defaultdirectories will be prefix\\Lib\\site-packages and prefix\\Scripts,while on other platforms the defaults will beprefix/lib/python2.X/site-packages (with the appropriate versionsubstituted) for libraries and prefix/bin for scripts.


Normally, EasyInstall prefers to only install released versions ofprojects, not in-development ones, because such projects may nothave a currently-valid version number. So, it usually only installs themwhen their setup.py directory is explicitly passed on the command line.


There are older ways to achieve custom installation using various easy_install and setup.py install options, combined with PYTHONPATH and/or PYTHONUSERBASE alterations, but all of these are effectively deprecated by the User scheme brought in by PEP 370.


Python provides a User scheme for installation, which means that allpython distributions support an alternative install location that is specific to a user [3].The Default location for each OS is explained in the python documentationfor the site.USER_BASE variable. This mode of installation can be turned on byspecifying the --user option to setup.py install or easy_install.This approach serves the need to have a user-specific stash of packages. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


  • White Facebook Icon
  • White Vimeo Icon
  • White YouTube Icon
  • White Twitter Icon
  • White LinkedIn Icon
bottom of page