Easy_install Command Not Found

2 views
Skip to first unread message

Lynne Pruskowski

unread,
Aug 4, 2024, 10:40:37 PM8/4/24
to sunmascrutmi
Idownloaded pip and ran python setup.py install and everything worked just fine. The very next step in the tutorial is to run pip install but before it even tries to find anything online I get an error "bash: pip: command not found".

This is on Mac OS X. I'm assuming there's some kind of path setting that was not set correctly when I ran setup.py. How can I investigate further? What do I need to check to get a better idea of the exact cause of the problem?


EDIT: I also tried installing Python 2.7 for Mac in the hopes that the friendly install process would do any housekeeping like editing PATH and whatever else needs to happen for everything to work according to the tutorials, but this didn't work. After installing, running 'python' still ran Python 2.6 and PATH was not updated.


This will allow you to then run the pip command for python package installation as it will be installed with the system python. I also recommend once you have pip using the virtualenv package and pattern. :)


(I know the above part of my answer is redundant with klobucar's, but I can't add comments yet), so here's an answer with a solution to sudo: easy_install: command not found on Debian/Ubuntu: sudo apt-get install python-setuptools


I've made an alias on my machine to run python3 whilst typing python, which would normally run the system version 2.7. I'm not sure this is a good idea now. I think I'll just type in the commands as they intended them to be.


I have tried to run "easy_install.py", the result is also "easy_install.py: command not found". I have tried to search the whole of cygwin's /usr tree for anything named with the prefix "easy", none found.


easy_install is part of the setuptools package. This package is provided by cygwin. To install it, rerun the cygwin setup[...].exe installer, and at the package selection step, tick "Python/python-setuptools".


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.


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 use the --allow-hosts (-H) option to restrict what domainsEasyInstall will look for links and downloads on. --allow-hosts=Noneprevents downloading altogether. You can also use wildcards, for exampleto restrict downloading to hosts in your own intranet. See the section belowon Command-Line Options for more details on the --allow-hosts option.


In addition to local directories and the Python Package Index, EasyInstall canfind download links on most any web page whose URL is given to the -f(--find-links) option. In the simplest case, you can simply have a webpage with links to eggs or Python source packages, even an automaticallygenerated directory listing (such as the Apache web server provides).


If you are setting up an intranet site for package downloads, you may want toconfigure the target machines to use your download site by default, addingsomething like this to their configuration files:


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:


into the appropriate distutils configuration file. In fact, since this is justnormal distutils configuration, it will affect any builds using that configfile, not just ones done by EasyInstall. For example, if you add those linesto distutils.cfg in the distutils package directory, it will be thedefault compiler for all packages you build. See Configuration Filesbelow for a list of the standard configuration file locations, and links tomore documentation on using distutils configuration files.


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.


In order to use --editable (-e for short), you must also supply a--build-directory (-b for short). The project will be placed in asubdirectory of the build directory. The subdirectory will have the samename as the project itself, but in all-lowercase. If a file or directory ofthat name already exists, EasyInstall will print an error message and exit.


Also, when using --editable, you cannot use URLs or filenames as arguments.You must specify project names (and optional version requirements) so thatEasyInstall knows what directory name(s) to create. If you need to forceEasyInstall to use a particular URL or filename, you should specify it as a--find-links item (-f for short), and then also specifythe project name, e.g.:


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

3a8082e126
Reply all
Reply to author
Forward
0 new messages