Closed yamamoto-ryuzo closed 2 years ago
sudo su
sudo apt autoremove
apt -y upgrade
apt update apt -y uninstall python3-pip apt -y install python3-pip pip install --upgrade pip
pip uninstall -y pyzmq pip install --no-cache-dir pyzmq
sudo apt-get install libzmq3-dev apt -y install libzmq5
pip uninstall -y py-qgis-server pip install --no-cache-dir py-qgis-server
Try the following
1.4.3. Running Custom Applications You need to tell your system where to search for QGIS libraries and appropriate Python modules if they are not in a well-known location - otherwise Python will complain:
import qgis.core
ImportError: No module named qgis.core
This can be fixed by setting the PYTHONPATH environment variable. In the following commands,
on Linux: export PYTHONPATH=/
on Windows: set PYTHONPATH=c:\
on macOS: export PYTHONPATH=/
Now, the path to the PyQGIS modules is known, but they depend on the qgis_core and qgis_gui libraries (the Python modules serve only as wrappers). The path to these libraries may be unknown to the operating system, and then you will get an import error again (the message might vary depending on the system):
import qgis.core ImportError: libqgis_core.so.3.2.0: cannot open shared object file: No such file or directory Fix this by adding the directories where the QGIS libraries reside to the search path of the dynamic linker:
on Linux: export LD_LIBRARY_PATH=/
on Windows: set PATH=C:\
These commands can be put into a bootstrap script that will take care of the startup. When deploying custom applications using PyQGIS, there are usually two possibilities:
require the user to install QGIS prior to installing your application. The application installer should look for default locations of QGIS libraries and allow the user to set the path if not found. This approach has the advantage of being simpler, however it requires the user to do more steps.
package QGIS together with your application. Releasing the application may be more challenging and the package will be larger, but the user will be saved from the burden of downloading and installing additional pieces of software.
The two deployment models can be mixed. You can provide a standalone applications on Windows and macOS, but for Linux leave the installation of GIS up to the user and his package manager.
This is clearly a problem with your installation.
You can refer to how we install qgis in the docker image on the (qgis base image)[https://github.com/3liz/docker-qgis-platform/blob/master/Dockerfile.ubuntu]
Do not rely on the default Qgis packages but rather those provided at https://qgis.org/
Note that latest release version of Qgis (3.22) will not work on ubuntu 18.04 because of obsolete version of dependencies (i.e gdal). You should consider using the docker images.
Thank you very much. It seems to be difficult for my ability to explain clearly to many people. This introduction of speedup is limited to multi-threading of GIMAPSERVER. In the future, I will try to make a page to introduce QGIS project settings that can speed up QGIMAPSERVER, which is the bottleneck of speedup.
Closing stalled issue.
Is this error due to a problem with my installation?
Traceback (most recent call last): File "/usr/local/bin/qgisserver", line 33, in
sys.exit(load_entry_point('py-qgis-server==1.7.12', 'console_scripts', 'qgisserver')())
File "/usr/local/bin/qgisserver", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/usr/local/lib/python3.9/site-packages/pyqgisserver/server.py", line 22, in
from .runtime import run_server
File "/usr/local/lib/python3.9/site-packages/pyqgisserver/runtime.py", line 36, in
from .qgspool import create_poolserver
File "/usr/local/lib/python3.9/site-packages/pyqgisserver/qgspool.py", line 33, in
from .qgsworker import QgsRequestHandler
File "/usr/local/lib/python3.9/site-packages/pyqgisserver/qgsworker.py", line 23, in
from qgis.PyQt.QtCore import Qt, QBuffer, QIODevice, QByteArray
ModuleNotFoundError: No module named 'qgis'