[Qgis-user] Running QGis on a machine with Python 3.11 and PyCharm ?

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Mon Jun 12 01:17:48 PDT 2023


Hi,

if you did anything to your PYTHONPATH or other system variables, revert 
and restore how it was before.

On Windows QGIS comes with its own Python interpreter, environment etc 
etc. If you want to develop QGIS things, you should use that. If you use 
a separate Python installation you will have lots of pain and confusion.

In Pycharm simply set the project interpreter to the python-qgis.bat or 
python-qgis-ltr.bat file in your QGIS installation's "bin" directory 
(e.g. "C:\Program Files\QGIS\bin\python-qgis-ltr.bat"). This will 
magically make sure everything works.

The internet is full of ancient, random and poorly compiled batch 
scripts which really shouldn't be used anymore.

Cheers, Hannes

Am 09.06.23 um 18:11 schrieb Toussaint OTTAVI via QGIS-User:
> Hi,
>
> I'm new to QGis. I'm trying to install latest version (3.28.7 LTR) on 
> my machine. It does not run. The startup window shows during a few 
> seconds, then, nothing.
>
> I tried several older versions. None of them wants to start. The 
> exception is 3.14, which starts, and works perfectly.
>
> On my machine, I already have a Python 3 installed (currently, 
> 3.11.1), on absolute path C:\Python, PYTHONPATH system variable 
> pointing to it, and system path, too. I also have PyCharm installed. I 
> think this may be the cause of my problem. I noticed the included 
> interpreter (C:\Program Files\QGIS 3.28.7\bin\python.exe) does not 
> start at all, with Python error :
>    File "C:\Python\Lib\io.py", line 54, in <module>
>    ImportError: cannot import name 'text_encoding' from 'io' (unknown 
> location)
>
> If I understand well, I'll have to write a customized startup script, 
> with correct path (not pointing to my c:\python\lib) so that QGis can 
> start using the included Python interpreter (and not my system-wide 
> one). But I didn't find how to achieve that.
>
> Later, I think I'll have to write some QGis Python code. Then, I'll 
> need to run it in "developer" mode : being able to put the source code 
> in a git repository, edit the code in PyCharm, and run it. Any clues 
> are welcome.
>
> Thank you in advance. Kind regards
>
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Johannes Kröger / GIS-Entwickler/-Berater

---------------------------------------------
Aufwind durch Wissen!
Web-Seminare und Online-Schulungen
bei derwww.foss-academy.com
---------------------------------------------

WhereGroup GmbH
c/o KK03 GmbH
Lange Reihe 29
20099 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroeger at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230612/59e5c56d/attachment.htm>


More information about the QGIS-User mailing list