Using MSVC compiler with pytensor

So my company is not likely to allow me to use G++ anytime soon so the only C compiler I have access to at work is MSVC. I am attempting to use the following code to point pytensor to the compiler with a glaring issue that keeps cropping up. Running the following code:

import pytensor

pytensor.config.cxx=r’C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe’

pytensor.config.cxxflags = r’-I"C:\Program Files (x86)\Windows Kits\10\bin"-I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\include"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\um"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\winrt"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\cppwinrt’

And then running a simple model, I get the following as part of my error messages:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"c:\Users\WYoung1\AppData\Python.venv\Lib\site-packages\numpy\core\include" -I"C:\Program Files\Python312\include" -I"c:\Users\WYoung1\AppData\Python.venv\Lib\site-packages\pytensor\link\c\c_code" -L"C:\Program Files\Python312\libs" -L"C:\Program Files\Python312" -o “C:\Users\WYoung1\AppData\Local\PyTensor\compiledir_Windows-10-10.0.19045-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.12.3-64\tmp0zbh_sn_\mfeba4d434591def33153ec442edc27a735fd9fa46fd5f1fae8efd4f490539b0a.pyd” “C:\Users\WYoung1\AppData\Local\PyTensor\compiledir_Windows-10-10.0.19045-SP0-Intel64_Family_6_Model_186_Stepping_2_GenuineIntel-3.12.3-64\tmp0zbh_sn_\mod.cpp” “C:\Program Files\Python312\python312.dll”
‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

From what I can tell observing this issue, the following is happening:

1.pytensor is asking for complier flags in the syntax of g++
2. pytensor may not understand that I am pointing it to another compiler
3. While I am aware my attempt to add cxxflags did not include linking folders, I was testing cxxflags I submitted would be picked up by PYTENSOR at all and the fact that they did not is indicative of a problem.
Does anyone have advice on how to handle this situation–without changing compilers or adding additional packages as that would be at least 6 months of waiting for my IT department to consider if they would allow that.

My package list will be in a coment below.


