Skip to content
This repository has been archived by the owner on Apr 20, 2019. It is now read-only.

Fixing scipy._lib.decorator for lab of "Intro. to Tensorflow" #308

Closed
jinchenglee opened this issue Dec 28, 2016 · 2 comments
Closed

Fixing scipy._lib.decorator for lab of "Intro. to Tensorflow" #308

jinchenglee opened this issue Dec 28, 2016 · 2 comments
Assignees

Comments

@jinchenglee
Copy link

jinchenglee commented Dec 28, 2016

In section 35 Lab: TensorFlow Neural Network Lab, I met below error on Ubuntu 16.04 LTS native installation of python3.5:

_/usr/lib/python3/dist-packages/scipy/sparse/linalg/isolve/iterative.py in ()
8
9 from scipy.sparse.linalg.interface import LinearOperator
---> 10 from scipy._lib.decorator import decorator
11 from .utils import make_system
12 from scipy._lib._util import _aligned_zeros

ImportError: No module named 'scipy.lib.decorator'

I checked on internet, this is due to incomplete installation of python-decorator and/or python3-decorator. Details here. I've verified that this fixed the issue.

_This command fixed it for me. It reinstall the python 2 and 3 decorator package.

apt install --reinstall python*-decorator

Explanation:

On Debian place or python3 packages (/usr/lib/python3/dist-packages/) the scipy/_lib/decorator module is a symlink to the decorator module it self.

/usr/lib/python3/dist-packages/scipy/_lib# ls -l decorator.py
lrwxrwxrwx 1 root root 18 Sep 25 06:25 decorator.py -> ../../decorator.py

The package python-decorator and python3-decorator is a requirement for python-scipy and python3-scipy. According to apt, these decorator packages are installed. I checked the installed files with:

dpkg -L python3-decorator

/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/decorator.py
/usr/lib/python3/dist-packages/decorator-4.0.6.egg-info
(...)

But the file /usr/lib/python3/dist-packages/decorator.py was missing. Something in my system should (the user perhaps) should have messed with it. After I forced the reinstall of this packages, it came back to work again. But it's really strange this file gone missing._

@Brok-Bucholtz
Copy link

@jinchenglee,

Were you able to figure out why the file went missing?

@ghost
Copy link

ghost commented Dec 19, 2017

Ubuntu python-scipy bug 1533634 covers this.

The root cause is likely pip installing a newer version of decorator, which uninstalls the python-decorator provided by apt. For me it was a transitive dependency on decorator >= 4.1.0 in networkx.

I bet if you run this you'll see your decorator.py has been upgrade and is not longer under /usr/lib/python/ but is instead under /usr/local/lib/python

pip freeze |grep decorator
python -c "import decorator; print(decorator.__file__)"

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

No branches or pull requests

2 participants