<p dir="auto">The simple <code class="notranslate">pip3 install numpy</code> worked the first time I tried it on this RHEL6 system. Then I added the <code class="notranslate">atlas-devel</code> (and <code class="notranslate">atlas</code>) packages via yum, uninstalled and tried installing it again.</p>
<h3 dir="auto">Reproducing code example:</h3>
<p dir="auto"><code class="notranslate">pip3 install numpy</code></p>

<h3 dir="auto">Error message:</h3>
<p dir="auto">The error is triggered by an attempt to pass <code class="notranslate">-DATLAS_INFO="\"3.8.4\""</code> to the compiler. Somehow this results in a bunch of "unmatched quote" errors.</p>
<p dir="auto">I'm including the full output of the (failed) install:<br>
<a href="https://github.com/numpy/numpy/files/2390146/numpy-install.log">numpy-install.log</a>. It ends with:</p>
<p dir="auto"><code class="notranslate">error: Command "/prod/pfe/local/bin/gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O3 -march=native -pipe -O3 -march=native -pipe -fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DHAVE_CBLAS -DATLAS_INFO="\"3.8.4\"" -I/usr/include -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Inumpy/core/include -Ibuild/src.linux-x86_64-3.6/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/prod/pfe/local/include/python3.6 -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -c numpy/core/src/multiarray/temp_elide.c -o build/temp.linux-x86_64-3.6/numpy/core/src/multiarray/temp_elide.o -MMD -MF build/temp.linux-x86_64-3.6/numpy/core/src/multiarray/temp_elide.o.d" failed with exit status 1</code></p>
<h3 dir="auto">Numpy/Python version information:</h3>

<p dir="auto">Trying to install the latest numpy (1.15.1 at this time). Python-3.6.6.</p>
<p dir="auto">This is a weird bug that is hard to reproduce because, honestly, we don't know what's causing it. A code I work on at NASA uses f2py in a couple of places. And, say, for me, there is never any problem. But for a growing number of our users, they have an issue where f2py just does not work for them. The symptom seems to be that something in their environment causes the f2py compiler detection (done through distutils, I think) to go a bit nuts. For example, for some users if they have:</p>
<p dir="auto"><code class="notranslate">echo</code></p>
<p dir="auto">in their .cshrc/.tcshrc file, f2py stops working.</p>
<p dir="auto">Now, in some cases, I can get them working by instead of just pointing to the name of the compiler:</p>
<p dir="auto"><code class="notranslate">f2py    --f77exec=mpiifort --f90exec=mpiifort --fcompiler=intelem</code></p>
<p dir="auto">I pass in the full path:</p>
<p dir="auto"><code class="notranslate">f2py    --f77exec=/full/path/to/mpiifort --f90exec=/full/path/to/mpiifort --fcompiler=intelem</code></p>
<p dir="auto">But, again, this doesn't always work. For some users it doesn't help, the issue seems to be that even though we've told f2py that we are using Intel/intelem, it finds gfortran in the environment, tells ifort to use the flags for that, and ifort -fopenmp crashes.</p>
<p dir="auto">Eventually, a user was able to "fix" this by adding a line to <code class="notranslate">exec_command.py</code> after:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/numpy/numpy/blob/d210300bc1b1a849a5df618b47b00cba501f51b4/numpy/distutils/exec_command.py#L233-L240">numpy/numpy/distutils/exec_command.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 233 to 240
      in
      <a data-pjax="true" class="commit-tease-sha" href="/numpy/numpy/commit/d210300bc1b1a849a5df618b47b00cba501f51b4">d210300</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L233" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="233"></td>
          <td id="LC233" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-s1">os</span>.<span class="pl-s1">name</span> <span class="pl-c1">==</span> <span class="pl-s">'posix'</span> <span class="pl-c1">and</span> <span class="pl-s1">use_shell</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L234" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="234"></td>
          <td id="LC234" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-c"># On POSIX, subprocess always uses /bin/sh, override</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L235" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="235"></td>
          <td id="LC235" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">sh</span> <span class="pl-c1">=</span> <span class="pl-s1">os</span>.<span class="pl-s1">environ</span>.<span class="pl-en">get</span>(<span class="pl-s">'SHELL'</span>, <span class="pl-s">'/bin/sh'</span>) </td>
        </tr>

        <tr class="border-0">
          <td id="L236" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="236"></td>
          <td id="LC236" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">if</span> <span class="pl-en">is_sequence</span>(<span class="pl-s1">command</span>): </td>
        </tr>

        <tr class="border-0">
          <td id="L237" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="237"></td>
          <td id="LC237" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1">command</span> <span class="pl-c1">=</span> [<span class="pl-s1">sh</span>, <span class="pl-s">'-c'</span>, <span class="pl-s">' '</span>.<span class="pl-en">join</span>(<span class="pl-s1">command</span>)] </td>
        </tr>

        <tr class="border-0">
          <td id="L238" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="238"></td>
          <td id="LC238" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">else</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L239" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="239"></td>
          <td id="LC239" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1">command</span> <span class="pl-c1">=</span> [<span class="pl-s1">sh</span>, <span class="pl-s">'-c'</span>, <span class="pl-s1">command</span>] </td>
        </tr>

        <tr class="border-0">
          <td id="L240" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="240"></td>
          <td id="LC240" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">use_shell</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">of <code class="notranslate">command.insert(1, '-f')</code>. By doing this, the shell command does not load the rc file in tcsh/csh.</p>