>  name                      │ version        │ location                                                               │
> ├───────────────────────────┼────────────────┼────────────────────────────────────────────────────────────────────────┤
> │ access                    │ 1.1.9          │                                                                        │
> │ affine                    │ 2.4.0          │                                                                        │
> │ anyio                     │ 4.4.0          │                                                                        │
> │ argon2-cffi               │ 23.1.0         │                                                                        │
> │ argon2-cffi-bindings      │ 21.2.0         │                                                                        │
> │ arrow                     │ 1.3.0          │                                                                        │
> │ arviz                     │ 0.18.0         │ C:\Users\WYoung1\AppData\Python\sharexwhls\arviz-0.18.0-py3-none-any.… │
> │ asttokens                 │ 2.4.1          │                                                                        │
> │ async-lru                 │ 2.0.4          │                                                                        │
> │ attrs                     │ 23.2.0         │                                                                        │
> │ awswrangler               │ 3.8.0          │ C:\Users\WYoung1\AppData\Python\sharexwhls\awswrangler-3.8.0-py3-none… │
> │ Babel                     │ 2.15.0         │                                                                        │
> │ beautifulsoup4            │ 4.12.3         │ C:\Users\WYoung1\AppData\Python\sharexwhls\beautifulsoup4-4.12.3-py3-… │
> │ bleach                    │ 6.1.0          │                                                                        │
> │ bokeh                     │ 3.4.1          │ C:\Users\WYoung1\AppData\Python\sharexwhls\bokeh-3.4.1-py3-none-any.w… │
> │ boto3                     │ 1.34.124       │ C:\Users\WYoung1\AppData\Python\sharexwhls\boto3-1.34.124-py3-none-an… │
> │ botocore                  │ 1.34.127       │                                                                        │
> │ cachetools                │ 5.3.3          │                                                                        │
> │ certifi                   │ 2024.6.2       │                                                                        │
> │ cffi                      │ 1.16.0         │                                                                        │
> │ charset-normalizer        │ 3.3.2          │                                                                        │
> │ click                     │ 8.1.7          │                                                                        │
> │ click-plugins             │ 1.1.1          │                                                                        │
> │ cligj                     │ 0.7.2          │                                                                        │
> │ cloudpickle               │ 3.0.0          │                                                                        │
> │ colorama                  │ 0.4.6          │                                                                        │
> │ comm                      │ 0.2.2          │                                                                        │
> │ cons                      │ 0.4.6          │                                                                        │
> │ contourpy                 │ 1.2.1          │                                                                        │
> │ cycler                    │ 0.12.1         │                                                                        │
> │ debugpy                   │ 1.8.1          │                                                                        │
> │ decorator                 │ 5.1.1          │                                                                        │
> │ defusedxml                │ 0.7.1          │                                                                        │
> │ deprecation               │ 2.1.0          │                                                                        │
> │ dm-tree                   │ 0.1.8          │                                                                        │
> │ earthengine-api           │ 0.1.406        │ C:\Users\WYoung1\AppData\Python\sharexwhls\earthengine_api-0.1.406-py… │
> │ esda                      │ 2.5.1          │                                                                        │
> │ etuples                   │ 0.3.9          │                                                                        │
> │ executing                 │ 2.0.1          │                                                                        │
> │ fastjsonschema            │ 2.20.0         │                                                                        │
> │ filelock                  │ 3.15.1         │                                                                        │
> │ fiona                     │ 1.9.6          │                                                                        │
> │ fitter                    │ 1.7.0          │ C:\Users\WYoung1\AppData\Python\sharexwhls\fitter-1.7.0-py3-none-any.… │
> │ fonttools                 │ 4.53.0         │                                                                        │
> │ fqdn                      │ 1.5.1          │                                                                        │
> │ fsspec                    │ 2024.6.0       │                                                                        │
> │ geopandas                 │ 0.14.4         │ C:\Users\WYoung1\AppData\Python\sharexwhls\geopandas-0.14.4-py3-none-… │
> │ giddy                     │ 2.3.5          │                                                                        │
> │ google-api-core           │ 2.19.0         │                                                                        │
> │ google-api-python-client  │ 2.133.0        │                                                                        │
> │ google-auth               │ 2.30.0         │                                                                        │
> │ google-auth-httplib2      │ 0.2.0          │                                                                        │
> │ google-cloud-core         │ 2.4.1          │                                                                        │
> │ google-cloud-storage      │ 2.17.0         │                                                                        │
> │ google-crc32c             │ 1.5.0          │                                                                        │
> │ google-resumable-media    │ 2.7.1          │                                                                        │
> │ googleapis-common-protos  │ 1.63.1         │                                                                        │
> │ graphviz                  │ 0.20.3         │ C:\Users\WYoung1\AppData\Python\sharexwhls\graphviz-0.20.3-py3-none-a… │
> │ h11                       │ 0.14.0         │                                                                        │
> │ h5netcdf                  │ 1.3.0          │                                                                        │
> │ h5py                      │ 3.11.0         │                                                                        │
> │ httpcore                  │ 1.0.5          │                                                                        │
> │ httplib2                  │ 0.22.0         │                                                                        │
> │ httpx                     │ 0.27.0         │                                                                        │
> │ idna                      │ 3.7            │                                                                        │
> │ importlib_metadata        │ 7.1.0          │                                                                        │
> │ inequality                │ 1.0.1          │                                                                        │
> │ intel-openmp              │ 2024.1.2       │                                                                        │
> │ ipykernel                 │ 6.29.4         │                                                                        │
> │ ipython                   │ 8.25.0         │ C:\Users\WYoung1\AppData\Python\sharexwhls\ipython-8.25.0-py3-none-an… │
> │ ipywidgets                │ 8.1.3          │ C:\Users\WYoung1\AppData\Python\sharexwhls\ipywidgets-8.1.3-py3-none-… │
> │ isoduration               │ 20.11.0        │                                                                        │
> │ jedi                      │ 0.19.1         │                                                                        │
> │ Jinja2                    │ 3.1.4          │                                                                        │
> │ jmespath                  │ 1.0.1          │                                                                        │
> │ joblib                    │ 1.4.2          │                                                                        │
> │ json5                     │ 0.9.25         │                                                                        │
> │ jsonpointer               │ 3.0.0          │                                                                        │
> │ jsonschema                │ 4.22.0         │                                                                        │
> │ jsonschema-specifications │ 2023.12.1      │                                                                        │
> │ jupyter-events            │ 0.10.0         │                                                                        │
> │ jupyter-lsp               │ 2.2.5          │                                                                        │
> │ jupyter_client            │ 8.6.2          │                                                                        │
> │ jupyter_core              │ 5.7.2          │                                                                        │
> │ jupyter_server            │ 2.14.1         │                                                                        │
> │ jupyter_server_terminals  │ 0.5.3          │                                                                        │
> │ jupyterlab                │ 4.2.2          │                                                                        │
> │ jupyterlab_pygments       │ 0.3.0          │                                                                        │
> │ jupyterlab_server         │ 2.27.2         │                                                                        │
> │ jupyterlab_widgets        │ 3.0.11         │                                                                        │
> │ kiwisolver                │ 1.4.5          │                                                                        │
> │ libpysal                  │ 4.11.0         │                                                                        │
> │ libpython                 │ 0.2            │                                                                        │
> │ llvmlite                  │ 0.42.0         │                                                                        │
> │ logical-unification       │ 0.4.6          │                                                                        │
> │ loguru                    │ 0.7.2          │                                                                        │
> │ lxml                      │ 5.2.2          │                                                                        │
> │ mapclassify               │ 2.6.1          │                                                                        │
> │ markdown-it-py            │ 3.0.0          │                                                                        │
> │ MarkupSafe                │ 2.1.5          │                                                                        │
> │ matplotlib                │ 3.9.0          │                                                                        │
> │ matplotlib-inline         │ 0.1.7          │                                                                        │
> │ mdurl                     │ 0.1.2          │                                                                        │
> │ mgwr                      │ 2.2.1          │                                                                        │
> │ miniKanren                │ 1.0.3          │                                                                        │
> │ mistune                   │ 3.0.2          │                                                                        │
> │ mkl                       │ 2024.1.0       │                                                                        │
> │ momepy                    │ 0.7.0          │                                                                        │
> │ mpmath                    │ 1.3.0          │                                                                        │
> │ multipledispatch          │ 1.0.0          │                                                                        │
> │ nbclient                  │ 0.10.0         │                                                                        │
> │ nbconvert                 │ 7.16.4         │                                                                        │
> │ nbformat                  │ 5.10.4         │                                                                        │
> │ nest-asyncio              │ 1.6.0          │                                                                        │
> │ networkx                  │ 3.3            │ C:\Users\WYoung1\AppData\Python\sharexwhls\networkx-3.3-py3-none-any.… │
> │ notebook                  │ 7.2.1          │                                                                        │
> │ notebook_shim             │ 0.2.4          │                                                                        │
> │ numba                     │ 0.59.1         │ C:\Users\WYoung1\AppData\Python\sharexwhls\numba-0.59.1-cp312-cp312-w… │
> │ numpy                     │ 1.26.4         │                                                                        │
> │ nutpie                    │ 0.11.0         │ C:\Users\WYoung1\AppData\Python\sharexwhls\nutpie-0.11.0-cp312-none-w… │
> │ overrides                 │ 7.7.0          │                                                                        │
> │ packaging                 │ 24.1           │                                                                        │
> │ pandas                    │ 2.2.2          │ C:\Users\WYoung1\AppData\Python\sharexwhls\pandas-2.2.2-cp312-cp312-w… │
> │ pandocfilters             │ 1.5.1          │                                                                        │
> │ parso                     │ 0.8.4          │                                                                        │
> │ patsy                     │ 0.5.6          │                                                                        │
> │ pillow                    │ 10.3.0         │                                                                        │
> │ platformdirs              │ 4.2.2          │                                                                        │
> │ pointpats                 │ 2.4.0          │                                                                        │
> │ prometheus_client         │ 0.20.0         │                                                                        │
> │ prompt_toolkit            │ 3.0.47         │                                                                        │
> │ proto-plus                │ 1.23.0         │                                                                        │
> │ protobuf                  │ 4.25.3         │                                                                        │
> │ psutil                    │ 6.0.0          │                                                                        │
> │ PuLP                      │ 2.8.0          │                                                                        │
> │ pure-eval                 │ 0.2.2          │                                                                        │
> │ pyarrow                   │ 16.1.0         │                                                                        │
> │ pyasn1                    │ 0.6.0          │                                                                        │
> │ pyasn1_modules            │ 0.4.0          │                                                                        │
> │ PyAthena                  │ 3.8.3          │ C:\Users\WYoung1\AppData\Python\sharexwhls\pyathena-3.8.3-py3-none-an… │
> │ pycparser                 │ 2.22           │                                                                        │
> │ Pygments                  │ 2.18.0         │                                                                        │
> │ pymc                      │ 5.15.1         │ C:\Users\WYoung1\AppData\Python\sharexwhls\pymc-5.15.1-py3-none-any.w… │
> │ pynndescent               │ 0.5.13         │                                                                        │
> │ pyparsing                 │ 3.1.2          │                                                                        │
> │ pyproj                    │ 3.6.1          │                                                                        │
> │ pysal                     │ 24.1           │ C:\Users\WYoung1\AppData\Python\sharexwhls\pysal-24.1-py3-none-any.whl │
> │ pytensor                  │ 2.22.1         │                                                                        │
> │ python-dateutil           │ 2.9.0.post0    │                                                                        │
> │ python-json-logger        │ 2.0.7          │                                                                        │
> │ pytz                      │ 2024.1         │                                                                        │
> │ pywin32                   │ 306            │                                                                        │
> │ pywinpty                  │ 2.0.13         │                                                                        │
> │ PyYAML                    │ 6.0.1          │                                                                        │
> │ pyzmq                     │ 26.0.3         │                                                                        │
> │ quantecon                 │ 0.7.2          │                                                                        │
> │ rasterio                  │ 1.3.10         │ C:\Users\WYoung1\AppData\Python\sharexwhls\rasterio-1.3.10-cp312-cp31… │
> │ rasterstats               │ 0.19.0         │                                                                        │
> │ referencing               │ 0.35.1         │                                                                        │
> │ requests                  │ 2.32.3         │                                                                        │
> │ rfc3339-validator         │ 0.1.4          │                                                                        │
> │ rfc3986-validator         │ 0.1.1          │                                                                        │
> │ rich                      │ 13.7.1         │                                                                        │
> │ rich-click                │ 1.8.3          │                                                                        │
> │ rpds-py                   │ 0.18.1         │                                                                        │
> │ rsa                       │ 4.9            │                                                                        │
> │ Rtree                     │ 1.2.0          │                                                                        │
> │ s3transfer                │ 0.10.1         │                                                                        │
> │ scikit-learn              │ 1.5.0          │ C:\Users\WYoung1\AppData\Python\sharexwhls\scikit_learn-1.5.0-cp312-c… │
> │ scipy                     │ 1.13.1         │ C:\Users\WYoung1\AppData\Python\sharexwhls\scipy-1.13.1-cp312-cp312-w… │
> │ seaborn                   │ 0.13.2         │ C:\Users\WYoung1\AppData\Python\sharexwhls\seaborn-0.13.2-py3-none-an… │
> │ segregation               │ 2.5            │                                                                        │
> │ Send2Trash                │ 1.8.3          │                                                                        │
> │ setuptools                │ 70.0.0         │                                                                        │
> │ shapely                   │ 2.0.4          │                                                                        │
> │ simplejson                │ 3.19.2         │                                                                        │
> │ six                       │ 1.16.0         │                                                                        │
> │ sniffio                   │ 1.3.1          │                                                                        │
> │ snuggs                    │ 1.4.7          │                                                                        │
> │ soupsieve                 │ 2.5            │                                                                        │
> │ spaghetti                 │ 1.7.5.post1    │                                                                        │
> │ spglm                     │ 1.1.0          │                                                                        │
> │ spint                     │ 1.0.7          │                                                                        │
> │ splot                     │ 1.1.5.post1    │                                                                        │
> │ spopt                     │ 0.6.0          │                                                                        │
> │ spreg                     │ 1.4.2          │                                                                        │
> │ spvcm                     │ 0.3.0          │                                                                        │
> │ stack-data                │ 0.6.3          │                                                                        │
> │ statsmodels               │ 0.14.2         │                                                                        │
> │ sympy                     │ 1.12.1         │                                                                        │
> │ tbb                       │ 2021.12.0      │                                                                        │
> │ tenacity                  │ 8.4.1          │                                                                        │
> │ terminado                 │ 0.18.1         │                                                                        │
> │ threadpoolctl             │ 3.5.0          │                                                                        │
> │ tinycss2                  │ 1.3.0          │                                                                        │
> │ tobler                    │ 0.11.2         │                                                                        │
> │ toolz                     │ 0.12.1         │                                                                        │
> │ tornado                   │ 6.4.1          │                                                                        │
> │ tqdm                      │ 4.66.4         │                                                                        │
> │ traitlets                 │ 5.14.3         │                                                                        │
> │ types-python-dateutil     │ 2.9.0.20240316 │                                                                        │
> │ typing_extensions         │ 4.12.2         │                                                                        │
> │ tzdata                    │ 2024.1         │                                                                        │
> │ umap-learn                │ 0.5.6          │ C:\Users\WYoung1\AppData\Python\sharexwhls\umap_learn-0.5.6-py3-none-… │
> │ uri-template              │ 1.3.0          │                                                                        │
> │ uritemplate               │ 4.1.1          │                                                                        │
> │ urllib3                   │ 2.2.2          │                                                                        │
> │ watermark                 │ 2.4.3          │ C:\Users\WYoung1\AppData\Python\sharexwhls\watermark-2.4.3-py2.py3-no… │
> │ wcwidth                   │ 0.2.13         │                                                                        │
> │ webcolors                 │ 24.6.0         │                                                                        │
> │ webencodings              │ 0.5.1          │                                                                        │
> │ websocket-client          │ 1.8.0          │                                                                        │
> │ widgetsnbextension        │ 4.0.11         │                                                                        │
> │ win32-setctime            │ 1.1.0          │                                                                        │
> │ xarray                    │ 2024.5.0       │ C:\Users\WYoung1\AppData\Python\sharexwhls\xarray-2024.5.0-py3-none-a… │
> │ xarray-einstats           │ 0.7.0          │                                                                        │
> │ xyzservices               │ 2024.6.0       │                                                                        │
> │ zipp                      │ 3.19.2

