Closed luciansmith closed 5 years ago
@mingwandroid I believe it got through testing because as @luciansmith described, the installer itself is fine. It is a self-consistent set. Somehow updating brings in some other software that might be built against mkl 2018, and that triggers the issue. I'm not sure exactly why an update would use an older MKL, but I'll try to reproduce.
Thanks so much @msarahan ! I really appreciate it! Let me know if you need more testing data from me.
@janm97 Did you try
conda install mkl=2018.0.2
?
This fixed my problem. Thank-you.
I'm having the same problem. Just did a brand new installation of Anaconda 3.7, then tried installing spyder from Anaconda Navigator and got the error mentioned above. I tried using the "Conda install mkl=2018.0.2" mentioned above and got the following error:
(base) C:\Users\Rodrigo>conda install mkl=2018.0.2 Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
Spyder comes pre-installed with Anaconda and therefore does not need to be installed. Did you use Minicoda instead here?
No I used the full Anaconda. I appologize, the error occurs when you click launch in the Anaconda Navigator to run spyder.
got the error mentioned above.
As you can see from your error message, this is not the exact same error, as the mentioned DLL is different. Post the full output of where libiomp5md.dll
run in Anaconda prompt here; it is possible that it is due to another program's DLLs conflicting with the indicated one rather than anything to do with mkl itself.
UnsatisfiableError: The following specifications were found to be in conflict:
This is due to mkl
< 2018.0.3 not being built for Python 3.7. You can try the above suggestions to fix the root problem, and if that doesn't work do conda install python=3.6 mkl=2018.0.2
though you'll be stuck on Python 3.6 until the root problem (either with mkl or with your system, whichever is the case here) is fixed.
you click launch in the Anaconda Navigator to run spyder.
FYI, AFAIK there is no advantage to launch Spyder via the method, as it is vastly faster to merely launch it via the Start menu shortcut on Windows like with any other application (just tap Win
and start typing spyder
) than going through the extra layer of complexity that Navigator poses as well as potential for additional errors and problems, unless you need to launch it in a specific environment and don't want to use Anaconda prompt for that.
Here is the output of the were command in the Anaconda prompt:
(base) C:\Users\Rodrigo>where libiomp5md.dll C:\Users\Rodrigo\Anaconda3\Library\bin\libiomp5md.dll C:\Windows\System32\libiomp5md.dll
Running spider directly from windows (outside of Navigator) generates the same error.
Will running "Conda install python=3.6 mkl=2018.0.2" replace the current 3.7 installation or create a new environment? I would like to avoid having many environments and would be ok with having just 3.6 on my machine.
Thanks for the help, by the way! :)
Here is the output of the were command in the Anaconda prompt:
Thanks. As you can see, another program on your machine has installed a DLL with an identical name in directly in the System32
directory, which is a very bad practice and a recipe for all sorts of problems. I'm not sure what program it could be, but there are various ways to find out. In any case, there is nothing we can do about this on our end; this needs to be fixed on your machine by uninstalling the offending other program, removing the DLL (and seeing what breaks), etc.
Will running "Conda install python=3.6 mkl=2018.0.2" replace the current 3.7 installation or create a new environment?
It will modify the current default (base
) environment.
I'm not sure what program it could be, but there are various ways to find out.
I would bet that the program in question is called Amplitube. I've tried to contact the developers of this software to ask them not to do this egregious act but have been unable to get any response from them. I might have to renew my efforts. Ideally MKL's redistribution license would prohibit this!
https://mobile.twitter.com/_tmp_account/status/1083817363047370754
Please help to spread this if you can!
I would bet that the program in question is called Amplitube.
I thought the problematic DLLs with Amplitube were mkl_intel_core
, mkl_intel_thread
and mkl_def
so I wasn't sure if there were others, but I guess so if it uses all of mkl.
Ideally MKL's redistribution license would prohibit this!
Have you considered mentioning it to your Intel contacts from that end?
We have. We're trying to figure out DLL load tricks that will prevent the problem. We will also explore application manifests, but that's hard to get right - you'd have to re-generate the whole manifest for all libraries in an env any time that any of them were updated.
Okay, great—thanks for the update @msarahan . Meanwhile, any progress figuring out what's going on in the cases like mine where there aren't any conflicting DLLs in System32 (or anywhere else on the where
path) that could be causing the problem? Anything else you want me to try? Thanks!
I have a fresh Anaconda (2018.12) install on Windows 10 with this issue, and I do not have Amplitube installed (never heard of it). The fix for me was finding libiomp5md.dll
in my system32 folder and renaming it. No idea which program uses it, but hopefully I don't have to find out. Otherwise, simply reverting to mkl 2018.0.2 and python 3.6 didn't completely help (I could at least import numpy, but certain functions still caused errors on loading).
I have a fresh Anaconda (2018.12) install on Windows 10 with this issue, and I do not have Amplitube installed (never heard of it). The fix for me was finding
libiomp5md.dll
in my system32 folder and renaming it. No idea which program uses it, but hopefully I don't have to find out. Otherwise, simply reverting to mkl 2018.0.2 and python 3.6 didn't completely help (I could at least import numpy, but certain functions still caused errors on loading).
I had the same problem "missing ordinal 242 in Anaconda3\Library\bin\mkl_intel_thread.dll" and renaming the libiomp5md.dll file in the system32 folder has fixed it!
@CAM-Gerlach sorry, I've got nothing. The one other DLL we've seen causing this issue is the openmp runtime, libiomp5md.dll
Okay, thanks @msarahan . I guess I should just do a full, clean reinstall of Anaconda; I've just been putting it off since I don't want to have to re-create all my environments and such.
I really don't think that will help. I think the conflict is with other software on your system. Reinstalling Anaconda won't fix those conflicts.
Holy s%%t! Amplitube uninstalled and Python libraries suddenly work!!!!!! Thanks!!!!! Troubled me entire month.
"message about a missing ordinal 242 in Anaconda3\Library\bin\mkl_intel_thread.dll"
Confirmed with the latest Anaconda Python 3 64-bit from www.anaconda.com/download/:
I have a way how to replicate this problem (with Anaconda Python in my PATH), just open cmd and
C:\Users\sobriety>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import matplotlib.pyplot as plt
>>> plt.show()
>>> plt.plot([])
[<matplotlib.lines.Line2D object at 0x000001BD881038D0>]
>>> plt.show()
And we got "missing ordinal 242 in Anaconda3\Library\bin\mkl_intel_thread.dll".
Doesn't look like libiomp5md.dll problem:
C:\Users\sobriety>where libiomp5md.dll
C:\Users\sobriety\AppData\Local\Continuum\anaconda3\Library\bin\libiomp5md.dll
No amplitube present:
C:\Users\sobriety>conda remove amplitube
Solving environment: failed
PackagesNotFoundError: The following packages are missing from the target environment:
- amplitube
This has fixed the problem:
Conda install python=3.6 mkl=2018.0.2
@ChaoticRoman Amplitube isn't an Anaconda package, so it naturally wouldn't be uninstalled by conda remove amplitube
. It needs to be checked for removed through Programs and Features
.
Doesn't look like libiomp5md.dll problem:
No, because the error you got was
missing ordinal 242 in Anaconda3\Library\bin\mkl_intel_thread.dll
Therefore, you should check where mkl_core.dll
and where mkl_intel_thread.dll
and post the results.
Also, check your Programs and Features
list for Amplitube, or any of the other applications reported here. Thanks.
Thank you for quick reply, CAM-Gerlach!
Therefore, you should check
where mkl_core.dll
andwhere mkl_intel_thread.dll
and post the results.
Right now, after the Conda install python=3.6 mkl=2018.0.2
, there is
C:\Users\sobriety>where mkl_core.dll
C:\Users\sobriety\AppData\Local\Continuum\anaconda3\Library\bin\mkl_core.dll
C:\Users\sobriety>where mkl_intel_thread.dll
C:\Users\sobriety\AppData\Local\Continuum\anaconda3\Library\bin\mkl_intel_thread.dll
Should I somehow revert and try it again with failing bits in place?
Also, check your
Programs and Features
list for Amplitube, or any of the other applications reported here. Thanks.
No discussed programs seen, it is clean Windows 10 Pro x64 installation and only this has been installed:
Thanks for the detailed reply, @ChaoticRoman . That's rather puzzling, indeed. Can you open the Anaconda prompt from the Start Menu, run the above commands in Python, and make sure you still see the error?
Assuming you do, can you post the output of echo %PATH%
from Anaconda prompt in the environment in which you are running the above commands and getting the error (presumably base
by default)?
The basic idea is you'll then want to search any of the directories identified on the %PATH%
that aren't Anaconda-related for any .dll
s that contain the string omp
or mkl
and report the results. I think I've actually found the culprit in my install, even though those commands came back clean. Thanks!
@mingwandroid @msarahan I finally isolated and resolved the issue on my machine; it was the report involving OpenMP that clued me in.
To make a long story short, I found a number of instances of OpenMP-related DLLs a few different places on my %PATH%
, and after a good deal of testing, one in particular turned out to be the culprit: C:\Windows\System32\libiomp5md.dll
, despite it not being referenced in the error message. Everything works fine now.
So, I can't be certain since I've uninstalled it many years ago, but some sleuthing revealed that GoPro Studio (at least older versions) appears to have been the probable original culprit here that people should check for. Also, interestingly enough, Intel Visual Fortran Redistributables on IA-32 (included with a proprietary scientific application, not sure which) also includes its DLLs in a common location which it places on the %PATH%
; although it doesn't seem to trigger this particular problem, it has dozens of DLLs that are all in common with those in Library/bin/
, as Anaconda no doubt uses the same Intel shared libraries for MKL/OpenMP/etc.
Also, FYI @ChaoticRoman you should be able to trigger the error by simply executing
import matplotlib.pyplot as plt
plt.plot([])
The other lines were not necessary, at least for me.
Here is "the long story" detailing the specifics of what I found, for anyone (morbidly) curious...
Yep, other applications on PATH won't interfere with Anaconda Prompt, because Anaconda Prompt puts our entries up front. Doing that would be too disruptive as a global modification to PATH - that's why we recommend Anaconda Prompt. Running our other start menu shortcuts does similar stuff.
System32 is higher in priority than anything on PATH (https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order#standard-search-order-for-desktop-applications). It doesn't matter what we try to do with PATH if a 3rd party has put DLLs into System32. Manifests may still help us if we can figure that out someday.
Thansk for your patience, @CAM-Gerlach
[...]open the Anaconda prompt from the Start Menu, run the above commands in Python, and make sure you still see the error?
Everything is fine after Conda install python=3.6 mkl=2018.0.2
.
Assuming you do, can you post the output of
echo %PATH%
from Anaconda prompt in the environment in which you are running the above commands and getting the error (presumablybase
by default)?
OK, uninstalling Anaconda and installing it again. I have find out that we have these crashes in my application scripts but not while trying normal replication . But I have find out that if working directory is a place, where we have these scripts, it does crash:
C:\Program Files\MercuryRT-v2.7DE>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
C:\Program Files\MercuryRT-v2.7DE>
[...]any .dlls that contain the string omp or mkl and report the results. I think I've actually found the culprit in my install, even though those commands came back clean. Thanks!
C:\Program Files\MercuryRT-v2.7DE>dir *omp*.dll *mkl*.dll
Volume in drive C has no label.
Volume Serial Number is A432-6ABC
Directory of C:\Program Files\MercuryRT-v2.7DE
08.10.2018 12:55 885 096 libiomp5md.dll
08.10.2018 12:56 176 512 vcomp140.dll
20.07.2018 11:01 152 064 vtkCommonComputationalGeometry-8.1.dll
So this seems to be the actual problem, not Anaconda itself, but running our scripts from bad location.
Everything is fine after
conda install python=3.6 mkl=2018.0.2
.
Sorry, what I said was very confusing. What I meant was to switch back to the current version of mkl
and run the commands
import matplotlib.pyplot as plt
plt.plot([])
from the Anaconda prompt, not the regular command line, just in case there was some issue with your %PATH%
that the latter would avoid. However, that's a moot point now.
can you post the output of echo %PATH% from Anaconda prompt
OK, uninstalling Anaconda and installing it again.
Sorry, what? How did "post the output of echo %PATH%
" get interpreted as "reinstall Anaconda? As @msarahan said about my case, this isn't going to fix the problem if it is a conflict, as seemed likely was the case (and in fact was).
So this seems to be the actual problem, not Anaconda itself, but running our scripts from bad location.
Yes. The problem is that the DLL search path order will always search the current directory before the PATH
, so it will find those DLLs instead of the correct Anaconda ones. To resolve this, just make sure not to run your scripts from the same directory as those conflicting DLLs, or you're likely to run into more issues in the future.
Yep, and the ultimate solution is finding ways to overcome the problems with the search order, such as manifest files that specify particular versions, so that the globally installed ones won't get used if they are not compatible.
Yeah, I was wondering if there was a way to simply check the version string of the first found DLL and fall through to the next one if it doesn't match what the package is compiled against. But I figured it was Microsoft so it couldn't be that easy, heh.
@CAM-Gerlach, we (Anaconda) have a potential workaround for the Windows DLL search order. It's in our latest python builds on the c3i_test2 anaconda.org channel:
python 2.7.15 build 7 3.6.8 build 1 3.7.2 build 1
Try updating python using the c3i_test2 channel:
conda update python -c c3i_test2
Those are great new Ray!! How did you manage to do it?
Mike beat me to it. Interestingly, numpy had adopted a very similar approach but backed off from doing it.
For sure it's a nuclear option, but the other idea I had is far worse (DLL hooking of kernel32.dll
- if that's even possible at present, and if it is, if it would remain possible in the future, and there's also a big question as to whether or not virus scanners would class doing this as a virus).
Thanks Mike!! It looks very interesting!
So what are you trying to do exactly? Putting Anaconda's Library
dir in front of DLL's search path?
We are changing the DLL search order from:
dirname(exe_path)
C:\Windows\System32
PATH
.. to ..
dirname(exe_path)
PATH (which usually ends with C:\Windows\System32 anyway)
@mingwandroid @msarahan Thanks so much! I tested it by removing the .bak
extension I'd added to the offending DLL, ensuring the error was triggered with the current Python (3.6.7), and then upgrading to the 3.6.8 build from that channel. Indeed, no error occurred when either trying the aforementioned simplified procedure from the standard Python console that previously produced it, nor launching and running numpy/matplotlib commands from Spyder.
BTW, I got a conda
error when trying to switch Python back to the defaults
version, but I suspect its unrelated since its happened before several times recently after flipping package versions around. (As far as I know, I had closed Spyder and all Python processes in that environment first, and made sure no Anaconda-related directories were opened in my file manager, upgrading to the latest conda
version did not resolve it either, and I couldn't find many relevant search results).
I fixed it, as I did in previous cases, by just doing find . -type f -name "*.c~" -delete
on the /c/Anaconda3/envs/spyder-4-lsp
directory and re-running the install command. For reference, the files found:
Thanks!
Thank you for the feedback.
['System32\libiomp5md.dll', 'System32\mkl_core.dll', 'System32\mkl_def.dll','System32\mkl_intel_thread.dll', 'SysWOW64\libiomp5md.dll','SysWOW64\mkl_core.dll','SysWOW64\mkl_intel_thread.dll', 'SysWOW64\mkl_p4.dll', 'SysWOW64\mkl_p4m.dll','SysWOW64\mkl_p4m3.dll', 'SysWOW64\mkl_p4p.dll']
Remove all these ddl files from C:\Windows\SysWOW64 and C:\Windows\System32
Just do this and restart the spyder once again and hurrrahhhh!!! ur problem will be solved and spyder will open without showing any ordinal 242 error............just do it it is the only solution..
Remove all these ddl files
I strongly advise against the removing the DLLs in case they break something you need (something had to put them there) and instead adding the .bak
extension.
C:\Windows\SysWOW64
FYI, this isn't necessary unless for some odd reason you are using the legacy 32-bit version of Anaconda, which you really shouldn't be (unless you're on a >10 year old machine that's unlikely to be able to run Anaconda adequately anyway, or accidentally bought a 32-bit version of Windows that MS keeps around for enterprises running ancient 16-bit DOS software from >3 decades ago.
it it is the only solution..
As you can see in the previous few comments, @mingwandroid stated and I confirmed this should be worked around by the upcoming next release of the Anaconda python interpreter executable, without having to do any of this.
@mingwandroid It seems there is a big discussion going on about this upstream...you involved in that?
@CAM-Gerlach we're not sure about our new approach with the library loading. It may fix a lot of people, but it may also break a lot more. We're leaning right now towards providing the new changed capability disabled by default, but switchable with an environment variable. I'll link to docs here when we have them.
PS: I'm having trouble reproducing the error. I would like to try to catch it somehow in order to direct people who encounter the problem to our new docs. Do you have any specific tips on how to reproduce this? I have tried to install ancient MKL into my System32 folder (2018, 2017, even 11), but in a clean python 3.7, numpy 1.15.4, MKL 2019 env, I can't get the error to come up. Procmon shows the old libraries getting loaded from System32 - I'm just confused as to how the error is not showing up. Is there a specific numpy operation that triggers the issue for you?
PS: ancient MKL included intel-openmp (libiomp5md.dll). I have also tried installing older versions there, too.
Thanks for the update @msarahan . Will the docs discuss what to look out for in terms of the types of usecases where enabling this change to the DLL search order for Anaconda would break desired functionality?
The major one we've found was with pytorch and cuda. https://github.com/pytorch/pytorch/issues/17051
Aside from this, it just scares me to have our software override whatever is in system32. To be sure, the root problem here of 3rd party vendors installing things to system32 is bad, but we should not create potential security/driver confusion by trying to compensate for that.
@msarahan The fastest way I found to reliably trigger it was python
then
import matplotlib.pyplot as plt
plt.plot([])
You might need to go older with your DLL versions. I attached the libiomp5md.dll
that triggers it for me; its from 2009 vintage.
Aside from this, it just scares me to have our software override whatever is in system32.
I mean, if I understand correctly its only overriding the DLL loading order for A. Code running on the Anaconda Python interpreter, and B. To only move the local, Anaconda-controlled DLL search directories above System32 (do you check that its somewhere on the PATH already, and if not add it at the end just in case?).
Isn't the worst that can happen (which, isn't good but isn't the end of the world) is it breaks specific packages running under Anaconda that rely on hacky DLL search/load tricks themselves, or for some reason need the version of a DLL in Sysetem32 to appear higher in the path than anything locally?
And in terms of security/driver issues, I assume a package could cause a DoS (or much worse, with some effort) by shipping a bad or malicious ntdll.dll or something, but at that point if it can drop arbitrary DLLs on the system then it could drop any other malicious payload instead anyway, and as far as I understand they are only loaded in the context and permissions of the Python interpreter running the process, which the malicious package presumably already effectively controls?
Or is it possible to drop copies of malicious DLLs locally inside the Anaconda environment on the search path, and then that important DLL get loaded instead of the real one if another Anaconda Python interpreter process performs a low-level system call, in order to intercept data or escalate privileges (e.g. wait for the user in an admin install to run conda
as admin, then take control of that process via a malicious low-level DLL dropped on the PATH? I'm no security expert, much less do I have much knowlege about the arcane internals of Windows, but I'm wondering what's really possible or not if this change goes through.
@mingwandroid Ray, I may have a use case that isn't solved by the patch.
I recently had to install the Intel Fortran compiler, and even with the c3i_test2 version I have the same dll error.
λ where mkl_core.dll
C:\Program Files x86)\IntelSWTools\compilers_and_libraries_2016.1.146\windows\redist\ia32\mkl\mkl_core.dll
C:\Users\<username>\Programs\Anaconda3\Library\bin\mkl_core.dll
Since the offending dll is not in the System32 directory, is this falling outside of what the patch is trying to accomplish? My initial (albeit uneducated) guess would be that somehow ifort is still taking precedence in the system, but I don't know nearly enough about it to know how to fix that.
@dolson14 Take all of this with a grain of salt since I'm no Windows DLL expert like @mingwandroid and @msarahan , nor am I an Anaconda employee, just a Spyder dev.
However, I'm not sure how the compiler is injecting its location higher onto the path than Anaconda. Assuming conda activate
is working correctly, it should always be higher in the search order than anything else, at least when launching anything from the Anaconda prompt, except if the user has run a script/program of some sort after activate
ing the environment that deliberately set the path differently. In that case, its not really something that can be solved on Anaconda's side in my limited understanding, except by using very techniques like manifests and the like.
Have you run any commands, scripts or programs after activate
ing your environment? If you type conda activate your-env-name
with the latest version of conda
, and then run where mkl_core.dll
again, do you see the same result? Are you getting the error in Spyder, or something else? What packages have you installed in this environment (conda list --show-channel-urls
)? Does it persist in other environments?
@dolson14 is likely not activating the environment. PATH works in a line. Activating lets us come first without raising hell with other software. Not activating means you're at the mercy of order, where generally only appending is safe, and you're thus in a situation where the earliest installed software has higher priority than newer stuff.
Problem Description
A clean conda install from https://www.anaconda.com/download/#windows (version 5.2.0) works for Spyder, but if I then do a 'conda update --all', the resulting configuration is broken. When you run Spyder, launching from Anaconda navigator, you get a message about a missing ordinal 242 in Anaconda3\Library\bin\mkl_intel_thread.dll
This turns out to be because the dlls from mkl-2018.0.3-1 are installed in Anaconda3\Library\bin\, but something in Spyder needs the dlls from mkl-2018.0.2-1 instead. If you copy the dlls from Anaconda3\pkgs\mkl-2018.0.2-1\Library\bin into Anaconda3\Library\bin, Spyder then launches normally. (This probably breaks something else, but if so, it's something I haven't yet tried to use ;-)
What steps reproduce the problem?
What is the expected output? What do you see instead?
Paste Traceback/Error Below (if applicable)
Versions
Dependencies