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.

Installing package from different sources depending on sys_platform

See original GitHub issue

I am trying to achieve the following in a Pipefile. Notice the double bsddb3:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
bsddb3 = {version = "==6.2.6", sys_platform = "!= 'win32'"}
bsddb3 = {file = "https://download.lfd.uci.edu/pythonlibs/l8ulg3xw/bsddb3-6.2.6-cp36-cp36m-win_amd64.whl", sys_platform = "== 'win32'", platform_machine = "== 'AMD64'"}

[requires]
python_version = "3.6"

The problem with this is that I get an exception saying Duplicate keys found

bsddb3 requires installation like the above for the Windows platform. But for my Linux users they should still just install the normal bsddb3. How would I achieve this, as the above clearly does not work?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
hb-sarahcommented, Nov 15, 2018

Duplicate of #2171 for anyone who is still looking

1reaction
uranusjrcommented, Sep 6, 2018

It is not likely to be supported as-is, since TOML (Pipfile’s format) does not allow duplicated key entries. It is doable with a spec change in Pipfile, but you’ll need to go through the PEEP process for that.

The most difficult part (IMO) would be to come up with a reasonable syntax to describe this in both Pipfile and Pipfile.lock. Secondly, downloading from different sources based on platform is not really supported in Python in general, so you’d need to jump through quite some hoops to implement it.

Reading again what you want to achieve, however, I think this might actually be the wrong solution to it. The better approach is to run a private package index server to serve this package, instead of using PyPI. There are a few tools (e.g. devpi, pypiserver) allowing you to do this. You can serve bsddb3 on it, and specify this in Pipfile:

[[source]]
name = 'myindex'
url = 'http://you.index.server/simple'
verify_ssl = true

[[source]]
name = 'pypi'
url = 'https://pypi.org/simple'
verify_ssl = true

[packages]
bsddb3 = { version = '==6.2.6', index = 'myindex' }
# ...

This would allow the package to be installed using your index server instead, and you can provide suitable wheels for platforms you want to support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Picking wrong platform installing a dependency with multiple ...
I am encountering the same behavior using multiple constraints for a package using git and path dependencies based on platform. The poetry ...
Read more >
Is it possible to express a platform-specific dependency in ...
This will allow a project to work on multiple different platforms without installing dependencies that are not required for a platform that ...
Read more >
Can `extras_require` values be OS dependant?
Building a wheel is done by compiling from source. If you mean installing from source, then yes, setup.py install is separate from setup.py ......
Read more >
Install and manage packages in Visual Studio using the ...
Prerequisites; Find and install a package; Uninstall a package; Update a package; Manage packages for the solution; Package sources ...
Read more >
Packaging Guide — Spack 0.20.0.dev0 documentation
depends_on tells Spack that other packages need to be built and installed before this one. See Dependencies. Get the installation working. Your new...
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