Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show useful warning when there is no wgpu-native binary #298

Closed
Tracked by #387
almarklein opened this issue Nov 2, 2022 · 5 comments · Fixed by #376
Closed
Tracked by #387

Show useful warning when there is no wgpu-native binary #298

almarklein opened this issue Nov 2, 2022 · 5 comments · Fixed by #376

Comments

@almarklein
Copy link
Member

With an older pip, the src distribution would be installed, which does not contain wgpu-native. Would be nice to warn about this.

  • In the library, when the library is attemped to be loaded.
  • Maybe also when the sdist is installed?

Note that in rare situations the sdist could be installed intentionally, with the user providing the wgpu-native binary.

@Korijn
Copy link
Collaborator

Korijn commented Nov 2, 2022

Note that in rare situations the sdist could be installed intentionally, with the user providing the wgpu-native binary.

Although rare, I remember you originally presenting this as a feature. But maybe in hindsight it never applies when people install from pip...

@FirefoxMetzger
Copy link
Contributor

With an older pip, the src distribution would be installed

It would also be installed on python versions that aren't covered by the available binaries, e.g. musllinux.

Maybe also when the sdist is installed?

This could be nice, but I think it would get swamped by the log since it would be installed alongside other dependencies that downstream has. I fear that users would simply miss this, run a program, see that it breaks, and then maybe come back to the install log (if they even bothered to store it).

A runtime warning/error sounds like an excellent idea though; however, I think we already have that since the library raises an exception if the binary is not present 😄

Note that in rare situations the sdist could be installed intentionally, with the user providing the wgpu-native binary.

A question to ask is if we can reasonably expect the binary to be present at install/setup time. If so, we could simply check that (while respecting WGPU_LIB_PATH) and raise otherwise.

Another thought would be to ask users who want a source install to use

pip install git+https://github.com/pygfx/wgpu-py.git

Although rare, I remember you originally presenting this as a feature. But maybe in hindsight it never applies when people install from pip...

Doesn't pypi keep download statistics of the different versions? I don't know how granular they are, but I would not be surprised to find that we can go and check how often the source distribution is actually downloaded.

@almarklein
Copy link
Member Author

A runtime warning/error sounds like an excellent idea though; however, I think we already have that since the library raises an exception if the binary is not present 😄

Yeah, but I mean it could be improved to e.g. show a tip to update pip.

Another thought would be to ask users who want a source install to use

Interesting! So only wheels on pypi, and if you had a successful install with pip, it should just work.

Let's explore scenario's:

  • User has an OS and Python version supported by wheels: all is fine.
  • User is on Linux with an older pip, so wgpu won't install, user checks installation instructions and updates pip.
  • User is on unsupported OS. Probably someone who know what he's doing. wgpu won't install via pip. Checks installation instructions and finds that he must install from GH.

I think it will improve the installation flow for most users. However, I think that last person might have a strong opinion about us not putting the source dist on Pypi :) @Korijn thoughts?

Doesn't pypi keep download statistics of the different versions?Doesn't pypi keep download statistics of the different versions?

I don't see any stats in the Pypi management UI.

@FirefoxMetzger
Copy link
Contributor

I don't see any stats in the Pypi management UI.

That data lives on Google BigQuery and pypi documents this here.

I just checked and you can indeed get the information on which file was downloaded when. Here is a sample record of me from yesterday downloading the source distribution of wgpu on WSL (lol, found it by chance).

2022-11-02 08:15:16.000000 UTC,SE,/packages/3b/05/01e85636aadf4bc3837a20e6fd5b347cc801b1c05348e1c84eaa02e80c80/wgpu-0.8.2.tar.gz,wgpu,"{
  ""file"": {
    ""filename"": ""wgpu-0.8.2.tar.gz"",
    ""project"": ""wgpu"",
    ""version"": ""0.8.2"",
    ""type"": ""sdist""
  }
}","{
  ""details"": {
    ""installer"": {
      ""name"": ""pip"",
      ""version"": ""20.0.2""
    },
    ""python"": ""3.8.10"",
    ""implementation"": {
      ""name"": ""CPython"",
      ""version"": ""3.8.10""
    },
    ""distro"": {
      ""name"": ""Ubuntu"",
      ""version"": ""20.04"",
      ""id"": ""focal"",
      ""libc"": {
        ""lib"": ""glibc"",
        ""version"": ""2.31""
      }
    },
    ""system"": {
      ""name"": ""Linux"",
      ""release"": ""5.10.102.1-microsoft-standard-WSL2""
    },
    ""cpu"": ""x86_64"",
    ""openssl_version"": ""OpenSSL 1.1.1f  31 Mar 2020"",
    ""setuptools_version"": ""44.0.0"",
    ""rustc_version"": null
  }
}",TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256

Here is a quick pivot of this month's downloads by file type (columns) and installer (rows). Note that bantersnatch is a known pypi mirror and the blank line is an unknown installer. Browser is probably me manually downloading wheels to inspect them while figuring out why I am not getting binaries on WSL.

image

I would run this for the past quarter and/or year so that we can make a more informed decision, but I am out of free quota for this month already 😅 (it's a big table ... the 1TB quota feels like a drop in the bucket)

@Korijn
Copy link
Collaborator

Korijn commented Jan 26, 2023

Now that I've seen #331 I would say you just need to add another case to the same function and we could close this issue:

  • if linux and pip<20.3 recommend to upgrade pip and then reinstall wgpu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants