Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python path to be able to do import qgis in a simple Python inter… #266

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

sbrunner
Copy link
Member

…preter

@sbrunner sbrunner added the backport 3.22 Backport the pull request to the '3.22' branch label Jan 31, 2022
Dockerfile Outdated
@@ -192,7 +192,8 @@ ENV QGIS_SERVER_LOG_STDERR=1 \
FCGID_IDLE_TIMEOUT=300 \
FCGID_IO_TIMEOUT=40 \
FILTER_ENV='' \
GET_ENV=env
GET_ENV=env \
PYTHONPATH=./usr/local/share/qgis/python/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about the leading dot in path ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, thanks :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this possible, maybe better ?
COPY --from=builder-server /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the full /usr/lib/python3/ ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arnaud-morvan
In the official Docker image they do the same kind of things:
https://github.com/qgis/QGIS/blob/master/.docker/qgis.dockerfile#L79

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, note QGIS is in loaded from /usr/lib/python3/dist-packages/qgis

$ docker run --rm -ti qgis/qgis:release-3_16 python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qgis
>>> qgis
<module 'qgis' from '/usr/lib/python3/dist-packages/qgis/__init__.py'>

@sbrunner sbrunner force-pushed the pythonpath branch 2 times, most recently from 55e13ea to 4528276 Compare January 31, 2022 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 3.22 Backport the pull request to the '3.22' branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants