1

System Info

Windows 10 Home 64-bit(10.0, build 14393)

Python 3.5.2 |Anaconda 4.1.1 (64-bit)|

Intel Parallel Studio XE 2017

Problem Encountered

I try to follow the example in f2py user guide and launch cmd in local directory and type the following

f2py -c fib1.f -m fibtest

and everything seems OK until

Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe
LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 /LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit_fibtest C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fibtestmodule.obj C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fortranobject.obj C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\fib1.o /OUT:.\fibtest.cp35-win_amd64.pyd /IMPLIB:C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fibtest.cp35-win_amd64.lib" failed with exit status 1104

The error: was added 9/27/2016 for more info.

I notice that the path after error: is all in a C: while my intel fortran is installed in a D:, I guess it's the point to blame?

Tried Solutions

This problem seems identical to the last comment in F2PY cannot find intel fortran compiler on windows 7, so I tried the ways there by typing

f2py -c fib1.f -m fibtest -L"D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\compiler\lib\intel64"

and it did work.

By myself, I try to launch the cmd from Compiler 17.0 for Intel 64 Visual Studio 2015 environment, which is found in intel directory in the start menu.

After redirecting to the directory of fib1.f, simply typing

f2py -c fib1.f -m fibtest

also works good.

So, is there a better way to solve the problem so that I can do the work in a locally launched cmd with a simple typing?

The following was added 9/27/2016 after checking the answer from Steve:

I believe the shortcut is the same as my second tried solution and the call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64 did offer me an alternative while I'm still wondering an automatic solution.

Community
  • 1
  • 1
Frank Han
  • 39
  • 1
  • 8
  • From the OP *"I'm sorry for that I'll be off for about half a day and may not give a quick reply."* – Vladimir F Героям слава Sep 26 '16 at 13:52
  • As you noticed I deleted your **edit** before. You don't also have to write *The following was added 9/27/2016...* Stack Overflow shows this automatcally. Notice the * edited 2 hours ago* under the question. When you click on it you see the full history. No need to state edit1, edit 2 or put a date. – Vladimir F Героям слава Sep 26 '16 at 19:23
  • And BTW that command from Steve Lionel *is* automatic. Just let it run on every login. When I was using Microsoft OS regularly last time it was in `autoexec.bat`. Probably it is somewhere else now. – Vladimir F Героям слава Sep 26 '16 at 19:25
  • I didn't find a autoexec.bat, but I tried to add `call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64` to `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\AutoRun`. As a result, every time I launch a cmd, it seems just stuck in an endless loop. I guess the `call` itself give birth to a new `AutoRun`. @VladimirF – Frank Han Sep 27 '16 at 10:36

1 Answers1

1

You need to set up the Intel Fortran environment somehow. The easiest way is to use the shortcut that gets installed. But if you type this once in your command window it should allow you to omit the -L option later:

call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64

You will have established the environment correctly.

Steve Lionel
  • 6,972
  • 18
  • 31
  • Yes, using the shortcut is the same as my second tried solution and the call is just a manual way to launch the environment, right? I still wonder if there was somehow automatic way. – Frank Han Sep 26 '16 at 16:44
  • Yes, the call is the same as using the shortcut. You could create your own shortcut to a .bat file that sets up the environment you want. There's nothing more automatic that I would recommend. – Steve Lionel Sep 27 '16 at 14:27