question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to preserve the order in which packages are installed?

See original GitHub issue

I’m trying to create a reproducible install of my window manager using pipenv and I bump into this:

Better explanation now:

What a mess. 🎉

_Originally posted by @ramnes in https://github.com/qtile/qtile/issues/994#issuecomment-497984551_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
uranusjrcommented, Oct 10, 2020

Thanks for the detailed write-up!

From my understanding to the description and the context mentioned above, the main problem is that cairocffi only needs xcffib when it is installed with [xcb]. So it does not want to declare the build dependency unconditionally since it is not needed when [xcb] is not requested.

In that case, I believe the general recommendation is to split the part that depends xcffib into a separate package, and make [xcb] add that package instead. So

  • cairocffi-xcb declares dependency on xcffib both build-time and run-time.
  • cairocffi does not declare dependency on xcffib anywhere directly, only on cairocffi-xcb if [xcb] is requested.

This may make the project structure more complex, but fits better into the modern Python packaging architecture, and allows cairocffi (and the subproject cairocffi-xcb) to have prebuilt wheels, since the compilation dependency no longer needs to be detected on install-time. Extras in Python packaging are designed to specify optional run-time dependencies, not feature switches (although they are quite often [mis-]used as such).

If you make an anology to pure-Python packages, all Python code in a project are always the same no matter. The same goes with compiled code—the compiled binary should be the same regardless of the extras. If you want to add code only when an extra is supplied, those code should be in the package specified as optional requirements, not in the main project.

0reactions
CharStringcommented, Oct 10, 2020

To be very specific: I’m trying to use pipenv to have a reproducible installation of qtile, my window manager, including my config. qtile uses cairocffi to draw on an XCB surface. That is not core to cairocffi, but an extra: so “I want it to be” installed as cairocffi[xcb].

cairocffi[xcb] uses xcffib as a binding to XCB (a C library). In order to build with xcffib, cairocffi[xcb] needs xcffib to be present at build time as well as runtime. extras_require takes care of the latter, but as I understand it, that doesn’t take care of the build time requirement.

My first naïve try was

pipenv install xcffib
pipenv install cairocffi[xcb]
pipenv install qtile

That works the first time (and subsequent once when cached wheels are used), but not on a different machine when everything gets installed in arbitrary order from the Pipfile.lock

I’ve tried making a shim package that I can install with pipenv install . that depends on xcffib as a build time requirement and on xcffib and cairocffi[xcb]. I tried with setuptools.setup(setup_requires=['xcffib'], install_requires=['cariocffi[xcb]']) in a setup.py and with xcffib and setuptools in the [build-system] section in pyproject.toml and cairo in the setup.cfg

But as I understand it, the cairocffi[xcb] build gets done in isolation from my shim package, so xcffib isn’t present there at build time.

@tych0 please correct me if I am misrepresenting the situation. The only thing I know about cffi is that it’s the preferred way of c-binding of pypy as it doesn’t make any assumptions about reference counting, something the CPython c-api does do. I’ve never used it directly myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keep order of installation in pip freeze - Stack Overflow
Is there a way to ensure that pip freeze > requirements.txt keeps the order in which the packages were installed?
Read more >
How to view all the packages installed in Ubuntu in the order ...
To see the list the installed packages sorted by install date/time using the following command: grep " install " /var/log/dpkg.log.
Read more >
How can I get a list of packages that I have installed using apt ...
You can list installed package using apt using the following command: apt --installed list. Edit. Use the following command to list installed package...
Read more >
NuGet Package Restore | Microsoft Learn
To promote a cleaner development environment and to reduce repository size, Package Restore makes all of a project's dependencies available ...
Read more >
7.1 install cannot find packages to install, must configure ... - IBM
Tivoli Storage Manager Installation Manager cannot find packages to install. In order to access packages, you must configure a repository connection and can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found