0

Every once in a while my PyCharm, Numpy or conda environment breaks numpy and I get this error:

D:\Miniconda3\envs\main_env\python.exe "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\pydevconsole.py" --mode=client --port=51196
D:\Miniconda3\envs\main_env\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['D:\\SpineSegmentation', 'D:/SpineSegmentation'])
PyDev console: starting.
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] on win32
import numpy as py
C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py:21: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  module = self._system_import(name, *args, **kwargs)
Traceback (most recent call last):
  File "D:\Miniconda3\envs\main_env\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Miniconda3\envs\main_env\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Miniconda3\envs\main_env\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
  File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Miniconda3\envs\main_env\lib\site-packages\numpy\__init__.py", line 150, in <module>
    from . import core
  File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Miniconda3\envs\main_env\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
    https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
  * The Python version is: Python3.7 from "D:\Miniconda3\envs\main_env\python.exe"
  * The NumPy version is: "1.21.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed: The specified module could not be found.

This is the last time I got this error. I was even using PyCharm with the environment the same day as writing this without issue, closed PyCharm, did other computer stuff, reopened PyCharm and had this error now. No changes to the environment, PyCharm, computer, etc. This error seems to propagate every once in a while even without any prompting. I have no idea what I did or what is causing this issue, but it is infuriating, especially since it was literally just working only a few hours before hand.

I have no idea if this is relevant but since it is always the IntelPython that is giving problems, could it be related to the fact that I am on an AMD CPU, and if so, how do I fix it?

Edit: I have a simple script I can run in command prompt without issue, but trying to run it in PyCharm does not work. It seems to be an issue with PyCharm itself, but no idea how or why.

krolic
  • 51
  • 2
  • have you check the python you are using in pycharm is same as python in the konsole – sahasrara62 Apr 22 '22 at 20:31
  • Yes, the same environment. – krolic Apr 24 '22 at 13:54
  • As you mentioned that you're able to run your script through command prompt, the issue might not be with Intel Python. Instead it might be some path issue in PyCharm. Please check if you've given the right path in the Python interpreter. Also try creating a new virtual environment in PyCharm – Athira - Intel Apr 28 '22 at 10:59
  • The python path is fine, since it was working without issue a few hours before it broke. – krolic Apr 29 '22 at 12:04

0 Answers0