thousands-plumber-33255
12/19/2022, 9:56 PMthousands-plumber-33255
12/20/2022, 9:49 AMthousands-plumber-33255
12/21/2022, 8:13 AMcurved-television-6568
12/21/2022, 3:09 PMhappy-kitchen-89482
12/21/2022, 3:51 PMhappy-kitchen-89482
12/21/2022, 3:51 PMhappy-kitchen-89482
12/21/2022, 3:52 PMhappy-kitchen-89482
12/21/2022, 3:53 PMhappy-kitchen-89482
12/21/2022, 3:55 PMhappy-kitchen-89482
12/21/2022, 3:56 PMWhen I package the application code as PEX and add it to the docker image I am not facing any import issues.
that is interesting! I would have expected the same issue.happy-kitchen-89482
12/21/2022, 3:57 PMthousands-plumber-33255
12/21/2022, 7:41 PMthousands-plumber-33255
12/21/2022, 7:42 PMapt-get install python3-qgis
, look for where it is installed and then add it as a local requirement?thousands-plumber-33255
12/21/2022, 8:49 PM/usr/lib/python3/dist-packages/qgis
, can I add this as a dependency?curved-television-6568
12/21/2022, 8:53 PMhappy-kitchen-89482
12/21/2022, 9:12 PMthousands-plumber-33255
12/21/2022, 10:15 PMthousands-plumber-33255
12/21/2022, 10:17 PMthousands-plumber-33255
12/21/2022, 10:17 PMthousands-plumber-33255
12/21/2022, 11:12 PMpyqgis
in the root of my repo, added it to root_patterns
and run ./pants tailor
on it. Still, my tests throws an import error:
__ ERROR collecting services/qgis/tests/test_add_spatial_analysis_project.py ___
ImportError while importing test module '/tmp/pants-sandbox-W4B4LD/services/qgis/tests/test_add_spatial_analysis_project.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
services/qgis/tests/test_add_spatial_analysis_project.py:20: in <module>
from api import add_spatial_analysis_project
services/qgis/api/add_spatial_analysis_project.py:12: in <module>
from qgis.core import QgsApplication, QgsProject, QgsVectorLayer, QgsCoordinateReferenceSystem, QgsRasterLayer, QgsPalLayerSettings, QgsTextFormat, QgsVectorLayerSimpleLabeling, QgsLayerTreeGroup
pyqgis/qgis/__init__.py:78: in <module>
from qgis.PyQt import QtCore
pyqgis/qgis/PyQt/QtCore.py:24: in <module>
from PyQt5.QtCore import *
E ModuleNotFoundError: No module named 'PyQt5.QtCore'
When I check the sandbox, it should be there:
vscode ➜ /tmp/pants-sandbox-W4B4LD $ ls -la pyqgis/PyQt5/
total 1536
drwxr-xr-x 3 vscode vscode 4096 Dec 21 22:56 .
drwxr-xr-x 4 vscode vscode 4096 Dec 21 22:56 ..
-rw-r--r-- 1 vscode vscode 156355 Dec 21 22:56 Qsci.pyi
-rw-r--r-- 1 vscode vscode 407093 Dec 21 22:56 QtCore.pyi
-rw-r--r-- 1 vscode vscode 422646 Dec 21 22:56 QtGui.pyi
-rw-r--r-- 1 vscode vscode 20230 Dec 21 22:56 QtPrintSupport.pyi
-rw-r--r-- 1 vscode vscode 509967 Dec 21 22:56 QtWidgets.pyi
-rw-r--r-- 1 vscode vscode 27660 Dec 21 22:56 QtXml.pyi
-rw-r--r-- 1 vscode vscode 960 Dec 21 22:56 __init__.py
drwxr-xr-x 2 vscode vscode 4096 Dec 21 22:56 __pycache__
What is missing here?thousands-plumber-33255
12/22/2022, 9:26 AMpython_tests(
environment="linux_docker",
extra_env_vars=["PEX_INHERIT_PATH=prefer"]
)
I am getting:
__ ERROR collecting services/qgis/tests/test_add_spatial_analysis_project.py ___
ImportError while importing test module '/pants-sandbox/pants-sandbox-5JV0Aj/services/qgis/tests/test_add_spatial_analysis_project.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
services/qgis/tests/test_add_spatial_analysis_project.py:20: in <module>
from api import add_spatial_analysis_project
services/qgis/api/add_spatial_analysis_project.py:12: in <module>
from qgis.core import QgsApplication, QgsProject, QgsVectorLayer, QgsCoordinateReferenceSystem, QgsRasterLayer, QgsPalLayerSettings, QgsTextFormat, QgsVectorLayerSimpleLabeling, QgsLayerTreeGroup
E ModuleNotFoundError: No module named 'qgis'
=============================== warnings summary ===============================
services/qgis/api/add_spatial_analysis_project.py:65
/pants-sandbox/pants-sandbox-5JV0Aj/services/qgis/api/add_spatial_analysis_project.py:65: DeprecationWarning: invalid escape sequence \d
regex_pattern = f'qgis/({AWS_OBJECT_PREFIX} analysis [-\d\w]+\.zip)'
services/qgis/api/add_spatial_analysis_project.py:79
/pants-sandbox/pants-sandbox-5JV0Aj/services/qgis/api/add_spatial_analysis_project.py:79: DeprecationWarning: invalid escape sequence \d
regex_pattern = f'qgis/{AWS_OBJECT_PREFIX} analysis ([-\d\w]+)\.zip'
-- Docs: <https://docs.pytest.org/en/stable/how-to/capture-warnings.html>
- generated xml file: /pants-sandbox/pants-sandbox-5JV0Aj/services.qgis.tests.test_add_spatial_analysis_project.py.xml -
=========================== short test summary info ============================
ERROR services/qgis/tests/test_add_spatial_analysis_project.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 2 warnings, 1 error in 0.27s =========================
Ignoring the following environment variables in Pex venv mode:
PEX_INHERIT_PATH=prefer
✕ services/qgis/tests/test_add_spatial_analysis_project.py failed in 0.72s.
Looks like this env is just getting ignoredthousands-plumber-33255
12/31/2022, 8:29 AMbitter-ability-32190
12/31/2022, 1:10 PMthousands-plumber-33255
01/02/2023, 8:02 AMPEX_INHERIT_PATH=prefer
. But it did not take any effect due to that error. Can this be solved somehow? I could not find anything to not run it in the venv mode.happy-kitchen-89482
01/02/2023, 8:05 AMthousands-plumber-33255
01/02/2023, 8:07 AM./pants test services/qgis/tests/test_add_spatial_analysis_project.py
thousands-plumber-33255
01/02/2023, 8:10 AMruntime_package_dependencies
. Is that something that makes sense?bitter-ability-32190
01/02/2023, 12:20 PMthousands-plumber-33255
01/02/2023, 1:43 PMbitter-ability-32190
01/02/2023, 1:59 PMbitter-ability-32190
01/02/2023, 2:00 PMthousands-plumber-33255
01/02/2023, 2:02 PMthousands-plumber-33255
01/02/2023, 2:02 PMbitter-ability-32190
01/02/2023, 2:06 PMdist-packages
)thousands-plumber-33255
01/02/2023, 2:12 PMsys.path.append("/usr/lib/python3/dist-packages/qgis")
?bitter-ability-32190
01/02/2023, 3:29 PM