-
I am trying to make a portable program that starts a local raster tile server. I am using the terracotta package and cx_freeze to generate an executable. The script runs fine in python, but I get these errors when I run the executable:
Where the path to the virtual environment has been replaced with {virtual_environment_path} and my username has been replaced with {USERNAME}. This is a python script that reproduces these errors:
The setup script I have been using is as follows:
The script depends on the attached file randomExample_layer.tif. I create a virtual environment and install the terracotta(0.8.3) and cx_freeze(7.2.0.dev48) packages using pip. In order to create a SQLite database for the server to use to interact with the cloud optimized raster, I run this command:
I was able to solve one error by commenting out some of the source code in the terracotta package that was unnecessary for my application. I replaced lines 15-21 in terracotta/cmaps/get_cmaps.py with just line 21.
was replaced with
The errors shown at the beginning of the post are not thrown immediately after the executable is run; a separate process must try to interact with the server. After the server is running, I run this command in another command prompt instance to test whether the server is serving tiles properly:
I’m using Python 3.12.4 on Windows 11. Please let me know if there is any other information that would be helpful in diagnosing this issue. I have dug around in the source code for the different packages involved in the error and have been unsuccessful in isolating the issue. Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I spent some more time digging into this and found a solution. I guess the concurrent.futures module used by terracotta has similar requirements to the multiprocessing module in that |
Beta Was this translation helpful? Give feedback.
I spent some more time digging into this and found a solution. I guess the concurrent.futures module used by terracotta has similar requirements to the multiprocessing module in that
multiprocessing.freeze_support()
must be included in the main module as described here:
https://cx-freeze.readthedocs.io/en/stable/faq.html#multiprocessing-support