@lucianopaz ?

I think that the error you get is caused by the space between “Program” and “Files”. Could you try enclosing the whole cxx flag in double quotes?

@lucianopaz after removing the space between program and files, it picked up the full path for the c complier but as the “Program Files” folder has a space in the name, it cannot find the file path.I finally had to put a single quote around the double quoting of the path to the complier to get it to interpret everything correctly. After running the following:

import pytensor

pytensor.config.cxx=r’“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe”’

pytensor.config.cxxflags = r’-I"C:\Program Files (x86)\Windows Kits\10\bin"-I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\include"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\ucrt"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\um"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\winrt"-I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\cppwinrt-L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\ucrt\x86"-L"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\lib\x86"-L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\um\x86"’

The error messages are saying it is failing to compile with the error message cl : Command line error D8021 : invalid numeric argument ‘/Wno-unused-label’ This is something that I saw referenced in the original error message before I made my inputs to pytensor.config.cxxflags. Calling that function now returns only what I would expect which is

‘-I\“C:\\Program Files (x86)\\Windows Kits\\10\\bin”-I\“C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.29.30133\\include”-I\“C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.20348.0\\ucrt”-I\“C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.20348.0\\shared”-I\“C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.20348.0\\um”-I\“C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.20348.0\\winrt”-I\"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.20348.0\\cppwinrt-L\“C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.20348.0\\ucrt\\x86”-L\“C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.29.30133\\lib\\x86”-L\“C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.20348.0\\um\\x86”’

