App installation stuck at building polars wheel

Hi,

I have problems installing an app that uses the python package Polars. I’m using the ‘venv’ option.

I’m using Windows and was therefore required to install Cargo, the Rust package manager. In order to install this I needed to install the Visual Studio Build tools, so I did. After installing these requirements no errors occured. But when trying to install the app the installation gets stuck at building the wheel for polars. I did not time how long but at least half an hour.

Any tips on solving this issue?

image

My SDK version is 12.10.0

UPDATE 15:53
After changing to the right version of Polars (in requirements.txt) I got this error. I tried adding setuptools to requirements.txt but it was not successful. Any ideas?

Thanks,
Daniël

1 Like

following this thread as well
Additional context: Polars is a DataFrame library py-polars · PyPI

1 Like

Hi Daniel,

What Python version are you using? I have trouble reproducing your error (with 3.7 and 3.10). Sometimes it can also help to upgrade your pip version to the latest

Hi Raoul,

Thanks for your reply. I’m using Python 3.7. I think you’re right regarding the pip version but it seems that when I install the app a new virtual environment is created (that is stated by the CLI) which probably uses a version of pip resulting in this error. When I create an environment with pip 21.3.1 installing polars is successful. However, that environment is not used when installing the app, instead the CLI creates a new one (and overwrites mine) and fails to install polars.

So my guess is that it doesn’t matter what I do, the CLI chooses the version of pip it uses. Do you know if this is true? Is it possible to use another version of pip when using the cli to install an app with the ‘venv’ option?

As a workaround I excluded polars from the requirements.txt, upgraded the pip version of the virtual environment and installed polars with pip. This works but it would be nice if there is an alternative for which this isn’t needed.

The version of pip that is installed with the virtual environment is controlled by the Python built-in package ensurepip. This means that the pip version is actually dependent on the Python version. You can check which pip version will be bootstrapped into the virtual environment by doing the following:

import ensurepip
ensurepip.version()

For my Python version (3.7.9) this results in 21.2.4.

The easiest way to fix the problem for you that doesn’t require a workaround is to upgrade your Python version. What is the complete Python version you are using now (including patch no.)? Interested to see if I can reproduce with the exact Python version.

Coming back to the original problem, for some reason pip falls back to to a build from source instead of using the wheels provided by polars on PyPi. When looking at the available files on PyPi (polars · PyPI) there seems to be a discrepancy between the name of the wheel and the contents of the metadata of the wheel. The name suggests that a built distribution is only available for Python 3.6, however, the metadata states that the Python version should be >=3.7. I do not know for sure if this can cause any issues, but it might be good to open an issue for this on the polars repo.

1 Like

Also keep in mind that this approach doesn’t work when you publish your app. During the publication process only the packages defined in requirements.txt are installed.