Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How come I can't get the exactly result to *pip install* by manually *python setup.py install*?

I like to figure out the myth behind Python's namespace packages by setuptools, and here is what I did test.

  • Make a virtual environment by virtualenv.
  • Find a namespaced package on PyPI.
  • Install that package by pip install.
  • Check the installed file hierarchy.

The package I played with is zope.interface and it worked well with the following file hierarchy on my virtualenv:

~virenv/.../site-packages/zope.interface-3.8.0-py2.6-nspkg.pth
                         /zope.interface-3.8.0-py2.6.egg-info/
                         /zope/
                              /interface/
                                        /...

Everything looked fine and I love the way zope.interface got installed as a real namespaced package (under folder zope).

Then, I did another test and that's the question I would like to ask for your help. I downloaded the tared zope.interface source file. I liked to play it manually again

  • Make a virtual environment by virtualenv.
  • Untar the zope.interface into somewhere.
  • Install the package by python setup.py install.
  • Go check what happened in site-packages.

The site-packages looks like this:

~virenv/../site-packages/zope.interface-...egg/
                                              /zope/
                                                   /__init__.py
                                                   /interface/
                                              /EGG-INFO/

Q. How come I can't get the exactly result to pip install by manually python setup.py install?

like image 289
Drake Guan Avatar asked Apr 16 '12 10:04

Drake Guan


People also ask

How do I install the exact version of pip?

To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

How do I manually download pip packages?

How to Manually Download Packages from PyPI. You can download packages directly from PyPI by doing the following: Point your browser at https://pypi.org/project/<packagename> Select either Download Files to download the current package version, or Release History to select the version of your choice.

How install pip using setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

How do I know if pip install worked?

Verify the PIP Installation Process and Check the PIP Version. If PIP is installed correctly, we will see a message indicating the version of PIP and its location on the local system, like the following: pip 22.0. 2 from C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10) .


1 Answers

pip uses setup.py internally. It just passes additional option to it. To reproduce what pip is doing, execute

python setup.py install --single-version-externally-managed

You can also run pip -vv to see exactly which commands are run.

like image 83
vartec Avatar answered Sep 28 '22 07:09

vartec