So it seems progress is being made but it for some reason, that flag which is no longer showing in pytensor.config.cxxflags is still making an appearance at execution.

PyMC may be adding the flag itself IIRC

As @ricardoV94 said, pytensor is adding that compilation flag. I’m afraid that there is no easy way around that. You could:

  1. Create a subclass of CLinker that overloads the compile_args method so that it doesn’t use those extra flags. I don’t know how to get that linker to be used later though. Maybe @ricardoV94 can help with that.
  2. You could monkey-patch the pytensor.CLinker class to overload its compile_args method. The catch is that you have to monkey-patch it right after importing pytensor, and if you forget doing it in time, you’ll get the wrong flags again.
  3. Edit the pytensor code locally so that it doesn’t add those flags. This would be the worse case scenario, but maybe you could try it out to see if options 1 or 2 will actually allow your code to work.

I don’t know if pytensor itself should be able to detect any C compiler’s valid arguments, but if it should, it’s worth opening an issue on GitHub.

@lucianopaz thank you for this, I’ll check this solution but I am just wondering how I access the the CLinker class–I have not tried to access the this many layers deep into a module before and I am unclear how to direct python towards the Clinker from code I am writing. For example I tried pytensor.link.c.basic and was told the module did not exist.

I understand. It’s not easy to do, and doing something like the first two points that I mentioned would involve some advanced coding skills. To be able to import the CLinker, you’ll have to do something like:

from pytensor.link.c.basic import CLinker

but getting the c mode use a monkey patched version of the linker, or building a new mode with a subclass of the linker is a whole other level.

The third point is easier. You just need to use an editor to open the pytensor/link/c/basic.py file from where you installed pytensor, remove the compilation flags and save the file. After that, you can try if your simple model works.

Up until now we’ve only focused on trying to make things work with msvc, which pytensor doesn’t do out of the box, and is uncharted territory. Maybe you could explore the possibility of accessing the windows subsystem for linux (WSL). If you can use that, it would make using pymc much simpler. Maybe @fonnesbeck can weigh in on how that looks like.

Alternatively @Wesley_Young you can try to avoid the C backend altogether, by setting pytensor.config.mode = "NUMBA" after importing PyMC, or using external nuts sampler nutpie (numba backend) or numpyro/blackjax (jax backend)

1 Like

How I wish I could but my organization would rather needlessly spend money than trust anything with the word Linux–American Tax dollars hard at work.

I have that package but mistakenly assumed that pymc would just recognize it was there. Wow,

so I tried this solution by importing Pytensor the immediately changing the config mode but that did not work, looking at the docs, those does not seem to be an option for this seem to be FAST_COMPILE, FAST_RUN, and DebugMode. Is there something I am missing? [Configuration Settings and Compiling Modes — PyTensor dev documentation](https://pytensor.config modes)

@lucianopaz So I was able to access the cLinker definition and rewrite them to suite MSVC but additional flags that are not present in Clinker are appearing when I check the error message. these flags are -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables . Any idea where these could be coming from?

@ricardoV94 even if I just import nutpie and try to use nutpie.compile_pymc_model directly without calling on pytensor, it acts as if I tried to sample using pytensor and I end up with the same c errors.

They are coming from pytensor.config. gcc__cxxflags. You can override those flags directly.

You can disable the C backend by doing pytensor.config.cxx = "". Having said that "NUMBA" is definitely a valid global mode

@ricardoV94 that worked and looking at the code, the option is there, the documentation is just confusing as it seems to omit that NUMBA global variable. Thank you. Not yet marking this as a solved only because I am curious to see if the c complier issue can be resolved as well. But this is definitely viable if that wont work.

@lucianopaz
So the oddities continue. If I run pytensor.config.gcc__cxxflags =‘’ then the returned are:

cl : Command line warning D9002 : ignoring unknown option ‘-m64’
cl : Command line warning D9002 : ignoring unknown option ‘-LC:\Program Files\Python312\libs’
cl : Command line warning D9002 : ignoring unknown option ‘-LC:\Program Files\Python312’
cl : Command line warning D9024 : unrecognized source file type ‘C:\Program Files\Python312\python312.dll’, object file assumed

If I do the same but run pytensor.config.gcc__cxxflags =‘“”’ then the -m64 error is dropped and in its place is the error cl : Command line warning D9024 : unrecognized source file type ‘’, object file assumed.