{"action":"closed","issue":{"url":"https://api.github.com/repos/jfkirk/tensorrec/issues/70","repository_url":"https://api.github.com/repos/jfkirk/tensorrec","labels_url":"https://api.github.com/repos/jfkirk/tensorrec/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/jfkirk/tensorrec/issues/70/comments","events_url":"https://api.github.com/repos/jfkirk/tensorrec/issues/70/events","html_url":"https://github.com/jfkirk/tensorrec/issues/70","id":332341147,"node_id":"MDU6SXNzdWUzMzIzNDExNDc=","number":70,"title":"Example not working: AttributeError: module 'tensorflow' has no attribute 'data'","user":{"login":"renepickhardt","id":1926816,"node_id":"MDQ6VXNlcjE5MjY4MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1926816?v=4","gravatar_id":"","url":"https://api.github.com/users/renepickhardt","html_url":"https://github.com/renepickhardt","followers_url":"https://api.github.com/users/renepickhardt/followers","following_url":"https://api.github.com/users/renepickhardt/following{/other_user}","gists_url":"https://api.github.com/users/renepickhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/renepickhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renepickhardt/subscriptions","organizations_url":"https://api.github.com/users/renepickhardt/orgs","repos_url":"https://api.github.com/users/renepickhardt/repos","events_url":"https://api.github.com/users/renepickhardt/events{/privacy}","received_events_url":"https://api.github.com/users/renepickhardt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-14T10:21:38Z","updated_at":"2018-06-14T13:00:09Z","closed_at":"2018-06-14T13:00:09Z","author_association":"NONE","body":"For reproducability: I have a clean Anaconda installation and successfully installed tensorflow and tensorrec in the following way via python3.6 in jupyter:\r\n``` \r\n!conda install -y -c conda-forge tensorflow \r\n\r\nolving environment: done\r\n\r\n\r\n==> WARNING: A newer version of conda exists. <==\r\n  current version: 4.4.10\r\n  latest version: 4.5.4\r\n\r\nPlease update conda by running\r\n\r\n    $ conda update -n base conda\r\n\r\n\r\n\r\n## Package Plan ##\r\n\r\n  environment location: /Users/rpickhardt/anaconda3\r\n\r\n  added / updated specs: \r\n    - tensorflow\r\n\r\n\r\nThe following packages will be downloaded:\r\n\r\n    package                    |            build\r\n    ---------------------------|-----------------\r\n    mock-2.0.0                 |           py36_0         103 KB  conda-forge\r\n    protobuf-3.5.2             |           py36_0         603 KB  conda-forge\r\n    certifi-2018.1.18          |           py36_0         143 KB  conda-forge\r\n    tensorflow-1.1.0           |           py36_0        24.8 MB  conda-forge\r\n    libprotobuf-3.5.2          |                0         3.9 MB  conda-forge\r\n    pbr-4.0.4                  |             py_0          61 KB  conda-forge\r\n    ------------------------------------------------------------\r\n                                           Total:        29.7 MB\r\n\r\nThe following NEW packages will be INSTALLED:\r\n\r\n    libprotobuf: 3.5.2-0          conda-forge\r\n    mock:        2.0.0-py36_0     conda-forge\r\n    pbr:         4.0.4-py_0       conda-forge\r\n    protobuf:    3.5.2-py36_0     conda-forge\r\n    tensorflow:  1.1.0-py36_0     conda-forge\r\n\r\nThe following packages will be UPDATED:\r\n\r\n    certifi:     2018.1.18-py36_0             --> 2018.1.18-py36_0 conda-forge\r\n\r\n\r\nDownloading and Extracting Packages\r\nmock 2.0.0: ############################################################ | 100% \r\nprotobuf 3.5.2: ######################################################## | 100% \r\ncertifi 2018.1.18: ##################################################### | 100% \r\ntensorflow 1.1.0: ###################################################### | 100% \r\nlibprotobuf 3.5.2: ##################################################### | 100% \r\npbr 4.0.4: ############################################################# | 100% \r\nPreparing transaction: done\r\nVerifying transaction: done\r\nExecuting transaction: done\r\n```\r\n\r\nnext I did \r\n```\r\n!pip install tensorrec\r\n\r\nCollecting tensorrec\r\n  Downloading https://files.pythonhosted.org/packages/a3/f3/ba53a0c6112df91dbe3cdbf5b008269b3e518afb43d29160341e5a883231/tensorrec-0.25.2.tar.gz\r\nBuilding wheels for collected packages: tensorrec\r\n  Running setup.py bdist_wheel for tensorrec ... done\r\n  Stored in directory: /Users/rpickhardt/Library/Caches/pip/wheels/40/80/bc/97d2d1f08db563cde3166bf322d9e9433f160bf424bbd31773\r\nSuccessfully built tensorrec\r\nInstalling collected packages: tensorrec\r\nSuccessfully installed tensorrec-0.25.2\r\nYou are using pip version 9.0.1, however version 10.0.1 is available.\r\nYou should consider upgrading via the 'pip install --upgrade pip' command.\r\n```\r\nBoth seemed to have worked fine. however running the example from git I get the following stack trace: \r\n\r\n```\r\nGenerating positive interactions\r\nGenerating negative interactions\r\nGenerating user features\r\nGenerating item features\r\n---------------------------------------------------------------------------\r\nAttributeError                            Traceback (most recent call last)\r\n<ipython-input-6-4d84d711fe05> in <module>()\r\n     13 \r\n     14 # Fit the model for 5 epochs\r\n---> 15 model.fit(interactions, user_features, item_features, epochs=5, verbose=True)\r\n     16 \r\n     17 # Predict scores and ranks for all users and all items\r\n\r\n~/anaconda3/lib/python3.6/site-packages/tensorrec/tensorrec.py in fit(self, interactions, user_features, item_features, epochs, learning_rate, alpha, verbose, user_batch_size, n_sampled_items)\r\n    531                          verbose=verbose,\r\n    532                          user_batch_size=user_batch_size,\r\n--> 533                          n_sampled_items=n_sampled_items)\r\n    534 \r\n    535     def fit_partial(self, interactions, user_features, item_features, epochs=1, learning_rate=0.1,\r\n\r\n~/anaconda3/lib/python3.6/site-packages/tensorrec/tensorrec.py in fit_partial(self, interactions, user_features, item_features, epochs, learning_rate, alpha, verbose, user_batch_size, n_sampled_items)\r\n    578         # Check if the iterators have been constructed. If not, build them.\r\n    579         if self.tf_interaction_iterator is None:\r\n--> 580             self._build_input_iterators()\r\n    581 \r\n    582         if verbose:\r\n\r\n~/anaconda3/lib/python3.6/site-packages/tensorrec/tensorrec.py in _build_input_iterators(self)\r\n    260 \r\n    261     def _build_input_iterators(self):\r\n--> 262         self.tf_user_feature_iterator = create_tensorrec_iterator(name='tf_user_feature_iterator')\r\n    263         self.tf_item_feature_iterator = create_tensorrec_iterator(name='tf_item_feature_iterator')\r\n    264         self.tf_interaction_iterator = create_tensorrec_iterator(name='tf_interaction_iterator')\r\n\r\n~/anaconda3/lib/python3.6/site-packages/tensorrec/input_utils.py in create_tensorrec_iterator(name)\r\n     13     :return: tf.data.Iterator\r\n     14     \"\"\"\r\n---> 15     return tf.data.Iterator.from_structure(\r\n     16             output_types=(tf.int64, tf.int64, tf.float32, tf.int64, tf.int64),\r\n     17             output_shapes=([None], [None], [None], [], []),\r\n\r\nAttributeError: module 'tensorflow' has no attribute 'data'\r\n```\r\nThis is strange because according to the tensorflow doc this should work (c.f.: https://www.tensorflow.org/api_docs/python/tf/data/Iterator ) However I double checked at least the python object does indeed not have the field:\r\n\r\n```\r\nimport tensorflow as tf\r\nfor k in tf.__dict__.keys():\r\n    print(k)\r\n\r\n__name__\r\n__doc__\r\n__package__\r\n__loader__\r\n__spec__\r\n__path__\r\n__file__\r\n__cached__\r\n__builtins__\r\nAggregationMethod\r\nAssert\r\nAttrValue\r\nCOMPILER_VERSION\r\nConditionalAccumulator\r\nConditionalAccumulatorBase\r\nConfigProto\r\nDType\r\nDeviceSpec\r\nDimension\r\nEvent\r\nFIFOQueue\r\nFixedLenFeature\r\nFixedLenSequenceFeature\r\nFixedLengthRecordReader\r\nGIT_VERSION\r\nGPUOptions\r\nGRAPH_DEF_VERSION\r\nGRAPH_DEF_VERSION_MIN_CONSUMER\r\nGRAPH_DEF_VERSION_MIN_PRODUCER\r\nGraph\r\nGraphDef\r\nGraphKeys\r\nGraphOptions\r\nHistogramProto\r\nIdentityReader\r\nIndexedSlices\r\nInteractiveSession\r\nLogMessage\r\nNameAttrList\r\nNoGradient\r\nNodeDef\r\nNotDifferentiable\r\nOpError\r\nOperation\r\nOptimizerOptions\r\nPaddingFIFOQueue\r\nPrint\r\nPriorityQueue\r\nQUANTIZED_DTYPES\r\nQueueBase\r\nRandomShuffleQueue\r\nReaderBase\r\nRegisterGradient\r\nRunMetadata\r\nRunOptions\r\nSession\r\nSessionLog\r\nSparseConditionalAccumulator\r\nSparseFeature\r\nSparseTensor\r\nSparseTensorValue\r\nSummary\r\nTFRecordReader\r\nTensor\r\nTensorArray\r\nTensorInfo\r\nTensorShape\r\nTextLineReader\r\nVERSION\r\nVarLenFeature\r\nVariable\r\nVariableScope\r\nWholeFileReader\r\n__compiler_version__\r\n__git_version__\r\n__version__\r\nabs\r\naccumulate_n\r\nacos\r\nadd\r\nadd_check_numerics_ops\r\nadd_n\r\nadd_to_collection\r\nall_variables\r\napp\r\narg_max\r\narg_min\r\nargmax\r\nargmin\r\nas_dtype\r\nas_string\r\nasin\r\nassert_equal\r\nassert_greater\r\nassert_greater_equal\r\nassert_integer\r\nassert_less\r\nassert_less_equal\r\nassert_negative\r\nassert_non_negative\r\nassert_non_positive\r\nassert_none_equal\r\nassert_positive\r\nassert_proper_iterable\r\nassert_rank\r\nassert_rank_at_least\r\nassert_type\r\nassert_variables_initialized\r\nassign\r\nassign_add\r\nassign_sub\r\natan\r\nbatch_to_space\r\nbatch_to_space_nd\r\nbetainc\r\nbfloat16\r\nbincount\r\nbitcast\r\nbool\r\nboolean_mask\r\nbroadcast_dynamic_shape\r\nbroadcast_static_shape\r\ncase\r\ncast\r\nceil\r\ncheck_numerics\r\ncholesky\r\ncholesky_solve\r\nclip_by_average_norm\r\nclip_by_global_norm\r\nclip_by_norm\r\nclip_by_value\r\ncompat\r\ncomplex\r\ncomplex128\r\ncomplex64\r\nconcat\r\ncond\r\nconfusion_matrix\r\nconj\r\nconstant\r\nconstant_initializer\r\ncontainer\r\ncontrol_dependencies\r\nconvert_to_tensor\r\nconvert_to_tensor_or_indexed_slices\r\nconvert_to_tensor_or_sparse_tensor\r\ncos\r\ncount_nonzero\r\ncount_up_to\r\ncreate_partitioned_variables\r\ncross\r\ncumprod\r\ncumsum\r\ndecode_base64\r\ndecode_csv\r\ndecode_json_example\r\ndecode_raw\r\ndelete_session_tensor\r\ndepth_to_space\r\ndequantize\r\ndeserialize_many_sparse\r\ndevice\r\ndiag\r\ndiag_part\r\ndigamma\r\ndiv\r\ndivide\r\ndouble\r\ndynamic_partition\r\ndynamic_stitch\r\nedit_distance\r\neinsum\r\nencode_base64\r\nequal\r\nerf\r\nerfc\r\nerrors\r\nestimator\r\nexp\r\nexpand_dims\r\nexpm1\r\nextract_image_patches\r\neye\r\nfake_quant_with_min_max_args\r\nfake_quant_with_min_max_args_gradient\r\nfake_quant_with_min_max_vars\r\nfake_quant_with_min_max_vars_gradient\r\nfake_quant_with_min_max_vars_per_channel\r\nfake_quant_with_min_max_vars_per_channel_gradient\r\nfft\r\nfft2d\r\nfft3d\r\nfill\r\nfixed_size_partitioner\r\nflags\r\nfloat16\r\nfloat32\r\nfloat64\r\nfloor\r\nfloor_div\r\nfloordiv\r\nfloormod\r\nfoldl\r\nfoldr\r\ngather\r\ngather_nd\r\nget_collection\r\nget_collection_ref\r\nget_default_graph\r\nget_default_session\r\nget_local_variable\r\nget_seed\r\nget_session_handle\r\nget_session_tensor\r\nget_variable\r\nget_variable_scope\r\ngfile\r\nglobal_norm\r\nglobal_variables\r\nglobal_variables_initializer\r\ngradients\r\ngraph_util\r\ngreater\r\ngreater_equal\r\ngroup\r\nhalf\r\nhessians\r\nhistogram_fixed_width\r\nidentity\r\nifft\r\nifft2d\r\nifft3d\r\nigamma\r\nigammac\r\nimag\r\nimage\r\nimport_graph_def\r\ninitialize_all_tables\r\ninitialize_all_variables\r\ninitialize_local_variables\r\ninitialize_variables\r\nint16\r\nint32\r\nint64\r\nint8\r\ninvert_permutation\r\nis_finite\r\nis_inf\r\nis_nan\r\nis_non_decreasing\r\nis_numeric_tensor\r\nis_strictly_increasing\r\nis_variable_initialized\r\nlayers\r\nlbeta\r\nless\r\nless_equal\r\nlgamma\r\nlin_space\r\nlinspace\r\nload_file_system_library\r\nload_op_library\r\nlocal_variables\r\nlocal_variables_initializer\r\nlog\r\nlog1p\r\nlogging\r\nlogical_and\r\nlogical_not\r\nlogical_or\r\nlogical_xor\r\nlosses\r\nmake_template\r\nmap_fn\r\nmatching_files\r\nmatmul\r\nmatrix_band_part\r\nmatrix_determinant\r\nmatrix_diag\r\nmatrix_diag_part\r\nmatrix_inverse\r\nmatrix_set_diag\r\nmatrix_solve\r\nmatrix_solve_ls\r\nmatrix_transpose\r\nmatrix_triangular_solve\r\nmaximum\r\nmeshgrid\r\nmetrics\r\nmin_max_variable_partitioner\r\nminimum\r\nmod\r\nmodel_variables\r\nmoving_average_variables\r\nmultinomial\r\nmultiply\r\nname_scope\r\nnegative\r\nnewaxis\r\nnn\r\nno_op\r\nno_regularizer\r\nnorm\r\nnot_equal\r\none_hot\r\nones\r\nones_initializer\r\nones_like\r\nop_scope\r\northogonal_initializer\r\npad\r\nparallel_stack\r\nparse_example\r\nparse_single_example\r\nparse_single_sequence_example\r\nparse_tensor\r\nplaceholder\r\nplaceholder_with_default\r\npolygamma\r\npow\r\npy_func\r\npython_io\r\npywrap_tensorflow\r\nqint16\r\nqint32\r\nqint8\r\nqr\r\nquantize_v2\r\nquantized_concat\r\nquint16\r\nquint8\r\nrandom_crop\r\nrandom_gamma\r\nrandom_normal\r\nrandom_normal_initializer\r\nrandom_poisson\r\nrandom_shuffle\r\nrandom_uniform\r\nrandom_uniform_initializer\r\nrange\r\nrank\r\nread_file\r\nreal\r\nrealdiv\r\nreciprocal\r\nreduce_all\r\nreduce_any\r\nreduce_join\r\nreduce_logsumexp\r\nreduce_max\r\nreduce_mean\r\nreduce_min\r\nreduce_prod\r\nreduce_sum\r\nregister_tensor_conversion_function\r\nreport_uninitialized_variables\r\nrequired_space_to_batch_paddings\r\nreset_default_graph\r\nreshape\r\nresource\r\nresource_loader\r\nreverse\r\nreverse_sequence\r\nreverse_v2\r\nrint\r\nround\r\nrsqrt\r\nsaturate_cast\r\nsaved_model\r\nscalar_mul\r\nscan\r\nscatter_add\r\nscatter_div\r\nscatter_mul\r\nscatter_nd\r\nscatter_nd_add\r\nscatter_nd_sub\r\nscatter_nd_update\r\nscatter_sub\r\nscatter_update\r\nsdca\r\nsegment_max\r\nsegment_mean\r\nsegment_min\r\nsegment_prod\r\nsegment_sum\r\nself_adjoint_eig\r\nself_adjoint_eigvals\r\nsequence_mask\r\nserialize_many_sparse\r\nserialize_sparse\r\nset_random_seed\r\nsetdiff1d\r\nsets\r\nshape\r\nshape_n\r\nsigmoid\r\nsign\r\nsin\r\nsize\r\nslice\r\nspace_to_batch\r\nspace_to_batch_nd\r\nspace_to_depth\r\nsparse_add\r\nsparse_concat\r\nsparse_fill_empty_rows\r\nsparse_mask\r\nsparse_matmul\r\nsparse_maximum\r\nsparse_merge\r\nsparse_minimum\r\nsparse_placeholder\r\nsparse_reduce_sum\r\nsparse_reduce_sum_sparse\r\nsparse_reorder\r\nsparse_reset_shape\r\nsparse_reshape\r\nsparse_retain\r\nsparse_segment_mean\r\nsparse_segment_sqrt_n\r\nsparse_segment_sum\r\nsparse_softmax\r\nsparse_split\r\nsparse_tensor_dense_matmul\r\nsparse_tensor_to_dense\r\nsparse_to_dense\r\nsparse_to_indicator\r\nsparse_transpose\r\nspectral\r\nsplit\r\nsqrt\r\nsquare\r\nsquared_difference\r\nsqueeze\r\nstack\r\nstop_gradient\r\nstrided_slice\r\nstring\r\nstring_join\r\nstring_split\r\nstring_to_hash_bucket\r\nstring_to_hash_bucket_fast\r\nstring_to_hash_bucket_strong\r\nstring_to_number\r\nsubstr\r\nsubtract\r\nsummary\r\nsvd\r\nsysconfig\r\ntables_initializer\r\ntan\r\ntanh\r\ntensordot\r\ntest\r\ntile\r\nto_bfloat16\r\nto_double\r\nto_float\r\nto_int32\r\nto_int64\r\ntrace\r\ntrain\r\ntrainable_variables\r\ntranspose\r\ntruediv\r\ntruncated_normal\r\ntruncated_normal_initializer\r\ntruncatediv\r\ntruncatemod\r\ntuple\r\nuint16\r\nuint8\r\nuniform_unit_scaling_initializer\r\nunique\r\nunique_with_counts\r\nunsorted_segment_max\r\nunsorted_segment_sum\r\nunstack\r\nuser_ops\r\nvariable_axis_size_partitioner\r\nvariable_op_scope\r\nvariable_scope\r\nvariables_initializer\r\nverify_tensor_all_finite\r\nwhere\r\nwhile_loop\r\nwrite_file\r\nzeros\r\nzeros_initializer\r\nzeros_like\r\nzeta\r\n_LazyContribLoader\r\ncontrib\r\n```\r\n\r\nin [tensorflow issue tracker in issue 2879](https://github.com/tensorflow/models/issues/2879) one finds that tf.data has been introduced in tf 1.4 and was named tf.contrib.data before so apparently my tensorflow installation is too old. \r\n\r\nindeed prints the same as anaconda installation. \r\n```\r\nprint(tf.__version__)\r\n1.1.0\r\n```\r\nI will attach a patch of your software in a sec so that it will checked that the proper TensorFlow version is installed. \r\n\r\nas a side note upgrading to version 1.4 is not enough because then we get: AttributeError: 'Iterator' object has no attribute '_output_classes' as in #66  where it is stated that tensorflow version 1.7 is mandatory. \r\nactually using tensorflow 1.8. also seems to work just fine. \r\n\r\nFor anaconda users the following line will fix the issue (for some reason tf 1.7 is not within the conda-froge): \r\n```\r\n!conda install -y -c conda-forge tensorflow=1.8.0\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"renepickhardt"}}