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

missing rtree dependency issue with Spyder 4.2.1 #179

Open
Samk19 opened this issue Mar 6, 2021 · 9 comments
Open

missing rtree dependency issue with Spyder 4.2.1 #179

Samk19 opened this issue Mar 6, 2021 · 9 comments

Comments

@Samk19
Copy link

Samk19 commented Mar 6, 2021

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.

Removing/reinstalling rtree and spyder doesn't stop the warning.

Some temporary solution from spyder github i got were, that the spyder message about rtree disapears, when copy "spatialindex_c-64.dll" into the rtree folder.

Any permanent solution?

@mrclary
Copy link

mrclary commented Mar 7, 2021

@Samk19, are you using Spyder installed in Anaconda? If you are using either Windows or macOS, I would recommend using the standalone applications which should include the required spatialindex libraries.

@Samk19
Copy link
Author

Samk19 commented Mar 7, 2021

I am using anconda on pop os (linux)
Cannot find stand alone application for linux on the above github page

Though spyder recognised rtree after i use sudo apt install libspatialindex-dev..... no idea if its a permanent fix or a temporary one though

Spyder (anaconda) dependencies after using above command:

Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 1.6.0 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree >=3.0.2 : 3.1.0 (OK)
IPython >=7.6.0 : 7.21.0 (OK)
jedi =0.17.2 : 0.17.2 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 22.3.0 (OK)
nbconvert >=4.0 : 6.0.7 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
parso =0.7.0 : 0.7.0 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.8.0 (OK)
pygments >=2.0 : 2.8.0 (OK)
pylint >=1.0 : 2.7.2 (OK)
pyls >=0.36.2;<1.0.0 : 0.36.2 (OK)
pyls_black >=0.4.6 : 0.4.6 (OK)
pyls_spyder >=0.3.0 : 0.3.2 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 1.0.1 (OK)
qtconsole >=5.0.1 : 5.0.2 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.4 (OK)
setuptools >=39.0.0 : 52.0.0.post20210125 (OK)
sphinx >=0.6.6 : 3.5.1 (OK)
spyder_kernels >=1.10.1;<1.11.0 : 1.10.2 (OK)
textdistance >=4.2.0 : 4.2.1 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog >=0.10.3 : 1.0.2 (OK)
xdg >=0.26 : 0.27 (OK)
zmq >=17 : 20.0.0 (OK)

Optional:
cython >=0.21 : 0.29.22 (OK)
matplotlib >=2.0.0 : 3.3.4 (OK)
numpy >=1.7 : 1.19.2 (OK)
pandas >=1.1.1 : 1.2.3 (OK)
scipy >=0.17.0 : 1.6.1 (OK)
sympy >=0.7.3 : 1.7.1 (OK)

@hobu
Copy link
Member

hobu commented Mar 7, 2021

The @conda-forge recipe for Rtree includes libspatialindex. I'm not sure what the bug is in this particular configuration, and I am not sure on the distinction of Spyder with any other Conda tooling.

@mrclary
Copy link

mrclary commented Mar 7, 2021

@Samk19, Spyder does not have a standalone application for Linux distributions, only Windows and macOS. I'm not familiar with "pop os" and don't know if Spyder has been tested on that flavor of Linux. Nevertheless, I think it should work. There are a few things to note:

  • Spyder on Anaconda is limited to the pkgs/main channel, so it has not been tested with rtree>0.9.4 (pkgs/main rtree is still at 0.9.4), though I don't think there should be any issues.
  • You implied that you installed a developer version of spatialindex. It's possible that rtree may not be compatible with this version and its libraries. Spyder checks for installed dependencies at runtime by trying to import them in a subprocess, so you may have rtree installed but it fails to import, so Spyder gives you the pop up window complaining about it. It is interesting that the dependency list does not properly reflect this and that may be a Spyder bug. I recommend creating an issue at spyder-ide/spyder.

I recommend attempting one of the following to solve your issue.

  1. Instead of using a system level spatialindex, you can install rtree=0.9.7, which comes with appropriate spatialindex libraries, as mentioned by @hobu. This is not available yet on pkgs/main so you will have to install from the conda-forge channel: conda install -c conda-forge rtree=0.9.7.
  2. If you need to use rtree=0.9.4 and your OS doesn't have spatialindex preinstalled, then you will have to install it. I would remove your current version of spatialindex and install spatialindex=1.9.3. You may need to remove and reinstall rtree in your conda environment after properly installing spatialindex.

@Samk19
Copy link
Author

Samk19 commented Mar 7, 2021

@mrclary
tried conda-forge method earlier but it didnt work.....got the same error
also tried uninstalling spyder , rtree and spatialindex and re intalling them with conda-forge.....result was still the same rtree error when opening spyder
Also tried to install with pip tooo still error showed up

only developer version of spatialindex solved the problem

also tried on Ubuntu same problem but after installing developer version of spatialindex problem solved......but no idea if its a permanent soln of a temp one or of it creates other errors due to developer version of spatialindex installed

@mrclary
Copy link

mrclary commented Mar 8, 2021

@Samk19, sorry that you are having such trouble. I'm not sure what the problem could be, however I'm glad you were able to get it to work. rtree (and spatialindex) are only used for snippets; if you don't use snippets, then this should not cause you any issues whatsoever. If you do use snippets, please report back and let me know if there are any problems. However, I'd recommend moving the issue over to Spyder's Github project, not here at rtree.

@sweettyler
Copy link

sweettyler commented Mar 16, 2021

Not quite sure it's rtree's problem or Python 3.8.8's problem, but they can't work well together. With Python 3.8.8 even rtree can not be imported (no problem with Python 3.8.5) - see below a test with ipython:

Python 3.8.8 (default, Feb 24 2021, 21:46:12)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import rtree
...:

AttributeError Traceback (most recent call last)
in
----> 1 import rtree

~/anaconda3/lib/python3.8/site-packages/rtree/init.py in
----> 1 from .index import Rtree
2
3 from .core import rt
4
5 version = '0.9.4'

~/anaconda3/lib/python3.8/site-packages/rtree/index.py in
4 import pprint
5
----> 6 from . import core
7
8 import pickle

~/anaconda3/lib/python3.8/site-packages/rtree/core.py in
141 raise RTreeError('Unsupported OS "%s"' % os.name)
142
--> 143 rt.Error_GetLastErrorNum.restype = ctypes.c_int
144
145 rt.Error_GetLastErrorMsg.argtypes = []

~/anaconda3/lib/python3.8/ctypes/init.py in getattr(self, name)
392 if name.startswith('') and name.endswith(''):
393 raise AttributeError(name)
--> 394 func = self.getitem(name)
395 setattr(self, name, func)
396 return func

~/anaconda3/lib/python3.8/ctypes/init.py in getitem(self, name_or_ordinal)
397
398 def getitem(self, name_or_ordinal):
--> 399 func = self._FuncPtr((name_or_ordinal, self))
400 if not isinstance(name_or_ordinal, int):
401 func.name = name_or_ordinal

AttributeError: ~/anaconda3/bin/python: undefined symbol: Error_GetLastErrorNum

In [2]: quit

@sweettyler
Copy link

The error message is: ~/anaconda3/lib/python3.8/site-packages/rtree/core.py in
141 raise RTreeError('Unsupported OS "%s"' % os.name)

@stonebig
Copy link

for windows users: cgohlke just re-released rtree-0.9.7 wheels today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants