Short description
Interpreter is not able to import tensorflow_datasets.core in case of unstable versions of pythons. For example, code won't run in case of python 3.5 but it runs for 3.6. I have 3.7.6 in which it is not running. The problem is with sys.path. I think we need to insert tfds dir into sys.path .
Environment information
tensorflow-datasets/tfds-nightly version: 2.1tensorflow/tensorflow-gpu/tf-nightly/tf-nightly-gpu version: 2.0Error Stack
Traceback (most recent call last):
File "tensorflow_datasets/scripts/create_new_dataset.py", line 38, in <module>
from tensorflow_datasets.core import naming # pylint: disable=g-import-not-at-top
ModuleNotFoundError: No module named 'tensorflow_datasets'
Expected behavior
The file should run if we execute following command from the tfds dir.
python tensorflow_datasets/scripts/create_new_dataset.py \
--dataset my_dataset \
--type image # text, audio, translation,...
Hello, you have to check two things first make sure you have installed tensorflow datasets using
pip install tensorflow_datasets in your environment and second is you have to run following command:
python tensorflow_datasets/scripts/create_new_dataset.py --dataset my_dataset --type image by using this command four files are created in you installed tensorflow datasets directory
my_dataset.py , my_dataset_test.py, my_dataset.txt and fake images
@Eshan-Agarwal , Thanks for your comment.
(1) There is no need to install tensorflow_datasets using pip since we are in the same dir of datasets in which tensorflow_datasets dir exists. So, py can import core from tensorflow_datasets.
(2) If you install tensorflow_datasets using pip, then your new dataset files generated using
python tensorflow_datasets/scripts/create_new_dataset.py --dataset my_dataset --type image
will not be created in the current contribution dir of tensorflow_datasets, instead they would be created in the site-packages/tensorflow_datasets dir which will be in your $PYTHONPATH because you are using tensorflow_datasets to import core from $PYTHONPATH and not the git clonned.
Yes I also have same problem and it install it in site-packages/tensorflow_datasets. Maybe its a bug
Yes I also have same problem and it install it in site-packages/tensorflow_datasets. Maybe its a bug
Yeah. That's the bug. Now if it's very urgent and if you want temporary fix, then do following :
(1) uninstall the tensorflow_datasets from $PYTHONPATH using
pip uninstall tensorflow_datasets
(2) Add these 2 lines in create_new_datasets.py
import sys
sys.path.insert(0,'.')
Above PR #1545 solves this problem. But till the time it merges, you can do the above steps.
Ok thanks for this bug fixing