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

cannot import name FileWriter #11

Open
happytaoxiaoli opened this issue Jun 5, 2018 · 10 comments
Open

cannot import name FileWriter #11

happytaoxiaoli opened this issue Jun 5, 2018 · 10 comments

Comments

@happytaoxiaoli
Copy link

File "/home/txl/TF-Projects/GAN/StackGAN-v2-master/code/trainer.py", line 20, in
from tensorboard import FileWriter
ImportError: cannot import name FileWriter

I found that tensorboard has no model named FileWriter.
anyone can tell me how to resolve this problem ?

@hoseong-kim
Copy link

I have solved this problem.
My solution is as follows:
sudo -H pip install tensorboardX
from tensorboardX import FileWriter

@happytaoxiaoli
Copy link
Author

@hoseong-kim
thanks very much
i will try it

@happytaoxiaoli
Copy link
Author

@hoseong-kim
I found another solution:
#5

The dependency while setting up StackGan++ is tensorboard-pytorch and not tensorboard.

@hoseong-kim
Copy link

@happytaoxiaoli
Oh! That might be a more fundamental solution.

@panovr
Copy link

panovr commented Sep 24, 2018

You can install tensorboard-pytorch using the command from here :
pip install tensorboard-pytorch

@dmalinow
Copy link

If you install tensorboard-pytorch, do you have to modify the code? or do you need to change the path to reflect the dependency?

@Tristan-YF
Copy link

I think this is mainly because of the version mismatch. I'v met the same problem before, and I solved it by changing a lower version of tensorboard .

@SaidaSaad
Copy link

@tristangao Which version you used please?

@johnny5550822
Copy link

Use tensorboard-pytorch (pip install tensorboard-pytorch). Do this:

from torch.utils.tensorboard import summary
from torch.utils.tensorboard import FileWriter

instead of:

from tensorboard import summary
from tensorboard import FileWriter

@ayadav10491
Copy link

ayadav10491 commented Feb 7, 2020

One can avoid importing FileWriter from tensorboard
and simply use tf.compat.v1.summary.FileWriter()
Example:

Launch the graph in a session.

sess = tf.compat.v1.Session()

Create a summary writer, add the 'graph' to the event file.

writer = tf.compat.v1.summary.FileWriter(<some-directory>, sess.graph)

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

No branches or pull requests

8 participants