You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the first BART model example from Bayesian Analysis with Python in Google Colab.
I'm getting some errors that I think are related to pytensor? I'm an absolute novice, so I have no idea.
When I run the following:
with pm.Model() as model_pen:
σ = pm.HalfNormal("σ", 1)
μ = pmb.BART("μ", X, Y, m=50)
y = pm.Normal("y", mu=μ, sigma=σ, observed=Y)
idata_pen = pm.sample()
I get a long series of errors. One in particular sorta repeats for while. See below.
/usr/local/lib/python3.10/site-packages/pytensor/tensor/random/op.py:84: FutureWarning: ndim_supp is deprecated. Provide signature instead.
warnings.warn(
/usr/local/lib/python3.10/site-packages/pytensor/tensor/random/op.py:94: FutureWarning: ndims_params is deprecated. Provide signature instead.
warnings.warn(
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: Cast{float32}(1)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pytensor/graph/rewriting/basic.py", line 1909, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "/usr/local/lib/python3.10/site-packages/pytensor/graph/rewriting/basic.py", line 1081, in transform
return self.fn(fgraph, node)
File "/usr/local/lib/python3.10/site-packages/pytensor/tensor/rewriting/basic.py", line 1121, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1182, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1103, in compile
thunk, module = self.cthunk_factory(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1627, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/cmodule.py", line 1255, in module_from_key
module = lnk.compile_cmodule(location)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1528, in compile_cmodule
module = c_compiler.compile_str(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/cmodule.py", line 2654, in compile_str
raise CompileError(
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
/usr/local/bin/g++ -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 -fPIC -I/usr/local/lib/python3.10/dist-packages/numpy/core/include -I/usr/include/python3.10 -I/usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code -L/usr/lib/x86_64-linux-gnu -L/usr/lib -fvisibility=hidden -o /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mbb1a558a69b3834cbd8bb5160f53dcb1edcf00af31190d19c71508ba0bcc380a.so /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mod.cpp -lpython3.10
In file included from /usr/include/python3.10/Python.h:8,
from /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mod.cpp:1:
/usr/include/python3.10/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.10/pyconfig.h: No such file or directory
3 | # include <x86_64-linux-gnu/python3.10/pyconfig.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
There's lots of other stuff, but here' the final error message:
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.212, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
CompileError: Compilation failed (return status=1):
/usr/local/bin/g++ -shared -g -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/usr/local/lib/python3.10/dist-packages/numpy/core/include -I/usr/include/python3.10 -I/usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code -L/usr/lib/x86_64-linux-gnu -L/usr/lib -fvisibility=hidden -o /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/lazylinker_ext.so /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/mod.cpp -lpython3.10
In file included from /usr/include/python3.10/Python.h:8,
from /usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code/pytensor_mod_helper.h:4,
from /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/mod.cpp:1:
/usr/include/python3.10/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.10/pyconfig.h: No such file or directory
3 | # include <x86_64-linux-gnu/python3.10/pyconfig.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Sorry for including so much text, but these errors are all way above my understanding, and I don't know what's relevant. Maybe the problem is colab? As in, I might not have the appropriate version of some library?
Anyway, all of my code is below.
All my code
#downloads conda
!pip install -q condacolab
import condacolab
condacolab.install()
#makes sure I have pymc v5
!conda install -c conda-forge "pymc>=5"
#bleeding edge pymc_bart
!pip install git+https://github.com/pymc-devs/pymc-bart.git
import arviz as az
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc as pm
import pymc_bart as pmb
#data
penguins = pd.read_csv("https://raw.githubusercontent.com/thedarredondo/data-science-fundamentals/main/Data/penguins.csv").dropna()
Y = penguins["body_mass"]
pen = penguins
pen['sex'] = pen['sex'].replace(['male', 'female'],[0, 1])
pen['species'] = pen['species'].replace(['Adelie', 'Chinstrap', 'Gentoo'],[0, 1, 2])
X = pen[["flipper_length", "bill_depth", "bill_length"]]
#the textbook example
with pm.Model() as model_pen:
σ = pm.HalfNormal("σ", 1)
μ = pmb.BART("μ", X, Y, m=50)
y = pm.Normal("y", mu=μ, sigma=σ, observed=Y)
idata_pen = pm.sample()
The text was updated successfully, but these errors were encountered:
Short Description
Hi all,
I'm trying to run the first BART model example from Bayesian Analysis with Python in Google Colab.
I'm getting some errors that I think are related to pytensor? I'm an absolute novice, so I have no idea.
When I run the following:
I get a long series of errors. One in particular sorta repeats for while. See below.
/usr/local/lib/python3.10/site-packages/pytensor/tensor/random/op.py:84: FutureWarning: ndim_supp is deprecated. Provide signature instead.
warnings.warn(
/usr/local/lib/python3.10/site-packages/pytensor/tensor/random/op.py:94: FutureWarning: ndims_params is deprecated. Provide signature instead.
warnings.warn(
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: Cast{float32}(1)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pytensor/graph/rewriting/basic.py", line 1909, in process_node
replacements = node_rewriter.transform(fgraph, node)
File "/usr/local/lib/python3.10/site-packages/pytensor/graph/rewriting/basic.py", line 1081, in transform
return self.fn(fgraph, node)
File "/usr/local/lib/python3.10/site-packages/pytensor/tensor/rewriting/basic.py", line 1121, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/op.py", line 119, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/op.py", line 84, in make_c_thunk
outputs = cl.make_thunk(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1182, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.compile(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1103, in compile
thunk, module = self.cthunk_factory(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1627, in cthunk_factory
module = cache.module_from_key(key=key, lnk=self)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/cmodule.py", line 1255, in module_from_key
module = lnk.compile_cmodule(location)
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/basic.py", line 1528, in compile_cmodule
module = c_compiler.compile_str(
File "/usr/local/lib/python3.10/site-packages/pytensor/link/c/cmodule.py", line 2654, in compile_str
raise CompileError(
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
/usr/local/bin/g++ -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 -fPIC -I/usr/local/lib/python3.10/dist-packages/numpy/core/include -I/usr/include/python3.10 -I/usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code -L/usr/lib/x86_64-linux-gnu -L/usr/lib -fvisibility=hidden -o /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mbb1a558a69b3834cbd8bb5160f53dcb1edcf00af31190d19c71508ba0bcc380a.so /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mod.cpp -lpython3.10
In file included from /usr/include/python3.10/Python.h:8,
from /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/tmpa484ve2i/mod.cpp:1:
/usr/include/python3.10/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.10/pyconfig.h: No such file or directory
3 | # include <x86_64-linux-gnu/python3.10/pyconfig.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
There's lots of other stuff, but here' the final error message:
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.212, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
CompileError Traceback (most recent call last)
/usr/local/lib/python3.10/site-packages/pytensor/link/c/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2652 # difficult to read.
2653 # compile_stderr = compile_stderr.replace("\n", ". ")
-> 2654 raise CompileError(
2655 f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
2656 )
CompileError: Compilation failed (return status=1):
/usr/local/bin/g++ -shared -g -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/usr/local/lib/python3.10/dist-packages/numpy/core/include -I/usr/include/python3.10 -I/usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code -L/usr/lib/x86_64-linux-gnu -L/usr/lib -fvisibility=hidden -o /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/lazylinker_ext.so /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/mod.cpp -lpython3.10
In file included from /usr/include/python3.10/Python.h:8,
from /usr/local/lib/python3.10/site-packages/pytensor/link/c/c_code/pytensor_mod_helper.h:4,
from /root/.pytensor/compiledir_Linux-6.1.85+-x86_64-with-glibc2.35-x86_64-3.10.12-64/lazylinker_ext/mod.cpp:1:
/usr/include/python3.10/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.10/pyconfig.h: No such file or directory
3 | # include <x86_64-linux-gnu/python3.10/pyconfig.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Sorry for including so much text, but these errors are all way above my understanding, and I don't know what's relevant. Maybe the problem is colab? As in, I might not have the appropriate version of some library?
Anyway, all of my code is below.
All my code
The text was updated successfully, but these errors were encountered: