Yesterday updated my ubuntu 17.04 to ubuntu 17.10. any comments? Appear when I try to run server in pycharm. #django project.
bash -cl "/home/encuentrum/venv-encuentrum3/bin/python /usr/share/pycharm/helpers/pycharm/django_manage.py check /home/encuentrum/GitLab/encuentrum3/ENCUENTRUM/packers_"
Traceback (most recent call last):
File "/usr/share/pycharm/helpers/pycharm/django_manage.py", line 5, in <module>
from pycharm_run_utils import adjust_django_sys_path
File "/usr/share/pycharm/helpers/pycharm/pycharm_run_utils.py", line 4, in <module>
import imp
File "/home/encuentrum/venv-encuentrum3/lib/python3.6/imp.py", line 19, in <module>
from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
File "/home/encuentrum/venv-encuentrum3/lib/python3.6/importlib/__init__.py", line 57, in <module>
import types
File "/home/encuentrum/venv-encuentrum3/lib/python3.6/types.py", line 171, in <module>
import functools as _functools
File "/home/encuentrum/venv-encuentrum3/lib/python3.6/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/encuentrum/venv-encuentrum3/lib/python3.6/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
Maybe you have mixed your multiple Python installations, the newer version of
weakref
are not compatible with older version python binary, try to remove any one (the older one is recommended) of Python installation.Analysis
For my case, I have installed older version Python (3.5.1) before, and upgrade my Debian installation. The newer Debian upgrade it's Python3.5 to 3.5.3 which have
_remove_dead_weakref
in_weakref
in its Python binaryWhen I type
$ where python3.5
, I getThe
/usr/local/bin/python3.5
is my own older installation, and/usr/bin/python3.5
is Debian offical Python3.5When I update my Python3.5 installation by apt-get, apt-get execute
python3.5 -E -S /usr/lib/python3.5/py_compile.py $files
(post-install script) in the deb package.`, it triggers the weakref issue, here is my logI tested Python 3.5.1 and Python 3.5.3 with same import action, here are the compares
Official Python 3.5.3 from apt-get
My own Python 3.5.1 installation
So, I confirm that python3.5 in
/usr/local/bin/
cannot use_remove_dead_weakref
. But which python did apt-get use in post-installation script? Try it.So, here is why. The post-installation script use my custom installation of python, along with newer python library (
/usr/lib/python3.5/weakref.py
)Fix it!
As I said, disable older version of python
Test