When I run the Autoencoder tutorial, I get the following error
Traceback (most recent call last):
File "C:/Dropbox/PhD/PycharmProjects/Autoencoder_AD/autoencoder.py", line 24, in
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py", line 235, in read_data_sets
SOURCE_URL + TRAIN_IMAGES)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 205, in maybe_download
gfile.MakeDirs(work_directory)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 367, in recursive_create_dir
pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(dirname), status)
File "C:\Program Files\Anaconda3\lib\contextlib.py", line 89, in __exit__
next(self.gen)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.PermissionDeniedError: Failed to create a directory: MNIST_data
Process finished with exit code 1
Solution:
This line is the culprit:
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
The current working directory when this line gets executed is a system folder like C:\\Windows\\System32 where the user does not have write permission to create the folder named "MNIST_data" as shown in the code above.
os.chdir(os.path.dirname(os.path.abspath(__file__))) # Change current directory to where script is located.
This solved the problem for me. I hope it does for you too!
Traceback (most recent call last):
File "C:/Dropbox/PhD/PycharmProjects/Autoencoder_AD/autoencoder.py", line 24, in
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py", line 235, in read_data_sets
SOURCE_URL + TRAIN_IMAGES)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 205, in maybe_download
gfile.MakeDirs(work_directory)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 367, in recursive_create_dir
pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(dirname), status)
File "C:\Program Files\Anaconda3\lib\contextlib.py", line 89, in __exit__
next(self.gen)
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.PermissionDeniedError: Failed to create a directory: MNIST_data
Process finished with exit code 1
Solution:
This line is the culprit:
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
The current working directory when this line gets executed is a system folder like C:\\Windows\\System32 where the user does not have write permission to create the folder named "MNIST_data" as shown in the code above.
Hence make the current working directory of your execution to the directory where your script is located. For that add the following line after the import statements as follows: