Python version for UQpyLab

Hi,
I have recently started to use the UQpyLab framework and firstly would like to say great work! with these very comprehensive and detailed packages (in matlab and python) you’ve developed :smiley:

I wish to combine UQpylab with another package (developed in python) for reliability analysis of floating wind turbines, the latter being with a python version ‘3.12.5’, while UQpylab ‘s default installation (“>=3.9” from the getting started page) is 3.9.23.

With this I noticed that UQpylab doesnt work when upgraded to a higher python version and gives the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\core\__init__.py:24
     23 try:
---> 24     from . import multiarray
     25 except ImportError as exc:

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\core\multiarray.py:10
      9 import functools
---> 10 from . import overrides
     11 from . import _multiarray_umath

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\core\overrides.py:8
      7 from .._utils._inspect import getargspec
----> 8 from numpy.core._multiarray_umath import (
      9     add_docstring,  _get_implementing_args, _ArrayFunctionDispatcher)
     12 ARRAY_FUNCTIONS = set()

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\__init__.py:159
    158 try:
--> 159     from numpy.__config__ import show as show_config
    160 except ImportError as e:

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\__config__.py:4
      3 from enum import Enum
----> 4 from numpy.core._multiarray_umath import (
      5     __cpu_features__,
      6     __cpu_baseline__,
      7     __cpu_dispatch__,
      8 )
     10 __all__ = ["show"]

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\core\__init__.py:50
     27     msg = """
     28 
     29 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
   (...)
     48 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
     49         __version__, exc)
---> 50     raise ImportError(msg)
     51 finally:

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.12 from "c:\Users\vasudevg\.conda\envs\uqpylab-env\python.exe"
  * The NumPy version is: "1.26.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'


The above exception was the direct cause of the following exception:

ImportError                               Traceback (most recent call last)
File m:\Vasudev_Gupta\Python_Files\UQpyLab\examples\01_probab_input_modelling\Input-1-Sampling.py:2
      1 # %%
----> 2 from uqpylab import sessions
      3 import matplotlib.pyplot as plt
      4 from uqpylab.display_util import get_uq_color_order

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\uqpylab\sessions.py:1
----> 1 import uqpylab.helpers as helpers
      2 import uqpylab.interface as interface
      3 import json

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\uqpylab\helpers.py:2
      1 import pdb
----> 2 import scipy.io as spio
      3 from importlib import import_module,util
      4 import uqpylab.display_util as display_util

File ~\AppData\Roaming\Python\Python312\site-packages\scipy\__init__.py:60
     56 # end delvewheel patch
     58 import importlib as _importlib
---> 60 from numpy import __version__ as __numpy_version__
     63 try:
     64     from scipy.__config__ import show as show_config

File c:\Users\vasudevg\.conda\envs\uqpylab-env\Lib\site-packages\numpy\__init__.py:164
    160 except ImportError as e:
    161     msg = """Error importing numpy: you should not try to import numpy from
    162     its source directory; please exit the numpy source tree, and relaunch
    163     your python interpreter from there."""
--> 164     raise ImportError(msg) from e
    166 __all__ = [
    167     'exceptions', 'ModuleDeprecationWarning', 'VisibleDeprecationWarning',
    168     'ComplexWarning', 'TooHardError', 'AxisError']
    170 # mapping of {name: (value, deprecation_msg)}

ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

UQpylab with python version 3.9.23 works smoothly.

Could you please clarify why this is the case, and some possibilities UQpylab could be run in a updated python version?

Thank you :smiley:

Hi @ibrahim_hanif,

From the traceback, it looks like NumPy is being imported from your virtual environment, while SciPy is being imported from your global Python installation. I would recommend creating a fresh virtual environment (using your preferred Python version) and reinstalling uqpylab , numpy , and scipy from scratch within that environment only. Maybe that already solves your issue.

Best regards,
Styfen