Giter Site home page Giter Site logo

wheel2deb's Introduction

wheel2deb

cicd codecov MIT license Code style: black PyPI version shields.io Downloads WakeMeOps

wheel2deb is a python wheel to debian package converter. It takes a list of wheels as input and produces a list of debian binary CPython packages (those prefixed with python- or python3-).

asciicast

Quick Example

The following shows how to convert numpy and pytest, along with their dependencies into a list of debian packages:

# Download (and build if needed) pytest, numpy and their requirements
pip3 wheel pytest numpy
# Convert all wheels to debian source packages, build them with dpkg-buildpackage
wheel2deb
ls -l output/*.deb
# Install generated packages
dpkg -i output/*.deb
# Run pytest on numpy
python3 -c "import numpy; numpy.test()"

Project scope

  • Python 2.7 and 3
  • CPython only for now
  • support for non pure python wheels
  • support debian architectures all, armhf, amd64, i686
  • tested on jessie, stretch, buster so far, ubuntu should also work

Requirements

wheel2deb uses apt-cache to search for debian packages, dpkg-shlibdeps to calculate shared library dependencies and apt-file to search packages providing shared library dependencies. wheel2deb build requires the usual tools to build a debian package:

apt update
apt install apt-file dpkg-dev fakeroot build-essential devscripts debhelper
apt-file update

If you want to cross build packages for ARM, you will also need to install binutils-arm-linux-gnueabihf.

Converting pure python wheels, don't actually requires apt-file and dpkg-dev.

Keep in mind that you should only convert wheels that have been built for your distribution and architecture. wheel2deb will not warn you about ABI compatibility issues.

Installation

From the release page

wheel2deb is packaged as a single binary application that you can download from the release page. Using those releases will spare you the hassle of building Python 3.10 on old Debian based distributions.

sudo apt-get install wheel2deb

With docker

We currently do not build docker images with wheel2deb pre-installed. You can use wakemeops docker images to quickly play with wheel2deb on a different distribution than your host.

docker run -ti wakemeops/debian:buster

And in the container run:

install_packages wheel2deb

With pipx

wheel2deb is available from pypi:

pipx install wheel2deb

Features

  • guess debian package names from wheel names and search for them in the cache
  • search packages providing shared library dependencies for wheels with native code
  • handle entrypoints and scripts (those will be installed in /usr/bin with a proper shebang)
  • try to locate licence files and to generate a debian/copyright file

Usage

Use wheel2deb convert --help and wheel2deb build --help to check all supported options.

Development

You will need poetry, and probably pyenv if you don't have python 3.10 on your host.

poetry install

To run wheel2deb test suite run:

poetry run task check

To build a python wheel:

poetry run poetry build

Bugs/Requests

Please use the GitHub issue tracker to submit bugs or request features.

License

Copyright Parkoview SA 2019-2023.

Distributed under the terms of the MIT license, wheel2deb is free and open source software.

wheel2deb's People

Contributors

dependabot[bot] avatar fyhertz avatar m0ray avatar matusrehak avatar mbra avatar supersandro2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wheel2deb's Issues

How can I ignore a package that is not in the Debian apt cache?

I am trying to package python-sonic (which depends on python-osc) for use on pi-topOS.

python-osc isn't available on Debian, and so python-sonic fails to build - it can't find the package dependency.

Given that we intend to provide both of these packages in our apt repository, we would like an easy way to override this behaviour and continue with the build. Have I missed something or is this a feature to be added?

It would be great to have a command-line argument to override this behaviour.

License file regex

Line 30 of _wheel2deb/pydist.py indicates:
LICENSE_RE = re.compile(r"license", re.IGNORECASE)
This leads to situation when every file with letters "license" in its path is treated as license.
As an example: PySide6-Essentials wheel contains directory "examples/widgets/dialogs/licensewizard" and a lot of files (including binaries such as PNG) under it. All of them are shown as licenses.
Then at line 201-202 of _wheel2deb/debian.py it tries to read PNG file and decode as UTF-8. Crash-bang...

I suggest to change LICENSE_RE for example to:
re.compile(r"(^|[^\w])license(\..*)?$", re.IGNORECASE)
It catches all variations of "license" and "dir/license.ext", but not "license/notreally" and "notalicense".

pkg_resources.DistributionNotFound: The 'dirsync' distribution was not found and is required by wheel2deb

Running the command: wheel2deb --map attrs=attr

Is producing the following output:

Traceback (most recent call last):
File "/usr/bin/wheel2deb", line 6, in
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3254, in
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3237, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 3266, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 584, in _build_master
ws.require(requires)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 787, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'dirsync' distribution was not found and is required by wheel2deb

Argument --python-version is broken

I came across this bug when trying to debianize a package using my py3 environment but trying to get a py2 package.

I was following the guide:

pip3 wheel somePackage
wheel2deb --map attrs=attr --python-version=2.7.14
wheel2deb build

But it fails right away on the second command, no matter what I pass to --python-version.
This is the error message:

Traceback (most recent call last):
  File "/home/eric/.local/bin/wheel2deb", line 8, in <module>
    sys.exit(main())
  File "/home/eric/.local/lib/python3.6/site-packages/wheel2deb.py", line 224, in main
    debianize(args)
  File "/home/eric/.local/lib/python3.6/site-packages/wheel2deb.py", line 145, in debianize
    if not wheel.version_supported(ctx.python_version):
  File "/home/eric/.local/lib/python3.6/site-packages/_wheel2deb/pydist.py", line 145, in version_supported
    m = re.search(r"(?:py|cp)%s" % pyvers.major, self.python_tag)
AttributeError: 'str' object has no attribute 'major

So it looks like it is expecting something formatted as a Version but it is getting a string,

To debug this I added this print statements to wheel2deb.py, since I got the feeling the argument wasn't being parsed correctly:

    print("Settings:")
    print(settings)

    # config file takes precedence over command line arguments
    settings.default_ctx.update(vars(args))

    print("Settings after update:")
    print(settings)

Indeed the python_version key goes from a Version to a str after that update:

Settings:
Settings(config={}, default_ctx=Context(maintainer_name='wheel2deb', maintainer_email='[email protected]', distribution='unstable', python_version=Version(major=3, minor=6, micro=1), platform_machine='x86_64', arch='', ignore_entry_points=False, ignore_upstream_versions=False, ignore_requirements=[], ignore_specifiers=[], extra='', map={}, depends=[], conflicts=[], provides=[], revision='1', epoch=0, version_template='{epoch}:{upstream_version}-{revision}~w2d{w2d_version[0]}'))
Settings after update:
Settings(config={}, default_ctx=Context(maintainer_name='wheel2deb', maintainer_email='[email protected]', distribution='unstable', python_version='2.7.14', platform_machine='x86_64', arch='', ignore_entry_points=False, ignore_upstream_versions=False, ignore_requirements=[], ignore_specifiers=[], extra='', map={}, depends=[], conflicts=[], provides=[], revision='1', epoch=0, version_template='{epoch}:{upstream_version}-{revision}~w2d{w2d_version[0]}'))

I managed to work around this by changing the update function like this:

    def update(self, changes):
        for k, v in changes.items():
            if v and hasattr(self, k):
                if k == "python_version":
                    changes[k] = Version.from_str(v) if isinstance(v, str) else v
                setattr(self, k, changes[k])

Thanks for the amazing tool!

Package name prefix

with py2deb there is an option to add prefix to package name,

for example if i have pacakage named foo i can added prefix mypackage to it mypackage-foo

i have managed to modify suggest_name function so that package name returned with the prefix

but the issue i am facing is in depends if package has dependencies it didn't add with prefix

Depends: python3 (>= 3.6~), boo # here boo added without the prefix

Hardcoded /tmp/wheel2deb causes problems

I started using wheel2deb today, and want to first of all say that it is a great tool :)

However, I found one problem: it uses a hardcoded /tmp/wheel2deb folder. This causes two problems:

The first is that it caches information for too long (at least from the point of a new user like me). I built a whl from source, and built a Debian package from it. Then I noticed a wrong dependency in the whl, rebuilt the whl and rebuilt the Debian package. But very surprising for me, the Debian package still had the wrong dependency, even though the whl had the correct dependency. Running strace on wheel2deb I saw that it accessed /tmp/wheel2deb. After removing the folder, the problem went away.

The second problem is that this makes wheel2deb unusable in a multi-user environment, where /tmp is shared between different users. Because after one user has used wheel2deb, another cannot use wheel2deb until /tmp is manually cleaned.

I suggest using temporary directories with unique names, and removing them after wheel2deb has run, in order to avoid these problems.

Cannot build in /tmp directory

It is not possible to build packages inside /tmp directory:

root@4204bd4ac17c:/# cd /tmp
root@4204bd4ac17c:/tmp# ls
root@4204bd4ac17c:/tmp# pip3 wheel numpy
Collecting numpy
  Downloading numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.7/15.7 MB 73.9 MB/s eta 0:00:00
Saved ./numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
root@4204bd4ac17c:/tmp# wheel2deb --map attrs=attr
 --> Unpacking 1 wheels
     numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
 --> Debianizing wheel numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
/usr/local/lib/python3.7/dist-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
Traceback (most recent call last):
  File "/usr/local/bin/wheel2deb", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/wheel2deb.py", line 208, in main
    debianize(args)
  File "/usr/local/lib/python3.7/dist-packages/wheel2deb.py", line 145, in debianize
    package.create()
  File "/usr/local/lib/python3.7/dist-packages/_wheel2deb/debian.py", line 252, in create
    self.install()
  File "/usr/local/lib/python3.7/dist-packages/_wheel2deb/debian.py", line 162, in install
    self.run_install_scripts()
  File "/usr/local/lib/python3.7/dist-packages/_wheel2deb/debian.py", line 372, in run_install_scripts
    cmd.run()
  File "/usr/local/lib/python3.7/dist-packages/setuptools/command/install_scripts.py", line 21, in run
    self.run_command("egg_info")
  File "/usr/local/lib/python3.7/dist-packages/setuptools/_distutils/cmd.py", line 317, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/dist.py", line 1213, in run_command
    self.set_defaults()
  File "/usr/local/lib/python3.7/dist-packages/setuptools/discovery.py", line 330, in __call__
    self._analyse_package_layout(ignore_ext_modules)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/discovery.py", line 363, in _analyse_package_layout
    or self._analyse_flat_layout()
  File "/usr/local/lib/python3.7/dist-packages/setuptools/discovery.py", line 420, in _analyse_flat_layout
    return self._analyse_flat_packages() or self._analyse_flat_modules()
  File "/usr/local/lib/python3.7/dist-packages/setuptools/discovery.py", line 426, in _analyse_flat_packages
    self._ensure_no_accidental_inclusion(top_level, "packages")
  File "/usr/local/lib/python3.7/dist-packages/setuptools/discovery.py", line 455, in _ensure_no_accidental_inclusion
    raise PackageDiscoveryError(cleandoc(msg))
setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['output', 'wheel2deb'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

The issue was found when executing tests - tests/test_wheel2deb.py::test_conversion failed

Support aarch64(arm64), manylinux2010 and manylinux2014

Can you add support for aarch64 (arm64), manylinux2010 and manylinux2014 wheels?

I need to have support for all three for to use this for my personal projects.

A few python packet that compiles to manylinux2010 on Debian based Linux are: Levenshtein, uvloop, coincurve and cryptography.

Recognizing dependencies bug

wheel2deb cannot recognize python packages dependencies, which are stored in .whl file METADATA, if package setup.cfg file does not include lines:
[bdist_wheel] universal = 1
But python dependencies METADATA in .whl file is stored correctly, can be retrieved with
pkginfo -f requires_dist $WHEEL_PATH
All wheel compilation methods checked.

wheel2deb does not create deb files

Using the example from the README results in no output/*.deb files:

$ pip3 install wheel2deb
$ pip3 wheel pytest numpy
$ wheel2deb
$ wheel2deb
 --> Unpacking 8 wheels
     attrs-22.2.0-py3-none-any.whl
     exceptiongroup-1.1.0-py3-none-any.whl
     iniconfig-2.0.0-py3-none-any.whl
     numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
     packaging-23.0-py3-none-any.whl
     pluggy-1.0.0-py2.py3-none-any.whl
     pytest-7.2.1-py3-none-any.whl
     tomli-2.0.1-py3-none-any.whl
 --> Debianizing wheel attrs-22.2.0-py3-none-any.whl
 --> Debianizing wheel exceptiongroup-1.1.0-py3-none-any.whl
 --> Debianizing wheel iniconfig-2.0.0-py3-none-any.whl
 --> Debianizing wheel numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 --> Debianizing wheel packaging-23.0-py3-none-any.whl
 --> Debianizing wheel pluggy-1.0.0-py2.py3-none-any.whl
 --> Debianizing wheel pytest-7.2.1-py3-none-any.whl
     attrs-22.2.0-py3-none-any.whl satisfies requirement attrs>=19.2.0
     python3-iniconfig==1.1.1 satisfies requirement iniconfig
     iniconfig-2.0.0-py3-none-any.whl satisfies requirement iniconfig
     python3-packaging==20.9 satisfies requirement packaging
     packaging-23.0-py3-none-any.whl satisfies requirement packaging
     python3-pluggy==0.13.0 satisfies requirement pluggy<2.0,>=0.12
     pluggy-1.0.0-py2.py3-none-any.whl satisfies requirement pluggy<2.0,>=0.12
     exceptiongroup-1.1.0-py3-none-any.whl satisfies requirement exceptiongroup>=1.0.0rc8; python_version < "3.11"
     tomli-2.0.1-py3-none-any.whl satisfies requirement tomli>=1.0.0; python_version < "3.11"
 --> Debianizing wheel tomli-2.0.1-py3-none-any.whl
     
Warnings: 0. Errors: 0. Elapsed: 3.325s.
$ ls -l output/*.deb
ls: cannot access 'output/*.deb': No such file or directory

However, directories containing intermediate formats for each package are present in output/.

$ ls -lh output/
total 32K
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-attrs_22.2.0-1~w2d0_all
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-exceptiongroup_1.1.0-1~w2d0_all
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-iniconfig_2.0.0-1~w2d0_all
drwxr-xr-x 5 jfindlay jfindlay 4.0K Feb  4 02:49 python3-numpy_1.24.1-1~w2d0_amd64
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-packaging_23.0-1~w2d0_all
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-pluggy_1.0.0-1~w2d0_all
drwxr-xr-x 5 jfindlay jfindlay 4.0K Feb  4 02:49 python3-pytest_7.2.1-1~w2d0_all
drwxr-xr-x 4 jfindlay jfindlay 4.0K Feb  4 02:49 python3-tomli_2.0.1-1~w2d0_all

wheel2deb only generates the first entrypoint

pydist.py in Wheel.entrypoints, line 124:

name, path = config.items("console_scripts")[0]

That should be a loop, because packages can have multiple entry points.

(The example that led me to dig into this was https://pypi.org/project/robotframework/ which has three, robot, rebot, and libdoc - and if you wheel2deb the deb from https://pypi.org/project/robotframework/6.0.2/ in particular, you only end up with libdoc, which is the first entry in the entry_points.txt.)

Problem with filename

Hi,
If you want to convert Brotli for example, you have a version error. I have a lot of pip wheel which have this problem.

How to SVC in dsc ?

How to develop debian source package, produced by wheel2deb ?
wheel2deb does not include setup.py to dsc. It's possible debuild edited package through chain "apt source, edit, PACKAGE and upload to repository", but wheel2deb installs src/*dist-info to dist-packages. "dist-info" directory contains metadata which is used by interpreter and IDE.
Is there any way to recompile src/*dist-info of edited source package, produced by wheel2deb ?

What is the correct format of the config file?

I've tried putting the following in a file wheel2deb.yml:

---                                                                                       
maintainer_name: 'Testuser'                                                     
maintainer_email: '[email protected]'                                            
...

.. and run wheel2deb like so: wheel2deb convert -c ./wheel2deb.yml

The result in output/ is not a .deb but a directory with debian/, entrypoints/, missing.txt and src/ in it. If I don't add the -c-flag I do get a .deb.

Python3 console_scripts file name conflict

If wheel2deb is used to build a Debian package for a project that has a console_scripts entry point, you may find yourself in a position where you cannot install a package.

For example, the pyjwt package has two existing (official) Debian packages provided: python-jwt, which installs the python2 version, and python3-jwt for the python3 version. Both of these Debian packages create a file in the /usr/bin directory. In the case of python-jwt, this is /usr/bin/pyjwt, and in the case python3-jwt, this is /usr/bin/pyjwt3.

However, when building these packages via wheel2deb, both of them end up creating /usr/bin/pyjwt. This causes problems specifically with the python3 version if the official (or wheel2deb generated) python2 version is already installed:

Unpacking python3-pyjwt (1.7.0-1~w2d0) ...
dpkg: error processing archive python3-pyjwt_1.7.0-1~w2d0_all.deb (--install):
 trying to overwrite '/usr/bin/pyjwt', which is also in package python-jwt 1.7.0-2

whl does not support python 3.1

wheel2deb
--> Unpacking 1 wheels
wheel2deb-0.5.8-py3-none-any.whl does not support python 3.1

Warnings: 1. Errors: 0. Elapsed: 0.04s.

python3 --version
Python 3.11.2

attrs==23.1.0
colorama==0.4.6
dirsync==2.2.5
Jinja2==3.1.2
MarkupSafe==2.1.3
packaging==23.1
pkginfo==1.9.6
PyYAML==6.0.1
six==1.16.0
wheel2deb==0.5.8

Debian 11 raise an error

During execution convert WHL package on Debian package raises an next error:

Traceback (most recent call last):
  File "~/log_functions/.venv/bin/wheel2deb", line 5, in <module>
    from wheel2deb import main
  File "~/log_functions/.venv/lib/python3.9/site-packages/wheel2deb.py", line 12, in <module>
    from _wheel2deb.debian import SourcePackage
  File "~/log_functions/.venv/lib/python3.9/site-packages/_wheel2deb/debian.py", line 10, in <module>
    from .depends import suggest_name, search_python_deps, normalize_package_version
  File "~/log_functions/.venv/lib/python3.9/site-packages/_wheel2deb/depends.py", line 5, in <module>
    from .apt import search_packages
  File "~/log_functions/.venv/lib/python3.9/site-packages/_wheel2deb/apt.py", line 2, in <module>
    import apt
ModuleNotFoundError: No module named 'apt'

I check python3-apt is installed but outside an virtual environment.
How to avoid to use apt package module?

Wildcard * in dependency breaks conversion

Hi guys,
thanks for this very helpful tool! I just started to work with it to allow offline installations of python packages on an embedded linux control device.
I am experiencing a crash if the wheel file contains a wildcard in a dependency string , e.g. ==7.*
This happend to me then I tried to convert uvicorn. The crash happend in line 151 of depends.py because the parsed.release variable is None in this case.
Because my Python is not good enough to fix this on my own, I rather leave it up to someone with more experience.
I was working with wheel2deb-0.5.7 and tried to convert uvicorn-0.11.1. The breaking dependencies strings are python3-click (click==7.*) and python3-websockets (websockets==8.*).

Don't debianize for pytest and numpy

We tried to create a deb package for pytest numpy the way the demo did, but nothing was generated in output/ for us after executing wheel2deb --map attrs=attr -v

`
wangweinan@wangweinan-xiaoxinpro14imh9:~ /test-wheel2deb$ pip3 wheel -i https://pypi.tuna.tsinghua.edu.cn/simple pytest numpy
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see pypa/pip#5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pytest
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c4/43/6b1debd95ecdf001bc46789a933f658da3f9738c65f32db3f4e8f2a4ca97/pytest-8.2.0-py3-none-any.whl (339 kB)
Collecting numpy
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/0f/50/de23fde84e45f5c4fda2488c759b69990fd4512387a8632860f3ac9cd225/numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.0 MB)
Collecting iniconfig (from pytest)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting packaging (from pytest)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl (53 kB)
Collecting pluggy<2.0,>=1.5 (from pytest)
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl (20 kB)
Saved ./pytest-8.2.0-py3-none-any.whl
Saved ./numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Saved ./pluggy-1.5.0-py3-none-any.whl
Saved ./iniconfig-2.0.0-py3-none-any.whl
Saved ./packaging-24.0-py3-none-any.whl
wangweinan@wangweinan-xiaoxinpro14imh9:~/test-wheel2deb$ wheel2deb --map attrs=attr -v
--> Unpacking 5 wheels
found license: iniconfig-2.0.0.dist-info/licenses/LICENSE
iniconfig-2.0.0-py3-none-any.whl does not support python 3.1
found shared lib: numpy/fft/_pocketfft_internal.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/linalg/lapack_lite.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/linalg/_umath_linalg.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_pcg64.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_bounded_integers.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/mtrand.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_mt19937.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_generator.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_common.cpython-312-x86_64-linux-gnu.so
found license: numpy/random/LICENSE.md
found shared lib: numpy/random/_sfc64.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/_philox.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/random/bit_generator.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_multiarray_tests.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_rational_tests.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_umath_tests.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_operand_flag_tests.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_struct_ufunc_tests.cpython-312-x86_64-linux-gnu.so
found shared lib: numpy/core/_simd.cpython-312-x86_64-linux-gnu.so
found license: numpy/core/include/numpy/random/LICENSE.txt
found license: numpy/ma/LICENSE
found license: numpy-1.26.4.dist-info/LICENSE.txt
found shared lib: numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so
found shared lib: numpy.libs/libquadmath-96973f99.so.0.0.0
found shared lib: numpy.libs/libgfortran-040039e1.so.5.0.0
numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl does not support python 3.1
found license: packaging-24.0.dist-info/LICENSE
found license: packaging-24.0.dist-info/LICENSE.APACHE
found license: packaging-24.0.dist-info/LICENSE.BSD
packaging-24.0-py3-none-any.whl does not support python 3.1
found license: pluggy-1.5.0.dist-info/LICENSE
pluggy-1.5.0-py3-none-any.whl does not support python 3.1
found license: pytest-8.2.0.dist-info/LICENSE
pytest-8.2.0-py3-none-any.whl does not support python 3.1

Warnings: 5. Errors: 0. Elapsed: 0.006s.
wangweinan@wangweinan-xiaoxinpro14imh9:~ /test-wheel2deb$ ls
iniconfig-2.0.0-py3-none-any.whl output pluggy-1.5.0-py3-none-any.whl
numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl packaging-24.0-py3-none-any.whl pytest-8.2.0-py3-none-any.whl
wangweinan@wangweinan-xiaoxinpro14imh9:~ /test-wheel2deb$ ls output/
wangweinan@wangweinan-xiaoxinpro14imh9:~ /test-wheel2deb$ ls output/^C
wangweinan@wangweinan-xiaoxinpro14imh9:~ /test-wheel2deb$ pip3 show wheel2deb
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see pypa/pip#5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Name: wheel2deb
Version: 0.5.8
Summary: wheel2deb: python wheel to debian package converter
Home-page: https://github.com/upciti/wheel2deb/
Author: Simon Guigui
Author-email:
License: MIT license
Location: /home/wangweinan/.local/lib/python3.12/site-packages
Requires: attrs, colorama, dirsync, jinja2, packaging, pkginfo, pyyaml, setuptools, wheel
Required-by:
wangweinan@wangweinan-xiaoxinpro14imh9:~/test-wheel2deb$

`

numpy build fails

Hello,

Thank you for this nice project.
I tried to use it for building debian/ubuntu packages in a CI/CD pipeline for ubuntu focal.
Unfortunately numpy does not work out of the box.

For me it looks like wheel2deb has some problems with manylinux2010, because
firstly, older versions of numpy (==1.18.5) where a manylinux1 wheel is downloaded when invoking pip3 wheel numpy==1.18.5 work.
Secondly, the manylinux2010 wheel works with pip (pip install numpy).

(Only tested interactively, downloading the current manylinux1-wheel and running wheel2deb works, too.)

A small example that shows my problem can be created with the following dockerfile

# Dockerfile
FROM ubuntu:focal

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    git \
        python3-pip \
        python3-apt \
        apt-file \
        dpkg-dev \
        fakeroot \
        build-essential \
        devscripts \
        debhelper \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=

# Install the newest wheel2deb package which fixes some versioning issues.
RUN python3 -m pip install -U git+https://github.com/upciti/wheel2deb.git@master#egg=wheel2deb

COPY failing_test.sh /failing_test.sh

CMD ["/usr/bin/env", "bash", "/failing_test.sh"]

and the bash script that runs the actual failing test cases:

# failing_test.sh
#!/usr/bin/env bash

python3 -m pip wheel numpy
ls *
# numpy-1.20.1-cp38-cp38-manylinux2010_x86_64.whl
mkdir output
wheel2deb
wheel2deb build
dpkg -i output/*.deb

python3 -m pip freeze
echo ""
python3 -c "import numpy" || echo "manylinux 2010 doesn't work via wheel2deb"
echo ""

# But with pip it works
apt remove -y python3-numpy
python3 -m pip install numpy==1.20.1
echo ""
python3 -c "import numpy" && echo "manylinux 2010 works via pip"
echo ""

With these two files and docker one can run

sudo docker build -t wheel2deb-err -f Dockerfile .
sudo docker run -ti wheel2deb-err:latest

to reproduce the error.

Unfortunately, numpy is going to drop support for manylinux1 soon pypa/manylinux#542 (comment) so trying to work around this problem by using the manylinux1 wheels does not work in the long run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.