Wheels and app deployment

Hi there,
A quick question about wheels, what is the best setup to use once I am going to publish the application?

I read the paragraph about wheels in the documentation
If I try to use the solution advised (the actual link you have in the documentation doesn’t work) but also from the Christoph Gohlke website is not possible to get the direct link to download the package.

This is my folder setup
image
and the requirements file
image

Is this the correct setup?
Thanks.
Mirco

Hi Mirco,

I don’t have too much experience with using local wheel files myself, but it looks to me like your example should work. Have you tried this approach in your development workspace? In the meantime, I have asked my colleagues about your question as well, so we will get back you.

I didn’t test yet because I was interested to understand if this is the correct solution or better to point to the website and download from there, but the links won’t work.

Hi Mirco,

It seems like Gohlke’s website has updated the way wheels are retrieved. This causes direct URLs to fail, so I would recommend downloading the wheels manually and adding them in your repo like in your example. We have to update the example in the docs, thanks for noticing.

Keep in mind to make use of “environment markers” as stated in the docs, since the published application runs on Linux instead of Windows.

It is also possible to move the wheels to a separate folder if you like:

my-app
├── app
├── local-whls
│      ├── Fiona...
│      └── GDAL...
├── requirements.txt
└── viktor.config.toml

and refer to them in requirements.txt ./local-whls/Fiona...

1 Like

Perfect!
Regarding the env markers means we have to specify the platform in the requirements file, such as:
./local-whls/Fiona... ; platform_system == "Linux"
Thanks for the answer!

So finally the time arrived for publishing the application and…

folder structure
image

requirements

Am I missing something @khameeteman?

I expect it currently fails because a Windows wheel is being installed in a Linux (production) environment . The environment markers should be changed a bit, you would want to use the local wheel in case of Windows, and use the public package (fiona) in case of Linux:

./local-whls/GDAL…; platform_system == “Windows”
./local-whls/Fiona…; platform_system == “Windows”
fiona==1.8.21; platform_system != “Windows”

@khameeteman just update the requirements have you suggested I still have the same error?

Did you copy-paste my reply? When I do, I also get an error because the quotes seem invalid. Could you retry using this?

./local-whls/GDAL…; platform_system == "Windows"
./local-whls/Fiona…; platform_system == "Windows"
fiona==1.8.21; platform_system != "Windows"

Amazing, that was the problem sorry I didn’t notice!
Problem solved. Thanks.
How do I know which wheels are already installed in production?

When publishing, all requirements will be reinstalled

Hi Kevin, long time no see :wink:

I tried the same but unfortunately I can’t publish the app with the proposed solution. Installing and starting the app locally works fine on Windows though. I tried replacing Windows by Linux but it didn’t work either.
Publishing basically leads to an error: FileNotFoundError: [Errno 2] No such file or directory: ‘gdal-config’

my-app
├── app
├── local-wheels
│ └── GDAL-3.8.2…whl
├── requirements.txt
└── viktor.config.toml

viktor==14.7.0
./local-wheels/GDAL-3.8.2-cp310-cp310-win_amd64.whl; platform_system == "Windows"
ra2ce@git+https://github.com/MatthiasHauthDeltares/ra2ce
plotly==5.3.1
mapclassify==2.4.3
branca
folium