tensorflow: ./third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory

Environment info

Operating System: Ubuntu 14.04

I’m trying to build the pi-examples by building the tensorflow via makefile on Linux(Ubuntu 14.04).

So 1st I’ve done “Building on Linux” successfully from here: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile#building-on-linux

now at https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples I’m trying to build camera example, but when I’ve run make -f tensorflow/contrib/pi_examples/camera/Makefile command, the result came out as follows on terminal:

gcc --std=c++11 -O0 -I/usr/local/include -I. -I/home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads -I/home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads/eigen-latest/ -I/home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto/ -I/home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto_text/ -c tensorflow/contrib/pi_examples/camera/camera.cc -o /home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o In file included from ./tensorflow/core/framework/tensor.h:19:0, from tensorflow/contrib/pi_examples/camera/camera.cc:33: ./third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory #include "unsupported/Eigen/CXX11/Tensor" ^ compilation terminated. make: *** [/home/tushar/Desktop/tushar/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o] Error 1

Why? could anyone confirm me that third-party library specially (eigen3) is complete or something missing.

I’ve also tried with replacing it’s third-party eigen3 library by separately downloaded library, but that create new error, but similar to this (i.e. XYZ… No such file or directory)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 7
  • Comments: 48 (6 by maintainers)

Most upvoted comments

I have had the same issue today as well.

Has anyone been able to resolve the issue ?

I have included “tensorflow/third_party/eigen3” but I get below error

tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply #include “unsupported/Eigen/CXX11/Tensor”

@maciekcc: could you take a look at this? Thanks.

Yes, it works. I followed the answer of @leftofcenter . In the path of python which you installed on you target machine, and find the directory of “dist-packages” or “site-packages”:

find -type f -name ‘Tensor’ -print maybe the output: /tensorflow/include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor

So, you can copy the directory “unsupported/” to where you place the reference header files. For example,

sudo cp -r ***/site-packages/tensorflow/include/unsupported/ /usr/local/include/google/tensorflow/

And, you must also copy another folder of “Eigen” in “***/site-packages/tensorflow/include/”

sudo cp -r ***/site-packages/tensorflow/include/Eigen/ /usr/local/include/google/tensorflow/

You need to include the Eigen3 (from eigen.tuxfamily.org) library in the -I for your target. From CMake it is something like:

find_package(Eigen3)
add_executable(...)
target_include_directories(<target> INTERFACE ${EIGEN3_INCLUDE_DIR})

I built tensorflow from source including creation and installation of the python installer. For the tensorflow directory:

$ find tensorflow -type f -name ‘Tensor’ -print tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor

For my python dist-packages directory:

$ find dist-packages -type f -name ‘Tensor’ -print dist-packages/tensorflow/include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor dist-packages/tensorflow/include/external/eigen_archive/unsupported/Eigen/CXX11/Tensor

The first Tensor file is the one that is indirectly included by session.h. The 2nd Tensor file is the one that the first Tensor file needs to include. Since the 2nd file is not present in the tensorflow tree (I don’t know what magic puts it into the dist-packages tree), I don’t see how a bazel build can work unless you arrange to get the 2nd file by some means (via network?). If you try to #include the 2nd file in a bazel c_opts block you get an error for the file not being in the workspace tree.

Therefore I think I am on the road to success with my first tensorflow project by not using bazel and getting my include files from the dist-packages. I am using makefile and correct use of -I in my compiler commands has fixed this problem.

Roger

This issue is quite old and hasn’t had recent activity. If it is still not working in the latest version of TensorFlow, and please create a new bug. Thank you.

Download eigen (from eigen.tuxfamily.org) and add it in the path, then ‘unsupported’ directory containing the Eigen/CX11/Tensor will be in the search path. This ‘Tensor’ file is different one. But there are a bunch of other files missing, like .pb.h files.

Hi, I had the same problem for my Mac with ios_example, when I launched it from xcode, I got error: #include “unsupported/Eigen/CXX11/Tensor” it said that it can not find the Tensor file. So I just followed here, to add this line #include “unsupported/Eigen/CXX11/Tensor” inside the Tensor file(which is located in: tensorflow/tensorflow/contrib/makefile/downloads/eigen/unsupported/Eigen/CXX11/Tensor), but when I run it again in xcode, it did not work, I got the same error.

Here is the content for the Tensor file:

// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright © 2014 Benoit Steiner benoit.steiner.goog@gmail.com // Copyright © 2013 Christian Seiler christian@iwakd.de // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

//#ifndef EIGEN_CXX11_TENSOR_MODULE //#define EIGEN_CXX11_TENSOR_MODULE

#include “unsupported/Eigen/CXX11/Tensor” #include “…/…/…/Eigen/Core”

#include <Eigen/src/Core/util/DisableStupidWarnings.h>

#include “…/SpecialFunctions” #include “src/util/CXX11Meta.h” #include “src/util/MaxSizeVector.h”

