-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot import 'BytesType' from diskcache.core #27
Comments
It seems that using the following line could fix the current issues: And the BytesIO line should be changed to the following: |
Heya, thank you for reporting this! We'll need to update the code. |
I had the same error and, as @al00014 suggested, adding the following should work: Besides that, I also needed to add cassandra-driver to the requirements. |
@diogodanielsoaresferreira, I am having the same issue. I installed cassandra ('pip install cassandra-driver') and then added the following to the header of the 'disk.py' file: from cassandra.cqltypes import BytesType Now I get the error 'cannot import name 'BytesType' from 'diskcache.core'. Thanks in advance! |
@fmarti04 you also have to delete/comment the following lines: from diskcache import FanoutCache, Disk Does it work? |
@diogodanielsoaresferreira thank you so much for replying to my message so quickly. Yes, your proposed change works. I was editing the wrong "disk.py" file. The correct "disk.py" file to edit is the one found under "/util/disk.py", not the one found under "p2ch10/util/disk.py". Thanks again Diogo! |
Thank you (all above). This helped a lot. I couldn't figure out what I was doing wrong it just kept complaining about things not being found after install and install and... I hope the code gets updated. I just downloaded mine on Nov 17th and it is not corrected at least in Manning Pub. Maybe GitHub is more up to date. |
deep-learning-with-pytorch#27 27 after using the new import, it works
I used the following pip installs: I have to use this code to for colab "cd dlwpt-code" because I want to use the dlwpt-code as main directory. |
This pull request fixes this issue with @diogodanielsoaresferreira's solution. I am currently testing it with the p2ch10_explore_data.ipynb. |
yes, and the problem still exist, whether I run in Colab or my computer. |
did you install "cassandra-driver" and "diskcache" package? i met the same problem and solved after those packages installed. |
ReasonThis is a legacy issue. By inspecting the commit history of the python-diskcache library, you will find that
And
SolutionSince we have known what the from diskcache import FanoutCache, Disk
from diskcache.core import MODE_BINARY # delete BytesType and BytesIO declarations
BytesType = bytes # Import them by ourselves
import io
BytesIO = io.BytesIO And that works for me. |
Wow,it's really useful.Thanks! |
I was trying to run "p2ch10_explore_data.ipynb", facing import error from diskcache.core
ImportError: cannot import name 'BytesType'
Looks like diskcache has been updated and does not have 'BytesType' anymore.
Any alternatives to "utils/disk.py"?
The text was updated successfully, but these errors were encountered: