Additional Python modules in Micromine
Can anyone tell me how I can use external python modules (e.g. numpy, pandas) in Micromine scripts?
I have miniconda installed (I'm familiar with using conda to manage different environments outside of Micromine) and I've tried setting 'External Python Module Repository Paths' in the Micromine script editor to point to a folder containing numpy but the numpy import fails with the message below. I've followed the doc links in the message but I can't work out what the problem is.
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
We have compiled some common reasons and troubleshooting tips at:
Please note and check the following:
* The Python version is: Python3.8 from "C:\Program Files\Micromine Origin & Beyond 2022.5\mmwin.exe"
* The NumPy version is: "1.23.3"
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 while importing _multiarray_umath: The specified module could not be found.
File "C:\Offline Files\EGY\MmData\EDX\PyScripts\test.py", line 11, in
import numpy as np
File "C:\Program Files\Micromine Origin & Beyond 2022.5\Python\lib\site-packages\numpy\__init__.py", line 140, in
from . import core
File "C:\Program Files\Micromine Origin & Beyond 2022.5\Python\lib\site-packages\numpy\core\__init__.py", line 49, in
Customer support service by UserEcho
Fixed it by installing Python3.8 and then installing pandas by running "py -3.8 -m pip install pandas" in a cmd window. Then pointed Micromine to the pandas installation by opening 'Script Options' and set 'External Python repository Path' to "...AppData\Local\Programs\Python\Python38\Lib\site-packages" (the location of the Py3.8 pandas install). All now works, can import pandas in a Micromine script.
I am having a problem also importing python libraries like pandas, numpy etc. I have looked for Python 3.8 installer so that i can downgrade Python 3.10.1. However it looks like 3.8 version is being phased out. Any different solutions to this will be very helpful.
Hi Bwalya, You're right that Python is now up to version 3.11 but 3.8 is still available to download and can be used with no problems. I think python 3.8 is the only version Micromine currently supports, so that's the version you have to use. Python 3.8 can be downloaded from here https://www.python.org/downloads/
Thanks very much. I did manage to install 3.8. I think its also critical to add the path to where the python libraries are located on the "External Python Module Repositories Path" under Script Options within the Script Manu in MIcromine like you said on the early post. After the repository paths are added any version after 3.8 can still work.
Thanks very much.