ImportError: cannot import name 'cached_property'
See original GitHub issueWhen running the first snippet of code in the README saved as a .py file to get the WorkID. I get an error message that it cannot import from functools.
The resulting error message occurs regardless of if I run it from the ao3_api or AO3 directory.
Fresh Ubuntu 18.04 LTS in VirtualBox.
(project) ao3dude@ao3dude-VirtualBox:~/project$ python3 ~/project/ao3_api/snippet.py
Traceback (most recent call last):
File "/home/ao3dude/project/ao3_api/snippet.py", line 1, in <module>
import AO3
File "/home/ao3dude/project/ao3_api/AO3/__init__.py", line 2, in <module>
from .comments import Comment
File "/home/ao3dude/project/ao3_api/AO3/comments.py", line 5, in <module>
from .users import User
File "/home/ao3dude/project/ao3_api/AO3/users.py", line 2, in <module>
from functools import cached_property
ImportError: cannot import name 'cached_property'
Here are the commands I used to setup the environment:
# Update the OS software and grab some Python packages.
sudo apt update && sudo apt upgrade -y
sudo apt install python3-dev python3-pip python3-venv git
# Make a directory and start a Python virtual environment in it.
mkdir projectfolder
python3 -m venv --system-site-packages projectfolder/
source projectfolder/bin/activate
# Move in to the folder, get some needed Python modules and clone the git.
cd projectfolder/
pip install --upgrade pip setuptools
git clone https://github.com/ArmindoFlores/ao3_api.git
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Flask app wont launch 'ImportError: cannot import name ' ...
The proper answer for May 2020: flask-restplus is dead, move to flask-restx. From noirbizarre/flask-restplus#778 (comment):.
Read more >cannot import name 'cached_property' from 'werkzeug' #143
cached_property. This was addressed in October by pull request # 141, but it seems like it failed testing because the old python 3.3...
Read more >Python3 'Cannot import name 'cached_property'
A bit of a late response, but I may have found a solution. You need to rename from werkzeug import cached property to...
Read more >[Fixed] ModuleNotFoundError: No module named 'cached- ...
Quick Fix: Python raises the ImportError: No module named 'cached-property' when it cannot find the library cached-property . The most frequent source of...
Read more >cached-property 1.5.2
A decorator for caching properties in classes. Why? Makes caching of time or computational expensive properties quick and easy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also as a side note, I’m working on removing the use of
cached_property
altogether, because using it forces me to store the soup object instead of just calculating everything at load time, and that then makes a pickled Work, Series or Session object very big and much more complex than it needed to be.You can try to install this python package using
pip install cached-property
and replacing all instances offrom functools import cached_property
withfrom cached_property import cached_property
. However, I don’t recommend this and I think you’d be better off just upgrading to python 3.8