Skip to content
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

'tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem' #30966

Open
develooper1994 opened this issue Dec 9, 2019 · 17 comments
Open

'tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem' #30966

develooper1994 opened this issue Dec 9, 2019 · 17 comments
Labels
module: tensorboard needs reproduction triaged

Comments

@develooper1994
Copy link

@develooper1994 develooper1994 commented Dec 9, 2019

📚 Documentation

🐛 Bug

Python == '3.7.5'
torch.version == '1.4.0.dev20191208'
torchvision.version == '0.5.0.dev20191209'
tensorflow.version == '2.0.0'
tensorboard.version == '2.0.2'
https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html
VISUALIZING MODELS, DATA, AND TRAINING WITH TENSORBOARD (CELL 7)
writer.add_embedding(features,
metadata=class_labels,
label_img=images.unsqueeze(1))
===> label_img=images.unsqueeze(1) # [error happens here]

Traceback:

AttributeError Traceback (most recent call last)
in
19 writer.add_embedding(features,
20 metadata=class_labels,
---> 21 label_img=images.unsqueeze(1))
22 writer.close()

~\Anaconda3\lib\site-packages\torch\utils\tensorboard\writer.py in add_embedding(self, mat, metadata, label_img, global_step, tag, metadata_header)
779 save_path = os.path.join(self._get_file_writer().get_logdir(), subdir)
780
--> 781 fs = tf.io.gfile.get_filesystem(save_path)
782 if fs.exists(save_path):
783 if fs.isdir(save_path):

AttributeError: module 'tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem'

@zhangguanheng66
Copy link
Contributor

@zhangguanheng66 zhangguanheng66 commented Dec 9, 2019

Could you include the code snippet for reproduction? If it's related to the tutorials, it's also better to open an issue in pytorch/tutorials.

@zhangguanheng66 zhangguanheng66 added needs reproduction triaged labels Dec 9, 2019
@develooper1994
Copy link
Author

@develooper1994 develooper1994 commented Dec 9, 2019

Do you want me to rewrite on pytorch/tutorials? I did.
I think it is about tensorflow(2.0) api changes.

@lanpa
Copy link
Collaborator

@lanpa lanpa commented Dec 10, 2019

I use the following environment and not problem occurs. The code I used is #30525, which is from the doc as well.
@develooper1994 What is your value of save_path?

torch==1.3.1
torchvision==0.4.2
tensorboard==2.0.2
tensorflow==2.0.0
tensorflow-estimator==2.0.1
python==3.6.9

@develooper1994
Copy link
Author

@develooper1994 develooper1994 commented Dec 10, 2019

@lanpa
Copy link
Collaborator

@lanpa lanpa commented Dec 11, 2019

Still can't produce with 1.4.0.dev20191211 and python 3.7.5

@develooper1994
Copy link
Author

@develooper1994 develooper1994 commented Dec 11, 2019

I didn't try after fail. I have started long run.

@johannespitz
Copy link

@johannespitz johannespitz commented Dec 14, 2019

#27716
This pr seems to be the problem. At first glance I couldn't find any version of tensorflow where tf.io.gfile has these functions... but I assume there is some version of tensorflow that works.

@AceEviliano
Copy link

@AceEviliano AceEviliano commented Jan 14, 2020

Has anyone got the solution yet I still have the problem

torch 1.5.0.dev2020011
tensorboard 2.0.0
tensorflow 2.0.0
python 3.7

@Jean-KOUAGOU
Copy link

@Jean-KOUAGOU Jean-KOUAGOU commented Jan 20, 2020

You can create a new environment, then install pytorch and tensorboard. Note: you should not install tensorflow as there would be a kind of conflict with tensorboard.

@AlexSananka
Copy link

@AlexSananka AlexSananka commented Jan 20, 2020

Thank you @Jean-KOUAGOU this fixed my problem.

@sclarkson
Copy link
Contributor

@sclarkson sclarkson commented Jan 22, 2020

As you can see from these two links

https://github.com/tensorflow/tensorboard/blob/master/tensorboard/compat/__init__.py#L46-L57
https://github.com/tensorflow/tensorboard/blob/a72870cb1e59f71f49f72bfd4c2f3ec25dc75fa9/tensorboard/compat/tensorflow_stub/io/gfile.py#L72

tensorboard has it's own implementation of gfile that it uses if tensorflow is not present on the system. @sanekmelnikov used a non-public API from this stub implementation when implementing #27716

@korakot
Copy link

@korakot korakot commented Feb 6, 2020

Temporary solution

import tensorflow as tf
import tensorboard as tb
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile

@almajo
Copy link

@almajo almajo commented Mar 26, 2020

I would like to add to @korakot s workaround that it did slow down program execution by a huge factor if you have many summarywriter calls. Has anybody else observed this?

Using latest pytorch 1.4 and tensorboard 2.2

@clefourrier
Copy link
Contributor

@clefourrier clefourrier commented Apr 1, 2020

Removing Tensorflow from the Pytorch/Tensorboard env, as mentioned by @Jean-KOUAGOU, worked for me.

@fabrizioschiano
Copy link

@fabrizioschiano fabrizioschiano commented Apr 22, 2020

@clefourrier , could you clarify what you did? I am having the same problem, thanks.

@korakot , your solution works for me but I don't understand what it specifically does. Could you please explain? Thanks!

@clefourrier
Copy link
Contributor

@clefourrier clefourrier commented Apr 23, 2020

@fabrizioschiano : If you created a virtualenv to use pytorch in (using this for example), you have to make sure that you only installed pytorch and tensorboard, but not tensorflow, as it has conflicts with the others. As I said, removing tensorflow from the vritualenv containing pytorch and tensorboard solved the problem for me.

If you did not create a virtualenv and installed everything in the same spot, either

  • you do not need tensorflow and should remove it
  • you need tensorflow as well as pytorch and should actually use virtual environments to manage your python dependencies (good practice anyway)

@nicolae-stroncea
Copy link

@nicolae-stroncea nicolae-stroncea commented Nov 20, 2020

Had the same issue with google colab. Uninstalling tensorflow will remove the %tensorboard magic, so you need to keep it if you're using tensorboard inline in a jupyter cell . @korat's solution worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: tensorboard needs reproduction triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.