chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
806 stars 132 forks source link

Update to Latest Version of PIP to Fix Issue With Paths to Local Wheels on Windows #1152

Closed rbebb closed 3 months ago

rbebb commented 4 months ago

Chaquopy version

14.0.2 and 15.0.1 affected

Describe your issue

When using Chaquopy's current version of PIP (20.1), builds that use wheels stored in a local package index cannot be built on Windows. Here is the relevant issue on PIP's GitHub repo. The issue is fixed starting in PIP 21.2 (see this commit), but updating to the latest version is probably the best move.

Here are some posts where other's experienced/explained the same error on other projects:

  1. https://github.com/chipsalliance/fasm/issues/72
  2. https://github.com/conda/conda/issues/10815#issuecomment-890093568

Here's an example that would cause the issue to occur:

pip {
    options "--index-url", "file://$rootDir/pypi/dist"
...
}
mhsmith commented 3 months ago

Sorry for the slow reply. I can confirm that the above example produces this error:

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: file://C:\Users\smith\cygwin\git\chaquo\chaquopy\server\pypi\pkgtest/pypi/dist
[...]
  File "C:\Users\smith\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 174, in port
    raise ValueError(message) from None
ValueError: Port could not be cast to integer value as '\\Users\\smith\\cygwin\\git\\chaquo\\chaquopy\\server\\pypi\\pkgtest'

However, if you remove the file:// prefix, then it works fine.

This area of pip has always been poorly-documented, so I'm not sure if this workaround would work with a normal copy of pip, or if it's the result of some Chaquopy-specific patches.

We're aware that being stuck on an old version of pip is causing various problems, and we're planning to improve this later in 2024. Meanwhile, since this particular issue isn't specific to Chaquopy, I'll close it.