Closed sphh closed 3 years ago
Hey @sphh, thanks for reporting. This is an installation issue, not a problem with Spyder. And as you probably know, we only support Anaconda installations, not custom ones, as in your case.
So it's up to you to figure this one out. My only recommendation is to stop installing packages with sudo pip3
in your system Python (which is a recipe for disaster since you'll most likely break it) and use instead a virtualenv
.
Well, it might be an installation issue … but xdg
can be loaded from any other package, so I wonder, if it is not a problem with its detection after all.
I did a little test. I added two lines to /usr/local/bin/spyder
:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from spyder.app.start import main
from xdg.DesktopEntry import DesktopEntry # ADDED
print('###################', DesktopEntry) # ADDED
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
(I used these lines, because that's what spyder/utils/programs.py
uses – that is the only import of xdg
my recursive grep could find.)
When I now start spyder from the terminal, I get:
$ spyder
################### <class 'xdg.DesktopEntry.DesktopEntry'>
so spyder can find xdg
. Which let's me believe, that the detection algorithm might have a problem …
To be absolutely sure, I added the same lines to the main()
function and xdg
can still be loaded!
Can you point me where (and how) a package is detected? Maybe I can track down the problem? Thanks.
spyder/dependencies.py
TL;DR
I tracked it down, that spyder
could not find the version string for xdg
in the get_module_version()
function in utils/programs.py
.
Further investigation revealed, that the __init__.py
file was missing from pyxdg
's installation directory. Un- and reinstalling pyxdg
solved this problem.
The problem was, that I installed xdg
and pyxdg
. Both packages install into the same directory (xdg
), which is Not A Good Idea. I then de-installed xdg
, which removed all its files from this directory – including pyxdg
's __init__.py
file. Who would have thought!
So this was not an installation issue, but a de-installation issue :confounded:
(Thanks for your help.)
No prob, glad you were able to figure it out.
Just for reference: The corresponding bug reports can be found here:
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
Spyder complains, that
xdg
is not installed, but xdg is installed:I cannot say, if that happened, after upgrading
Spyder
from 5.1.4 to 5.1.4 or upgradingpyxdg
from 0.26 to 0.27.pyxdg-0.26
was installed through my Linux package management system. After uninstalling it, I installed withpip3 install pyxdg
, which gave me version 0.27. I can load it withUnfortunately it does not reveal the version, hence:
I started spyder with the
--debug-info verbose
argument. The only line which containsxdg
is:Versions
Dependencies