homebrew-osgeo4mac: QGIS3/GRASS: error while executing a script
Problem reported by @luisspuerto
Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x!
PYTHONPATH is currently: "/usr/local/opt/gdal2-python/lib/python3.7/site-packages:/usr/local/opt/qgis3/lib/python3.7/site-packages:/usr/local/opt/qgis3/libexec/python/lib/python3.7/site-packages:/usr/local/lib/python3.7/site-packages"
You should `unset PYTHONPATH` to fix this.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 59
@luispuerto @nickrobison I’ve solved
v.dissolve
andv.to.lines
🎉With all the changes applied, GRASS should be completely compatible with Python 3.
While we wait for version 7.8/8.0, which apparently (https://gis.stackexchange.com/a/304598) will be compatible with Python 3.
Files to which I had to apply changes:
and to the remaining files just change
file
byopen
note:
file()
is not supported in Python 3. Usingopen()
I will apply the changes now!
p/d: If a similar error arises, you already know where to start. Now I want that beer 😄 Ha!
@fjperini @luispuerto I would be more than happy to buy you each a beer this Christmas, if you let me know where to send the money! One for @luispuerto for finding all the errors, and one for @fjperini for fixing them!
I just tested it
v.dissolve
in QGIS3&2 and it works perfectly in both. 👍Again, great work!
@nickrobison As there are several changes for Python 3, it might be best to create a
grass7-dev
formula for QGIS 3 and use it momentarily until GRASS 7.8 / 8.0 arrives.@luispuerto I’ll give you the formula with the changes and the tests in QGIS 2 and QGIS3.
If something comes up in QGIS 2, we’ll have to use
grass7-dev
.Here is a solution mentioned:
https://stackoverflow.com/questions/52269281/fix-import-error-on-using-environb-in-python
We are very close to solving it. This must be reported to the GRASS developers.
@fjperini you are right… what an eye have! I swear that
v.dissolve
want the second script I tried afterv.buffer
. I’ve been trying to use some other scripts —fromr.*
ori.*
toolboxes— but I don’t have anything at hand right now to test them —that I can say the script it’s working properly.@luispuerto I checked that with
v.buffer
everything works fine, doingv.dissolve
the errorTypeError
exits again.It seems that now we have to correct the file:
/usr/local/Cellar/grass7/7.4.3_2/grass-7.4.3/etc/python/grass/script/core.py
. Since it is the last (of GRASS) to run.@luispuerto We are far, I to a sea. Ha! But soon I will be walking through the old continent.
The integration of R and ORFEO is completed. It will only be necessary to enable them from
Manage and Install Plugins
and and ready.I was workining to configure the default folders and activate the plugin when it is enabled:
I correct the
--with-globe
integration and apply the changes. With that would be all the corrections to supports that were by default.Hey!!
Now it work 🎉 but two things.
that error was a config error, probably due to previous tweaking trying to make it work.
I delete the config:
Then I also have to disable the
v.external
option from qgis3 processing options → grassI can’t see that option in QGIS2… but in qgis2 the same script is faster than in qgis3. I don’t know if everything is exactly the same, since I haven’t thoroughly checked.
BUT…
🎉 IT WORKS! 🎉
(I owe you a beer @fjperini !)
Great! @fjperini are the changes related to the last 3 pull request? I can download them and merge locally in a branch and test them
@luispuerto I’m about to upload the other changes!
As mentioned @msandifo (see), a solution:
which can be applied by @nickrobison #549 :
or, with the patch that was to apply:
Once merged #549, I will apply the other changes.
@luispuerto When the bottle for qt5-webkit is ready, I to apply changes in
qgis3
and improve integration with GRASS, R and ORFEO.@luispuerto This commented @nickrobison in #228
Regarding the problem with PYTHON, I noticed that in src/plugins/grass/qgsgrassshell.cpp:
It is very likely that you are calling
python3
by default when grass is configured to usepython2
Another thing you can do to make sure:
GRASS addons may fail due to
python3
incompatibility. If that is tha case you can change the shebang a the beginning of the script to enforcepython2
usage.Should be changed into
Try this and then tell me how it turned out!
p/d: Yes, I am working on the implementation of orfeo6, I applied several changes with respect to #461 #462.
@luisspuerto, the problem is in GRASS, @nickrobison will create a patch to solve it.
@luisspuerto The tab/space issue is an upstream problem in grass, I think it was first reported in #228. I’ll try and create a patch and upgrade the grass formula.