Why do I get an MKL error when running my python script on MacOS
Question:
I have a python script that was converted from an .ipynb notebook from Google Colab that I’m trying to run natively on my Mac running Big Sur.
When I try to run the script using python scriptname.py it gives me the following error:
NTEL MKL ERROR: dlopen(/Users/MyUser/opt/anaconda3/lib/libmkl_core.dylib, 9): image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_core.dylib.
It occurs immediately after I try to import pandas
.
I tried conda update numpy
as suggested here but the problem persists.
I wondered if I didn’t have pandas installed but I did pip install pandas
and I got Requirement already satisfied
for all 6 packages.
Any help would be appreciated.
Answers:
Try following, to make sure it’s not something with your conda
stuff.
> python3 -m venv venv-38
> source venv-38/bin/activate
(venv-38) > pip3 install pandas
...
...
(venv-38) > python
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> quit()
** Update **
You can easily reuse this environment in all future terminal sessions. Let’s say you have this venv-38
inside $HOME
. All you have to do is to open terminal session, and then
> source $HOME/venv-38/bin/activate
since now, your Python
environment will be used as if it was installed inside venv-38
directory.
I finally found a solution for this. numpy
also gave me the same problem so I uninstalled it pip uninstall numpy
and reinstalled it pip install numpy
.
I suppose I’ll have to do this with all packages as I use them, but perhaps pyenv
will provide a useful solution to my problem if. ever get it working.
I have a python script that was converted from an .ipynb notebook from Google Colab that I’m trying to run natively on my Mac running Big Sur.
When I try to run the script using python scriptname.py it gives me the following error:
NTEL MKL ERROR: dlopen(/Users/MyUser/opt/anaconda3/lib/libmkl_core.dylib, 9): image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_core.dylib.
It occurs immediately after I try to import pandas
.
I tried conda update numpy
as suggested here but the problem persists.
I wondered if I didn’t have pandas installed but I did pip install pandas
and I got Requirement already satisfied
for all 6 packages.
Any help would be appreciated.
Try following, to make sure it’s not something with your conda
stuff.
> python3 -m venv venv-38
> source venv-38/bin/activate
(venv-38) > pip3 install pandas
...
...
(venv-38) > python
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> quit()
** Update **
You can easily reuse this environment in all future terminal sessions. Let’s say you have this venv-38
inside $HOME
. All you have to do is to open terminal session, and then
> source $HOME/venv-38/bin/activate
since now, your Python
environment will be used as if it was installed inside venv-38
directory.
I finally found a solution for this. numpy
also gave me the same problem so I uninstalled it pip uninstall numpy
and reinstalled it pip install numpy
.
I suppose I’ll have to do this with all packages as I use them, but perhaps pyenv
will provide a useful solution to my problem if. ever get it working.