spyder: Spyder 4.2.1 - erroneous missing rtree dependency
I just installed spyder 4.2.1 (conda-forge) into a conda environment running Python 3.7.9. When I start spyder, a window pops up and states that a dependency is missing, namely rtree >=0.8.3.

However, rtree 0.9.5 is installed.
# Name Version Build Channel
rtree 0.9.5 py37h13cc57e_0 conda-forge
Removing/reinstalling rtree and spyder doesn’t stop the warning. Is this a bug, or is there something wrong with my environment?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 45 (20 by maintainers)
Got few solutions FOR LINUX (tested and worked): sudo apt install libspatialindex-dev FOR MAC: brew install spatialindex
still not sure if its a permanent fix or not
after using above command (i.e linux one)…spyder rtree error message gone rtree v0.9.4 is recognized by spyder
yes, version 0.9.7.
but… i had a completely different experience a few days ago:
i had some problems with a script that uses geopandas. error message was, that “spatialindex_c-64.dll” could not be found (“OSError: could not find or load spatialindex_c-64.dll”). (my script worked all the weeks before, i don’t know what happened).
so i searched the internet and one tipp was to copy the dll file (which existed in folder “…\anaconda3\Library\bin”) to the folder “…\anaconda3\envs\MyEnvironmentName\Lib\site-packages\rtree”.
since then everything worked as before, my geopandas script works and spyder 4.2.1 works, no more rtree message.
what’s your opinion on that?
to me it seems that updating to spyder 4.2.1 caused the geopandas script error message (script worked before the update).
Hi @steff456 ,
I got the same issue after creating a test env thus:
conda create -n test-env python=3.7.9 conda activate test-env conda install spyder=4.2.1 -c conda-forge
The problem was caused by python 3.8.8. After downgrading python from 3.8.8 to 3.8.5, the error went away.
Same problem also for me, with spyder 5.0.3 with the message: “Mandatory rtree >= 0.9.7 : None (NOK)).”, but rtree 0.9.7 is installed.
Moreover, in the Ipython console, if I do
import rtreean error on the DLL spatialindex_c is raised.So following the suggestion of manfred2020, I have not copy the full directory “…\anaconda3\Library\bin”, because this content is bigger than 1Go in my case, but I have copy only spatialindex_c-64.dll and spatialindex-64.dll. If you have the problem in a conda environment, destination folder is “…\anaconda3\envs\MyEnvironmentName\Lib\site-packages\rtree”, otherwise destination folder is “…\anaconda3\Lib\site-packages\rtree”.
In my case, just copy these 2 files works fine.
Hope it is helpfull.
Well, feeling guilty about my operational, yet hacked, environment, I gave in and made a new monster py37 environment using flexible channel priority and conda-forge #1 priority and pkgs/main #2 priority. Spyder 4.2.1 and geopandas work fine together with no errors.
@steff456, 4.2.1 is still not available in the defaults channel, so this could be an issue with conda-forge.
I was having the same problem. Before I used spyder4 and when I installed spyder5 the problem came,
Mandatory rtree >= 0.9.7 : None (NOK)
I use Debian Buster and I solved it like that,
sudo apt-get install libspatialindex-dev
https://debian.pkgs.org/10/debian-main-amd64/libspatialindex-dev_1.9.0-1_amd64.deb.html
Yes, manfred’s solution is hacky and not recommended, but it solves all problems in a few seconds. At this point I don’t care about using spyder in the env (and can change the spyder default env as stated in your FAQ). That py37 env has never had a problem with mixed packages before. But I do need a functioning geopandas, which is currently hosed because of that missing dll. Hopefully the rtree people (and/or others) will fix this issue moving forward.
I would have moved to a fully conda-forge py37 environment long ago if it wasn’t for problems with tensorflow and the fact that I am trying to stay away from pip as much as possible.
It will be nasty if I get this problem in a py3.8 env using flexible channel priority and conda-forge #1 priority and pkgs/main #2 priority. That is my main env which functions perfectly, albeit with spyder 4.2.0.
Thank you for your advice, which is by far the best way to go overall and will prevent future problems.
The simplest solution to this non-spyder issue is what manfred suggested above about copying the dll…
Thanks for the feedback @pythonic2020 ! For now then I will mark this as not related with Spyder but if you guys manage to get a root cause leave a comment here (probably other users could face a similar issue regarding
rtreeand a faulty installation of packages)@dalthviz, that’s what I think too. Could you set a conda env on Windows and install 4.2.1 with conda-forge to see if you’re seeing the same message?