Reputation: 437
I upgraded my Ubuntu 16.04 to 18.04. Then I created a new virtual environment for Python and started spyder3:
python3 -m venv dev
source dev/bin/activate
spyder3
Then I got an error:
...
ModuleNotFoundError: No module named 'simplegeneric'
So I had to do:
pip install wheel
pip install simplegeneric
But spyder3 still says that there is no module named 'simplegeneric'. Why?
Some information about versions and installed modules:
(dev) /media/shared/Development/python$ python3 -V
Python 3.6.5
(dev) /media/shared/Development/python$ pip -V
pip 9.0.1 from /media/shared/Development/python/dev/lib/python3.6/site-packages (python 3.6)
(dev) /media/shared/Development/python$ which spyder3
/media/shared/Development/python/dev/bin/spyder3
(dev) /media/shared/Development/python$ which pip
/media/shared/Development/python/dev/bin/pip
(dev) /media/shared/Development/python$ pip freeze | grep simplegeneric
simplegeneric==0.8.1
EDIT:
My problem is not that I can't import simplegeneric within spyder. My problem is that I cannot open spyder:
(dev) /media/shared/Development/python$ spyder3
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3126, in main
mainwindow = run_spyder(app, options, args)
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3023, in run_spyder
main.setup()
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 932, in setup
from spyder.plugins.ipythonconsole import IPythonConsole
File "/usr/lib/python3/dist-packages/spyder/plugins/ipythonconsole.py", line 59, in <module>
from spyder.widgets.ipythonconsole import ClientWidget
File "/usr/lib/python3/dist-packages/spyder/widgets/ipythonconsole/__init__.py", line 12, in <module>
from .debugging import DebuggingWidget
File "/usr/lib/python3/dist-packages/spyder/widgets/ipythonconsole/debugging.py", line 16, in <module>
from qtconsole.rich_jupyter_widget import RichJupyterWidget
File "/usr/lib/python3/dist-packages/qtconsole/rich_jupyter_widget.py", line 14, in <module>
from .jupyter_widget import JupyterWidget
File "/usr/lib/python3/dist-packages/qtconsole/jupyter_widget.py", line 19, in <module>
from IPython.lib.lexers import IPythonLexer, IPython3Lexer
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 30, in <module>
from .debugger import TerminalPdb, Pdb
File "/usr/lib/python3/dist-packages/IPython/terminal/debugger.py", line 6, in <module>
from IPython.core.completer import IPCompleter
File "/usr/lib/python3/dist-packages/IPython/core/completer.py", line 34, in <module>
from IPython.utils import generics
File "/usr/lib/python3/dist-packages/IPython/utils/generics.py", line 8, in <module>
from simplegeneric import generic
ModuleNotFoundError: No module named 'simplegeneric'
EDIT 2:
It's obvious that I have the module 'simplegeneric' installed somewhere but spyder3 can't find it. So I guess my problem is related to sys.path or $PYTHONPATH. That's my sys.path within the dev environment:
(dev) /media/shared/Development/python$ python3 -c "import sys; print('\n'.join(sys.path))"
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/media/shared/Development/python/dev/lib/python3.6/site-packages
And that's my regular sys.path:
~$ python3 -c "import sys; print('\n'.join(sys.path))"
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/usr/local/lib/python3.6/dist-packages
/usr/lib/python3/dist-packages
Shouldn't sys.path of my dev environment contain everything from the regular sys.path?
Upvotes: 0
Views: 2790
Reputation: 437
OK, finally I could solve my problem: pip3 was linked to a local copy and I think my local pip3 was messed up:
~$ which pip3
/usr/local/bin/pip3
So I did:
~$ sudo mv /usr/local/bin/pip3 pip3_bak
~$ which pip3
/usr/bin/pip3
Then I had to reinstall python3-simplegeneric:
~$ sudo apt-get install python3-simplegeneric --reinstall
Now I can start Spyder3 3.2.6 regularly or Spyder3 3.2.8 in my (dev) environment.
Upvotes: 1
Reputation: 963
I tried this, but it worked fine for me.
C:\Users\RayanMadrid>pip install simplegeneric
Collecting simplegeneric
Downloading
https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip
Installing collected packages: simplegeneric
Running setup.py install for simplegeneric ... done
Successfully installed simplegeneric-0.8.1
Then I ran it in Python:
>>> import simplegeneric
>>>
So your problem is something local to your machine.
Upvotes: 3