Skip to content Skip to sidebar Skip to footer

How To Make Setuptools Install A Wheel Containing Multiple Packages?

Suppose this wheel: M Filemode Length Date Time File - ---------- -------- ----------- -------- ------------------------------------------- -rw-rw-r--

Solution 1:

It sounds like only few sub-directories like azure.common installed into your environment when you installed dependencies via setup.py with install_requires=['azure-common']. I tried to reproduce this issue, but failed that all files in this package has been installed.

Here is my steps on my local Windows machine as below, which you can refer to.

  1. Create a directory mkdir setuptmp, and create a virtual environment virtualenv setuptmp, then to cd setuptmp.
  2. Create a setup.py file with the content as below.\

    from setuptools import setup, find_packages  
    
    setup(
        name = "setuptmp",
        install_requires = ['azure-common']
    )
  3. Activate the virtual environment via Scripts\activate.bat.

  4. Run python setup.py install to install the dependency described in my setup.py.
  5. Run python to open the REPL interpreter to test all packages as you said,

    (setuptmp) D:\projects\setuptmp>python
    Python 3.7.1 (v3.7.1:260ec2c36a, Oct 202018, 14:57:15) [MSC v.191564 bit (AMD64)] on win32
    Type"help", "copyright", "credits"or"license"for more information.
    >>> import azure.common
    >>> import azure.profiles
    >>> azure.common.__file__
    'D:\\projects\\setuptmp\\lib\\site-packages\\azure_common-1.1.16-py3.7.egg\\azure\\common\\__init__.py'>>> azure.profiles.__file__
    'D:\\projects\\setuptmp\\lib\\site-packages\\azure_common-1.1.16-py3.7.egg\\azure\\profiles\\__init__.py'>>> import azure_common
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'azure_common'

Note: azure_common is not a module, just an egg info directory.

  1. Check the packages installed in my environment via cd Lib\site-packages, dir and tree azure_common-1.1.16-py3.7.egg /F as below.

    (setuptmp)D:\projects\setuptmp\Lib\site-packages>dirVolumeindriveDisDataVolumeSerialNumberisBA4B-64AADirectoryofD:\projects\setuptmp\Lib\site-packages2018/12/2614:48<DIR>.2018/12/2614:48<DIR>..2018/12/2614:48<DIR>azure_common-1.1.16-py3.7.egg2018/12/2614:4861easy-install.pth2018/12/2614:46126easy_install.py2018/12/2614:46<DIR>pip2018/12/2614:46<DIR>pip-18.1.dist-info2018/12/2614:46<DIR>pkg_resources2018/12/2614:48965setuptmp-0.0.0-py3.7.egg2018/12/2614:46<DIR>setuptools2018/12/2614:46<DIR>setuptools-40.6.3.dist-info2018/12/2614:46<DIR>wheel2018/12/2614:46<DIR>wheel-0.32.3.dist-info2018/12/2614:46<DIR>__pycache__3File(s)1,152bytes11Dir(s)80,896,319,488bytesfree(setuptmp)D:\projects\setuptmp\Lib\site-packages>treeazure_common-1.1.16-py3.7.egg/FFolderPATHlistingforvolumeDataVolumeserialnumberisBA4B-64AAD:\PROJECTS\SETUPTMP\LIB\SITE-PACKAGES\AZURE_COMMON-1.1.16-PY3.7.EGG├─azure├─commonclient_factory.pycloud.pycredentials.pyexceptions.py_version.py__init__.py└─__pycache___version.cpython-37.pyc__init__.cpython-37.pyc└─profilesmultiapiclient.py__init__.py└─EGG-INFOPKG-INFORECORDrequires.txttop_level.txtWHEEL
  2. Compare the above with the file structure of azure-common package downloaded from the link of Pypi website. I decompressed azure_common-1.1.16-py2.py3-none-any.whl file using 7-Zip into a temp directory and tree it.

    D:\tmp>tree azure_common-1.1.16-py2.py3-none-any/F
    Folder PATH listing for volume Data
    Volume serial number is BA4B-64AA
    D:\tmp\AZURE_COMMON-1.1.16-PY2.PY3-NONE-ANY
    ├─azure
    │  ├─common
    │  │      client_factory.py
    │  │      cloud.py
    │  │      credentials.py
    │  │      exceptions.py
    │  │      _version.py
    │  │      __init__.py
    │  │
    │  └─profiles
    │          multiapiclient.py
    │          __init__.py
    │
    └─azure_common-1.1.16.dist-info
            METADATA
            RECORD
            top_level.txt
            WHEEL
    

Then, you will find the file structure of step 6 & 7 is almost same.

Hope it helps. If you have any concern, please feel free to let me know.


I did the same above on Linux and got the same result. I saved the output of tree lib/ > lib_[before|after].txt of my Linux setuptmp before and after run python setup.py install, then to compare them using diff lib_*.txt as below.

(setuptmp) peter@peterpc:~/setuptmp$ diff lib*.txt
92a93,111
>     │   ├── azure_common-1.1.16-py3.6.egg>     │   │   ├── EGG-INFO>     │   │   │   ├── PKG-INFO>     │   │   │   ├── RECORD>     │   │   │   ├── WHEEL>     │   │   │   ├── requires.txt>     │   │   │   └── top_level.txt>     │   │   └── azure>     │   │       ├── common>     │   │       │   ├── __init__.py>     │   │       │   ├── _version.py>     │   │       │   ├── client_factory.py>     │   │       │   ├── cloud.py>     │   │       │   ├── credentials.py>     │   │       │   └── exceptions.py>     │   │       └── profiles>     │   │           ├── __init__.py>     │   │           └── multiapiclient.py>     │   ├── easy-install.pth
827a847
>     │   ├── setuptmp-0.0.0-py3.6.egg
1043c1063
< 118 directories, 922 files
---
> 123 directories, 937 files

Post a Comment for "How To Make Setuptools Install A Wheel Containing Multiple Packages?"