<p dir="auto">By default, <code class="notranslate">tcsh -c command</code> will source the resource file, which can lead to issues. (For other shells, <code class="notranslate">-f</code> seems to be pretty neutral in, say, bash and zsh. I haven't tested in fish, but I'm guessing fish is weird enough it doesn't work.) We can't envision scenarios where f2py needs environment variables from sourcing the resource/startup files when this command is run.</p>
<p dir="auto">Our shop mainly uses tcsh as the interactive shell due to historical and practical reasons, so this is important to us, so much so that we are planning on editing any <code class="notranslate">numpy</code> we get from Anaconda, Intel, wherever.</p>
<h3 dir="auto">Reproducing code example:</h3>
<p dir="auto">I was able to reproduce this with and without the <code class="notranslate">echo</code> in the rc file using the <code class="notranslate">fib1.f</code> example here: <a href="https://docs.scipy.org/doc/numpy/f2py/getting-started.html" rel="nofollow">https://docs.scipy.org/doc/numpy/f2py/getting-started.html</a> but another user couldn't replicate it.</p>

<h3 dir="auto">Error message:</h3>
<p dir="auto">I'm attaching three files for this so you can see what's happening. In one case I pass in the full FC path and things work. In the next, I don't use the full path and it fails. In the last, I patch our distutils and don't pass in the full path and things work.</p>
<p dir="auto"><a href="https://github.com/numpy/numpy/files/2325168/fullfc.log">fullfc.log</a><br>
<a href="https://github.com/numpy/numpy/files/2325169/nofullfc.log">nofullfc.log</a><br>
<a href="https://github.com/numpy/numpy/files/2325170/nofullfc.patch.log">nofullfc.patch.log</a></p>
<p dir="auto">I'll also attach two files from a colleague who got hurt with this and he inserted prints into the f2py process:</p>
<p dir="auto"><a href="https://github.com/numpy/numpy/files/2325189/outY.log">outY.log</a><br>
<a href="https://github.com/numpy/numpy/files/2325190/outX.log">outX.log</a></p>
<p dir="auto">This seems to show it's during the <code class="notranslate">exec_command</code> for the compiler version.</p>
<h3 dir="auto">Numpy/Python version information:</h3>

<p dir="auto"><code class="notranslate">('1.14.2', '2.7.14 |Anaconda, Inc.| (default, Mar 27 2018, 17:29:31) \n[GCC 7.2.0]')</code></p>