[Qgis-user] spatial analysis toolbox - testing for autocorrelation

Francesca Parente francescaparente.rse at gmail.com
Tue Aug 29 06:45:02 PDT 2023


Hello Thayer,

thank you so much again for your patience and the specific inputs you
provided, I finally made it and the plugin works now!
(I had to put the process in stand by for a few days as it was driving me
crazy: at a certain point it looked like geopandas was imported, but the
plugin gave me error anyway -_-)

Many thanks to everyone else in this list for the precious support you
offer, spending so much time and effort in sharing your advices.
Have a very good day!
Best,
Francesca

Il giorno ven 18 ago 2023 alle ore 22:29 Thayer Young via QGIS-User <
qgis-user at lists.osgeo.org> ha scritto:

> Hi Francesca,
>
> This is the same error as you had before, just for a different python
> module, mgwr this time. The "Spatial Analysis Toolbox" page in the Plugin
> Manager lists the following dependencies: pandas, geopandas, libpysal,
> esda, mgwr.
>
> Thank you for your patience. You can ignore my previous answers. I have
> tested the following procedure on a fresh install of Windows 11:
>
> 1) Inside the folder for QGIS 3.28.9 Firenze that you just installed.
> 2) Right click on the 'OSGeo4W Shell' alias.
> 3) Select 'Run as administrator'
>     a) This will bring up a black window with the label 'Administrator:
> OSGeo4W Shell'
>     b) At the top of the black part it should say something like:
>             run o-help for a list of available commands
>             C:\Program Files\QGIS 3.32.1>
>      c) to the right of the > there should be a blinking underscore
> character '_'
> 4) Then type:    python    and press enter.
> 5) Several lines of text should appear below this, like:
>          Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC
> v.1928 64 bit (AMD64)] on win32
>          Type "help", "copyright", "credits" or "license" for more
> information.
>          >>>
> 6) At the blinking cursor type (do not type the >>>):
>          >>> import pandas
>    a) press enter
> 7) Nothing should happen except that in a few seconds the cursor will move
> to a new line
>          >>>
>    a) This means that pandas is already installed
> 8) At the blinking cursor type (do not type the >>>):
>          >>> import geopandas
>    a) This should bring up a long error in red text.
>    b) this means that geopandas is not installed. (It is installed in Lima
> not Firenze.)
> 10) Do the same with the rest of the three modules to see if they are
> installed:
>              import libpysal
>              import esda
>              import mgwr
>     a) in my experience they are not (they are installed.
> 11) Then exit python by typing:
>               exit()
> 12) This brings you back to:
>             C:\Program Files\QGIS 3.32.1>
> 13) Where for each one of the modules that are not installed you want to
> type:
>             pip install geopandas --user
>             pip install libpysal --user
>             pip install esda --user
>             pip install mgwr --user
>   a) it should take a few seconds for some of these, but when they are
> done, after each one of there should be a lot of white text followed by
> something like:
>             Successfully installed platformdirs-3.10.0
> python-dateutil-2.8.2 soupsieve-2.4.1
>             [notice] A new release of pip is available: 23.1.2 -> 23.2.1
>             [notice] To update, run: python3.exe -m pip install --upgrade
> pip
>             C:\Program Files\QGIS 3.32.1>
>    b) there should not be lines of red text errors.
> 14) Restart QGIS 3.28.9 Firenze
> 15) Go to Manage and Install Plugins and click on 'Installed Plugins' and
> turn on the check mark next to 'Spatial Analysis Toolbox'.
>    a) It should take a few seconds with the rotating circle and the check
> mark will be checked.
>    b) If not you will get a similar error as when you installed the plugin.
>
> This video shows these steps, but I have made them specific to your needs:
> https://www.youtube.com/watch?v=Bm3qyh1fO-M
>
> -Thayer
>
>
>
> On Friday, August 18, 2023 at 04:05:57 AM EDT,
> qgis-user-request at lists.osgeo.org <qgis-user-request at lists.osgeo.org>
> wrote:
> > Date: Fri, 18 Aug 2023 10:04:40 +0200
> > From: Francesca Parente <francescaparente.rse at gmail.com>
> > To: Thayer Young <thayeray at yahoo.com>
> > Cc: "qgis-user at lists.osgeo.org" <qgis-user at lists.osgeo.org>
> > Subject: Re: [Qgis-user] spatial analysis toolbox - testing for
>     autocorrelation
> > Message-ID:
>     <CAA8dZSdaXBRfAVc7BPbC4V=C9qrs-4kdx+E3XD3Qo9htQjwBMg at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
>
> > Thanks again Thayer,
> > I tried the first option and updated to 3.28.9 Firenze, but when I run
> it I
> > get the following multiple errors (I don't know if they're the same kind
> > you were getting with OSGeo4W installer):
>
> *2023-08-18T09:43:26    CRITICAL    Traceback (most recent call last):
>           File
> "C:\PROGRA~1/QGIS32~1.9/apps/qgis-ltr/./python\qgis\utils.py", line 423, in
> _startPlugin              plugins[packageName] =
> package.classFactory(iface)              File
>
> "C:\Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\__init__.py",
> line 36, in classFactory              from .spatialanalysistoolbox import
> SpatialAnalysisToolboxPlugin              File
> "C:\PROGRA~1/QGIS32~1.9/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
> _import              mod = _builtin_import(name, globals, locals, fromlist,
> level)              File
>
> "C:\Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\spatialanalysistoolbox.py",
> line 38, in              from .spatialanalysistoolbox_provider import
> SpatialAnalysisToolboxProvider              File
> "C:\PROGRA~1/QGIS32~1.9/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
> _import              mod = _builtin_import(name, globals, locals, fromlist,
> level)              File
>
> "C:\Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\spatialanalysistoolbox_provider.py",
> line 35, in              from .algorithms.GWR_ import GWR_
> File "C:\PROGRA~1/QGIS32~1.9/apps/qgis-ltr/./python\qgis\utils.py", line
> 888, in _import              mod = _builtin_import(name, globals, locals,
> fromlist, level)              File
>
> "C:\Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\algorithms\GWR_.py",
> line 26, in              from mgwr.gwr import GWR              File
> "C:\PROGRA~1/QGIS32~1.9/apps/qgis-ltr/./python\qgis\utils.py", line 888, in
> _import              mod = _builtin_import(name, globals, locals, fromlist,
> level)            ModuleNotFoundError: No module named 'mgwr'*
>
> Also only now I get the sense that "python prompt" refers to an app called
> Command Prompt, right? Apologies for any obvious question asked!
>
> Maybe I'll try with the second option.
> Thanks again, you and all others who gave their inputs!
> Have a good day and a good weekend everyone,
> Francesca
>
>
> Il giorno lun 14 ago 2023 alle ore 16:40 Thayer Young <thayeray at yahoo.com>
> ha scritto:
>
> > Hi Francesca,
> >
> > Sorry for the confusion.
> >
> > FYI, I recently installed the 3.28 .msi QGIS from the QGIS.org website
> and
> > geopandas is installed. You may just want to update your QGIS. I did not
> > use the OSGeo4W installer, as that was giving me missing .dll errors.
> >
> > If you want to persist with your current install, I think you want to do
> > the following:
> >
> > Open the 'Command Prompt' program (go to the start menu and search for
> it)
> > When it opens you will this prompt:    C:\Users\your_user_name>  From
> > file explorer drag and drop the 'python.exe' onto the Command Prompt
> > window. It should list the path to the python.exe file. You then want to
> > press enter. That should log you in to an interactive python terminal and
> > change the prompt to '>>>'.    Type in:  import geopandas    and press
> > enter. That should give you a 'ModuleNotFoundError'.
> >
> > If it does not give you an error and instead just goes to the next line,
> > you know that geopandas is installed. You can enter: exit()  and press
> > enter, and you can close the Command Prompt window.
> >
> > If you get the 'ModuleNotFoundError' error, press the up arrow and it
> > should bring up the path to the python.exe file again.
> > Then enter:  -m pip install geopandas  Then press enter.
> > That should bring up a long list of installation stuff, hopefully none of
> > it is red. You can then press the up arrow twice to get the path to the
> > python.exe and press enter to start python. Then try importing geopandas
> > again as above.
> >
> >
> >
> https://gis.stackexchange.com/questions/346859/importing-geopandas-in-qgis-3
> >
> > -Thayer
> >
> >
> >
> > On Monday, August 14, 2023 at 05:58:31 AM EDT, Francesca Parente <
> > francescaparente.rse at gmail.com> wrote:
> >
> >
> > Thank you both! I checked that out and tried the suggested installing
> > procedure.. but I can't get the command prompt where to type "pip install
> > geopandas".
> > I think I'm still missing a piece, I'm not so familiar with the python
> > environment as you can assume.
> >
> > These are the steps I followed:
> >
> > [image: image.png]
> > --->
> > [image: image.png]
> > Then I clicked on "python3.dll", which downloaded the file I tried to
> open
> > - but got me just another error message in QGis (saying that is an
> invalid
> > data source).
> > I searched online for other tips and tutorials, but (besides another
> > procedure using fiona) I haven't found anything more specific on this
> one.
> >
> > Should I go into the "Scripts" folder and click on "pip.exe" or
> "pip3.exe"?
> > Thanks again for your time and any other inputs you may have!
> > Francesca
> >
> >
> > Il giorno ven 11 ago 2023 alle ore 19:20 Thayer Young via QGIS-User <
> > qgis-user at lists.osgeo.org> ha scritto:
> >
> > Hi Francesca,
> >
> > If you don't know how to install Geopandas, I would like to add to what
> > Paolo said. Geopandas needs to be installed in the python that QGIS is
> > using.
> > You can check the location of the python installation by going to the
> > overall preferences for QGIS (command comma on a Mac, probably control
> > comma on other systems.)
> > From the System tab scroll to the bottom to find the "Current environment
> > variables" scroll down to find PYTHONHOME.
> > This documentation page shows you more with pictures:
> >
> >
> https://docs.qgis.org/3.28/en/docs/user_manual/introduction/qgis_configuration.html#system-settings
> >
> > Then in Finder or Explorer, etc. you want to find  location in the file
> > system. On a Mac you will need to right click on QGIS in your
> applications
> > folder and show package contents.  Then continue through the path and
> > double click to open the python3 file.
> > This will bring up a python prompt where you want to type:  pip install
> > geopandas  Then press enter/return. It will run for a while and hopefully
> > say that you successfully installed geopandas. You will probably need to
> > restart QGIS after that.
> >
> > -Thayer
> >
> >
> >
> > On Thursday, August 10, 2023 at 03:00:37 PM EDT,
> > qgis-user-request at lists.osgeo.org <qgis-user-request at lists.osgeo.org>
> > wrote:
> > ----------------------------------------------------------------------
> > Date: Thu, 10 Aug 2023 17:29:39 +0300
> > From: Paolo Cavallini <cavallini at faunalia.it>
> > To: Francesca Parente <francescaparente.rse at gmail.com>, Francesca
> >    Parente via QGIS-User <qgis-user at lists.osgeo.org>, QGIS User List
> >    <qgis-user at lists.osgeo.org>
> > Subject: Re: [Qgis-user] spatial analysis toolbox - testing for
> >    autocorrelation
> > Message-ID: <CA92BEAF-7DFA-479D-BF82-4614BF7DE30D at faunalia.it>
> > Content-Type: text/plain; charset="utf-8"
> >
> > You have to install geopandas.
> > Cheers.
> >
> > Il 10 agosto 2023 17:10:28 EEST, Francesca Parente via QGIS-User <
> > qgis-user at lists.osgeo.org> ha scritto:
> > >Hello everyone!
> > >
> > >I was wondering how to perform spatial autocorrelation tests in QGis
> and I
> > >downloaded the Spatial Analysis Toolbox
> > ><https://plugins.qgis.org/plugins/spatialanalysistoolbox/> plugin.
> > >I can't even open it thought and immediately got the following error
> > >message:
> >
> > >*Impossibile caricare il plugin 'spatialanalysistoolbox' a causa di un
> > >errore chiamando il metodo classFactory() ModuleNotFoundError: No module
> > >named 'geopandas' Traceback (most recent call last):  File
> > >"C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 335, in
> _startPlugin
> > >  plugins[packageName] = package.classFactory(iface)  File
> >
> >
> >"C:/Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\__init__.py",
> > >line 36, in classFactory    from .spatialanalysistoolbox import
> > >SpatialAnalysisToolboxPlugin  File
> > >"C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 799, in _import
> > mod
> > >= _builtin_import(name, globals, locals, fromlist, level)  File
> >
> >
> >"C:/Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\spatialanalysistoolbox.py",
> > >line 38, in    from .spatialanalysistoolbox_provider import
> > >SpatialAnalysisToolboxProvider  File
> > >"C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 799, in _import
> > mod
> > >= _builtin_import(name, globals, locals, fromlist, level)  File
> >
> >
> >"C:/Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\spatialanalysistoolbox_provider.py",
> > >line 35, in    from .algorithms.GWR_ import GWR_  File
> > >"C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 799, in _import
> > mod
> > >= _builtin_import(name, globals, locals, fromlist, level)  File
> >
> >
> >"C:/Users/fparente/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\spatialanalysistoolbox\algorithms\GWR_.py",
> > >line 23, in    import geopandas as gpd  File
> > >"C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 799, in _import
> > mod
> > >= _builtin_import(name, globals, locals, fromlist,
> > >level)ModuleNotFoundError: No module named 'geopandas'Versione Python:
> > >3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit
> > >(AMD64)] Versione di QGIS: 3.18.2-Z?rich Z?rich, 515138c171 *
> > >
> > >I repeated the download/install procedure, but nothing changed.
> > >Does anybody know how to fix this and/or alternative ways to test for
> > >spatial autocorrelation here?
> > >Thanks a lot and have a good day!
> > >--
> > >----------------------------
> > >Francesca Parente
> > >
> > >_ SESS Euro PhD <https://iris.uniroma1.it/cris/rp/rp54329> in
> > SocioEconomic
> > >and Statistical Studies
> > >_ Linked
> > ><
> >
> https://www.linkedin.com/in/francesca-parente-55194497/details/publications/
> > >
> > >in
> > >
> > >email: francescaparente.rse at gmail.com
> > >      fparente at regione.lazio.it
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <
> >
> http://lists.osgeo.org/pipermail/qgis-user/attachments/20230810/e9edad66/attachment-0001.htm
> > >
> >
> > ------------------------------
> >
> > Subject: Digest Footer
> >
> > _______________________________________________
> > 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
> >
> >
> > ------------------------------
> >
> > End of QGIS-User Digest, Vol 210, Issue 8
> > *****************************************
> >
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.osgeo.org/pipermail/qgis-user/attachments/20230818/530e2634/attachment.htm
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: image.png
> Type: image/png
> Size: 18785 bytes
> Desc: not available
> URL: <
> http://lists.osgeo.org/pipermail/qgis-user/attachments/20230818/530e2634/attachment.png
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: image.png
> Type: image/png
> Size: 48373 bytes
> Desc: not available
> URL: <
> http://lists.osgeo.org/pipermail/qgis-user/attachments/20230818/530e2634/attachment-0001.png
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> 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
>
>
> ------------------------------
>
> End of QGIS-User Digest, Vol 210, Issue 20
> ******************************************
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230829/e1403077/attachment-0001.htm>


More information about the QGIS-User mailing list