/** \defgroup CXX11_Tensor_Module Tensor Module *

  • This module provides a Tensor class for storing arbitrarily indexed
  • objects. *
  • \code
  • #include <Eigen/CXX11/Tensor>
  • \endcode */

#include <cmath> #include <cstddef> #include <cstring>

#ifdef _WIN32 typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else #include <stdint.h> #endif

#if __cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900 #include <random> #endif

#ifdef _WIN32 #include <windows.h> #elif defined(APPLE) #include <mach/mach_time.h> #else #include <time.h> #endif

#ifdef EIGEN_USE_THREADS #include “ThreadPool” #endif

#ifdef EIGEN_USE_GPU #include <iostream> #include <cuda_runtime.h> #if defined(CUDACC) #include <curand_kernel.h> #endif #endif

#include “src/Tensor/TensorMacros.h” #include “src/Tensor/TensorForwardDeclarations.h” #include “src/Tensor/TensorMeta.h” #include “src/Tensor/TensorFunctors.h” #include “src/Tensor/TensorCostModel.h” #include “src/Tensor/TensorDeviceDefault.h” #include “src/Tensor/TensorDeviceThreadPool.h” #include “src/Tensor/TensorDeviceCuda.h” #include “src/Tensor/TensorIndexList.h” #include “src/Tensor/TensorDimensionList.h” #include “src/Tensor/TensorDimensions.h” #include “src/Tensor/TensorInitializer.h” #include “src/Tensor/TensorTraits.h” #include “src/Tensor/TensorUInt128.h” #include “src/Tensor/TensorIntDiv.h” #include “src/Tensor/TensorGlobalFunctions.h”

#include “src/Tensor/TensorBase.h”

#include “src/Tensor/TensorEvaluator.h” #include “src/Tensor/TensorExpr.h” #include “src/Tensor/TensorReduction.h” #include “src/Tensor/TensorReductionCuda.h” #include “src/Tensor/TensorArgMax.h” #include “src/Tensor/TensorConcatenation.h” #include “src/Tensor/TensorContractionMapper.h” #include “src/Tensor/TensorContractionBlocking.h” #include “src/Tensor/TensorContraction.h” #include “src/Tensor/TensorContractionThreadPool.h” #include “src/Tensor/TensorContractionCuda.h” #include “src/Tensor/TensorConversion.h” #include “src/Tensor/TensorConvolution.h” #include “src/Tensor/TensorFFT.h” #include “src/Tensor/TensorPatch.h” #include “src/Tensor/TensorImagePatch.h” #include “src/Tensor/TensorVolumePatch.h” #include “src/Tensor/TensorBroadcasting.h” #include “src/Tensor/TensorChipping.h” #include “src/Tensor/TensorInflation.h” #include “src/Tensor/TensorLayoutSwap.h” #include “src/Tensor/TensorMorphing.h” #include “src/Tensor/TensorPadding.h” #include “src/Tensor/TensorReverse.h” #include “src/Tensor/TensorShuffling.h” #include “src/Tensor/TensorStriding.h” #include “src/Tensor/TensorCustomOp.h” #include “src/Tensor/TensorEvalTo.h” #include “src/Tensor/TensorForcedEval.h” #include “src/Tensor/TensorGenerator.h” #include “src/Tensor/TensorAssign.h” #include “src/Tensor/TensorScan.h”

#include “src/Tensor/TensorExecutor.h” #include “src/Tensor/TensorDevice.h”

#include “src/Tensor/TensorStorage.h” #include “src/Tensor/Tensor.h” #include “src/Tensor/TensorFixedSize.h” #include “src/Tensor/TensorMap.h” #include “src/Tensor/TensorRef.h”

#include “src/Tensor/TensorIO.h”

#include <Eigen/src/Core/util/ReenableStupidWarnings.h>

//#endif // EIGEN_CXX11_TENSOR_MODULE

Any help, thanks in advance

Ok I’ve just tried the makefile fix @magicwifi suggested above (but in pi_examples/_label_image rather than pi_examples/camera), i.e. the reference to “eigen-latest/” becomes “eigen/”.

I now have a working binary in tensorflow/contrib/pi_examples/label_image/gen/bin/label_image 😃

For the poor future engineer that stumbles upon this thread because they’re trying to build a lib/app using another build system using tensorflow…

I was able to build against the latest (2.1) Tensorflow and get around this issue by adding the following lines in cmake (which directly translate to include directives):

include_directories(<path to bazel-genfiles>/bazel-genfiles/tensorflow/include)
include_directories(<path to bazel-genfiles>/bazel-genfiles/tensorflow/include/src)

BUT there’s a CRUCIAL step. There’s a naming issue. You’ll need BOTH third_party AND third-party directories. That is, copy the third_party directory in bazel-genfiles/tensorflow/include to third-party. This also works if you are using the headers from extracting the python wheel (you’ll notice in that case that the headers are split between two folders in the wheel).

it skips to other error

@tusharsoni08 a little different when compling some package between in ubuntu and in raspbian